Laya (लय)
Fast, non-autoregressive System 1 decision engine with mathematically calibrated probabilities.
Laya lets you evaluate typed questions (choice, score, noul) over any state (text, email, ticket, or JSON document) in a single forward pass (~33–38 ms on GPU). It produces structured decision outputs and calibrated confidence scores without text generation, token streaming, or hallucinations.
Compatible with RL Agent models on Hugging Face.
Installation
pip install laya
Quickstart
import laya
# 1. Load the model from Hugging Face Hub (auto-downloads weights)
agent = laya.load("convaiinnovations/rl-agent")
# 2. Provide any state (string or dictionary)
state = {
"from": "user@acme.com",
"subject": "Duplicate charge on invoice #4411",
"body": "Hi, we were billed twice for March. Please refund the duplicate today or we will cancel our plan."
}
# 3. Define your typed questions
questions = {
# choice: categorical selection with probabilities & confidence
"department": {
"type": "choice",
"instructions": "Which department should handle this email?",
"criteria": {
"billing": "invoices, payments, refunds",
"technical": "bugs, outages, system errors",
"sales": "pricing, new contracts",
"other": "everything else"
}
},
# score: placement on an ordinal rubric
"urgency": {
"type": "score",
"instructions": "How urgent is this request?",
"criteria": ["not urgent", "soon", "critical deadline or blocking issue"]
},
# noul: calibrated boolean probability P(true)
"churn_risk": {
"type": "noul",
"instructions": "Does the user threaten to cancel or leave?"
},
"is_phishing": {
"type": "noul",
"instructions": "Is this email a phishing or scam attempt?"
}
}
# 4. Run all questions in ONE single forward pass (~35 ms on GPU)
result = agent.predict(state, questions)
answers = result["answers"]
print("Department :", answers["department"]["choice"])
# -> billing (confidence: 0.94)
print("Urgency :", answers["urgency"]["score"])
# -> 1.84 / 2.0
print("Churn Risk :", answers["churn_risk"]["noul"])
# -> 0.892 (89.2% probability)
print("Phishing :", answers["is_phishing"]["noul"])
# -> 0.008 (0.8% probability)
Automated Confidence Gating
Because Laya's probabilities are trained with strictly proper scoring rules (RLCD), confidence scores are statistically meaningful:
dept = answers["department"]["choice"]
conf = answers["department"]["confidence"]
if conf >= 0.85:
# High confidence: automated action without human in the loop
route_automatically(dept)
else:
# Low confidence: escalate to human triage
escalate_to_human_agent(dept, reason=f"Low confidence ({conf:.2f})")
Decision Primitives
| Primitive | Output | Use Cases |
|---|---|---|
choice |
Top label, probabilities per option, confidence | Department routing, intent classification, topic categorization |
score |
Expected level on ordinal rubric, distribution, confidence | Frustration level, ticket urgency, harm severity |
noul |
Calibrated probability $P(\text{true}) \in [0.0, 1.0]$ | Phishing detection, spam filtering, jailbreak detection, churn risk |
Live Demo & Resources
- Hugging Face Model: convaiinnovations/rl-agent
- Interactive Web Demo: convaiinnovations/rl-agent-demo
License
Apache 2.0. Developed by Convai Innovations.
Release files for laya 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| laya-0.1.0.tar.gz | 11.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| laya-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:21.7 kB
Release files / laya-0.1.0.tar.gz
| Download URL | laya-0.1.0.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
897964f15a7b084a036942ce05423b0dd96de5d07a8ac159382e2195ad3a8eee
|
|
BLAKE2b-256 checksum How to use checksums |
a4afbb6f1ac910f712526bfa3850c4908816611fad7313625620df699b943225
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / laya-0.1.0-py3-none-any.whl
| Download URL | laya-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4bcb57338559caea973c5afcc8f5f6c39417f56890f0910b56cd152c65970605
|
|
BLAKE2b-256 checksum How to use checksums |
99022d0fcd8181767dfbcbbb474192906c7967b5cc428622c9eb5fca1f7ff08c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|