Skip to main content

Laya

Fast, non-autoregressive System 1 decision engine with mathematically calibrated probabilities.

PyPI version Hugging Face Model Hugging Face Space Buy Me A Coffee License

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.

Powered by the fine-tuned Laya model on Hugging Face.


Installation

pip install laya

Quickstart

import laya

# 1. Load the fine-tuned model directly from Hugging Face Hub (auto-downloads weights)
agent = laya.load("convaiinnovations/laya")

# 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(true) from 0.0 to 1.0 Phishing detection, spam filtering, jailbreak detection, churn risk

Live Demo & Resources


Support the Project

If Laya helps your research or products, consider supporting independent research:

Buy Me A Coffee


License

Apache 2.0. Developed by Convai Innovations.

Release files for laya 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for laya 0.1.3
File Size Uploaded
laya-0.1.3.tar.gz 17.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for laya 0.1.3
File Interpreter ABI Platform
laya-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size:32.7 kB

Release files / laya-0.1.3.tar.gz

Download URL laya-0.1.3.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
312aec3a8f56bea306ebca116aa21939db91a24e24056cdfbb18c03776abe5f5
BLAKE2b-256 checksum
How to use checksums
45deafcaa7d82623177d267b1b7f33abd76bbc11748fb5a4e56d641c090c607c
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.3-py3-none-any.whl

Download URL laya-0.1.3-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
614b0002c9c9fecd1d38f7f5ab9326f2b1c1140797258aeda71d5619fca08e4b
BLAKE2b-256 checksum
How to use checksums
0dbee819c74499874affd197687d44bb30d65038a76c142d74f3051cb6883bb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page