How to Use Laya: Install, Checkpoints, and Quickstart
A step-by-step developer guide to installing, configuring, and deploying Laya decision models in production.
To use Laya, install the package using pip, load a checkpoint from Hugging Face, provide a state context with typed questions, and process the probability scores returned for each candidate answer. At Layer3Labs, we build and run AI systems inside other people's businesses, and we test lightweight decision routers when full generative models cost too much to run at volume. This walkthrough details how to use laya across local Python scripts and production services.
Laya functions as a specialized decision model developed by Convai Innovations to classify text and route structured decisions. Instead of generating open-ended sentences, the architecture evaluates user-defined choices and returns probability scores across defined categories. This design keeps memory footprints small while providing fast inference speeds across routine business tasks.
Zero-shot accuracy for out-of-the-box checkpoints sits near 0.35. That requires fine-tuning. Teams that need immediate accuracy without training data should look elsewhere, but teams with domain-specific datasets can train effective routers in hours.
How to Use Laya with Quickstart Scripts
Installing Laya requires running a standard package manager command in an environment capable of executing Python libraries. Run the command in your terminal. You install the library directly from the official Python Package Index (PyPI) repository by executing pip install laya or pip install laya>=0.3.3. The project source code is maintained on the GitHub repository, where you can verify recent code updates and release notes.
After completing the laya pip install step, instantiate the router class inside your script to confirm that the package resolves dependencies correctly. Running from laya import Router followed by router = Router(preload=True) initializes the runtime and prepares internal model caches for inference requests. Preloading caches eliminates cold-start delay. This prevents response delays during initial live calls.
Alternatively, you can access the model using direct loading functions through import laya and calling model = laya.load('convaiinnovations/laya'). This approach loads weights downloaded directly from Hugging Face into local system memory. When the checkpoint loads without errors, your runtime environment is ready to evaluate incoming text payloads.
- Run
pip install layaorpip install laya>=0.3.3inside your active Python environment. - Import the router interface with
from laya import Routerto access packaged decision methods. - Initialize the routing engine with
router = Router(preload=True)to cache weights in memory. - Inspect official dependency updates and release tags through the project repository.
State Payloads and How to Use Laya Decisions
Laya evaluates decisions by accepting a textual state context paired with explicit typed questions that outline allowable response options. The state context consists of a string representing current conversation history, document content, or application logs requiring classification. Context matters. In customer support automation, the state string contains the inbound customer inquiry, customer tier, and recent ticket subject formatted as clean plain text or serialized JavaScript Object Notation (JSON).
Typed questions define the specific categorization task by pairing a query string with an array of distinct choice labels. A question evaluating ticket intent might specify categories such as billing dispute, technical bug, and password reset. The router processes the context against these options and scores every choice on a normalized scale, returning decimal values that represent the probability distribution across all declared candidates.
Besides categorical choice questions, the framework supports scoring questions and open-ended non-choice evaluations termed noul queries. A score question asks the model to rate priority or sentiment along an ordinal scale, while a noul question evaluates whether an unconstrained condition applies. Reading the output requires parsing the returned dictionary structure, identifying the highest probability label, and executing the downstream branch matching that outcome.
Interpreting probability scores requires establishing clear operational rules inside your application logic. Raw probabilities reflect relative confidence. Because raw scores compare alternatives rather than absolute certainty, your system should evaluate the spread between the top candidate and competing choices. When the gap between probabilities is narrow, the input text likely contains ambiguous wording that warrants manual review rather than automated action.
- Define the state payload as a concise string holding the conversation turn or document text.
- Supply typed questions containing structured choice arrays that represent valid classification targets.
- Parse output dictionaries to extract candidate probabilities across choice, score, and noul formats.
- Evaluate probability margins between competing choices to identify borderline classification cases.
Checkpoint Selection for Language and Routing Tasks
Selecting the right model checkpoint depends on your application language requirements and the complexity of your routing schema. The base convaiinnovations/laya checkpoint published on Hugging Face serves as the standard starting point for English-language classification tasks. It balances parameter size with quick inference times, making it suitable for standard Central Processing Unit (CPU) deployment environments where operational simplicity matters most.
If your workflow handles cross-border operations or non-English inquiries, select the multilingual checkpoint published by Convai Innovations. The multilingual weights accommodate varied grammatical syntax and multi-language vocabularies, though they demand slightly more memory overhead during active inference. Deploying the multilingual model ensures consistent classification accuracy across regional variations without maintaining separate routing pipelines.
Specialized decision checkpoints target complex multi-turn logic where questions depend on earlier branching outputs. These checkpoints process hierarchical state structures better than the base English checkpoint, though they exhibit higher latency on simple classification tasks. Choose the base English model for routine inbox triage.
- Base checkpoint (
convaiinnovations/laya): recommended for standard English intent classification and triage. - Multilingual checkpoint: engineered for cross-border support queues and multi-language document routing.
- Specialized decision checkpoint: optimized for multi-tier branching logic and sequential dependent questions.
Fine-Tuning Workflows on Convai Innovations Kaggle Notebooks
Fine-tuning Laya on task-specific training data elevates real-world routing accuracy from baseline zero-shot levels to reliable production performance. Out of the box, base Laya checkpoints achieve zero-shot accuracy near 0.35, which falls short of enterprise reliability requirements. Training the model on several hundred labeled company examples adapts the underlying representations to your proprietary terminology.
Convai Innovations maintains a dedicated fine-tuning notebook on Kaggle that executes end-to-end model adaptation in approximately 4 hours on free cloud hardware. The notebook guides users through uploading custom JSON training datasets, formatting prompt structures, and running parameter optimization routines. Cloud execution saves local hardware expense.
Preparing your training dataset requires compiling historical state payloads alongside verified classification labels from past human decisions. Aim for at least fifty to one hundred representative examples per target category to ensure stable gradient convergence during the training run. Once the Kaggle run finishes, export the tuned checkpoint weights and load them into your production inference script using standard model loading functions.
- Baseline zero-shot accuracy hovers around 0.35, making targeted fine-tuning necessary for operational use.
- Convai Innovations' Kaggle notebook completes model training runs in approximately 4 hours using cloud compute.
- Assemble training sets containing fifty or more labeled examples per classification category.
- Export trained checkpoint artifacts directly from Kaggle for local or cloud deployment.
Testing Pipelines and Deployment Architecture
Testing Laya before installing local dependencies is fastest through the interactive Hugging Face Spaces demo. The browser-based demo environment allows operators to paste sample state text, define custom question structures, and inspect real-time probability outputs without configuring a local Python interpreter. This hosted sandbox provides quick validation for product managers evaluating whether Laya fits an intended classification architecture.
When moving from prototype testing into production architectures, set an operational confidence threshold based on your team's tolerance for classification errors rather than relying on an arbitrary cutoff. When a returned probability clears your internal threshold, the message proceeds through automated handling paths like ticket assignment or database tagging. If the highest probability falls below your operational bar, route the payload into an exception queue for human triage.
Laya is not built for organizations that require open-ended creative drafting, document summarization, or out-of-the-box reasoning without dataset preparation. Teams with those needs should deploy general-purpose frontier models such as Claude or GPT-4o rather than training a small decision classifier. If Convai Innovations releases future base weights achieving zero-shot accuracy above 0.80, or if frontier model token pricing drops below local hosting expenses, our recommendation regarding mandatory fine-tuning would change.
To begin implementing this workflow, test your typical text payloads in the hosted demo sandbox before running pip install laya to establish how to use laya in your deployment pipeline.
- Test states and typed questions in the Hugging Face Spaces demo before local script configuration.
- Establish an error-tolerant confidence threshold to separate automated actions from manual review queues.
- Direct low-confidence payloads to human operators to maintain process integrity.
- Monitor probability distributions continuously to detect classification drift on new input types.
Frequently Asked Questions
- Install Laya by executing
pip install layaorpip install laya>=0.3.3in a standard Python terminal. This downloads the package directly from the Python Package Index (PyPI) along with required runtime dependencies. - Laya runs in a standard Python environment capable of executing Python Package Index packages. You do not need dedicated hardware or specialized drivers for initial script testing, though local production execution benefits from sufficient system memory to preload checkpoints.
- Out of the box, base Laya checkpoints achieve zero-shot accuracy of approximately 0.35. For production classification tasks, you should fine-tune the model on domain-specific examples using Convai Innovations' Kaggle notebook.
- Fine-tuning Laya takes approximately 4 hours using the hosted Kaggle notebook provided by Convai Innovations. The training process runs on standard cloud compute instances without requiring local server setup.
- Laya supports categorical choice questions, numeric score evaluations, and open-ended noul questions. Categorical choice questions evaluate discrete labels, score questions rate severity or sentiment, and noul questions evaluate condition presence.
- Yes, you can test Laya without installing local code by opening the hosted Hugging Face Spaces demo. The interactive browser interface allows you to input custom states, declare questions, and evaluate output distributions directly.
- Load the base
convaiinnovations/layacheckpoint from Hugging Face for standard English routing jobs. It provides fast inference on Central Processing Unit hardware and handles common text classification workflows. - Set an operational confidence threshold based on your team's tolerance for classification errors rather than relying on an arbitrary cutoff. Route high-confidence predictions into automated workflows, and send transactions with narrow probability spreads to human reviewers.
Ready to automate routing with Laya?
Layer3Labs evaluates your decision logic, prepares custom fine-tuning datasets, and builds production pipelines around lightweight routers. Book a consultation to review your automation stack.
Book a Free Audit