Skip to main content

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


License

Apache 2.0. Developed by Convai Innovations.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

laya-0.1.1.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

laya-0.1.1-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file laya-0.1.1.tar.gz.

File metadata

  • Download URL: laya-0.1.1.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for laya-0.1.1.tar.gz
Algorithm Hash digest
SHA256 05edb4b18b3f9b0b924311e342e54f8075c3ce79d934e8872915b69b3f5de9d7
MD5 89252940a06813faf6a309491c19fcd8
BLAKE2b-256 bcfd50f2e28f17c4595e66c7848e1c41adf62825d161128982d1a98b3d89ad66

See more details on using hashes here.

File details

Details for the file laya-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: laya-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for laya-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 84599282c5115d2968970988002db7cadfaf79d348a79bf3cf7b6fd537b97ca0
MD5 f715732213360d4ef6d6fdee4ebbe8ca
BLAKE2b-256 f264b438cf1887008ba9d05a7276cd1c39773a7402ea408256f4705f93b4e689

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

This release

0.1.1 This release

2 files

0.1.0

2 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