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.2.tar.gz (16.1 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.2-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: laya-0.1.2.tar.gz
  • Upload date:
  • Size: 16.1 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.2.tar.gz
Algorithm Hash digest
SHA256 41666e09c03dccaf26232d1948fe112eb9aa0365abecc9785b468c8dfdf62f05
MD5 06ef4a5c7020fc845a88f58b8fb36e24
BLAKE2b-256 c597c89481cbd28cbcbc3c461243a1ebdf1b06924b4b1502981792b63d91ab9d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: laya-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9756d98a2cce9e40a58a2d26bfd1a1d3308ce8903565b34007af438b88653f94
MD5 04d9f4dfec87dd61f9bc56517f5e576a
BLAKE2b-256 ed140eff35dabd1b0be9d42c8385b69016c324570defe268f8769361284dd828

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

This release

0.1.2 This release

2 files

0.1.1

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