Skip to content

Repository files navigation

Jev-LCT: Open-Source System-One Decision Engine

Free Calibrated Confidence from Recurrent Computation Trajectories for Small Decision Models

English | 简体中文

GitHub Hugging Face PyTorch License Tests Passing Hardware Verified Latency

"Decisions, Not Strings" meets "Free Calibrated Confidence"
An open-source, ultra-low-latency System-One decision model family that extracts well-calibrated confidence directly from internal recurrent dynamics without reinforcement learning or token overhead.


📖 1. Overview

In autonomous agents, security routing, fraud detection, and edge robotics, traditional Large Language Models rely on autoregressive text generation (token-by-token), leading to severe latency bottlenecks (hundreds of milliseconds to seconds) and fragile output parsing. Furthermore, small models that "verbally introspect" their confidence suffer from systematic miscalibration (extreme overconfidence or random guesswork).

Aligned with the Jev ("Decisions, not strings") paradigm pioneered by TypeSafe AI, Jev-LCT (Looped Calibration Transformer) advances System-One decision models to a new state of the art:

  • 🔄 Parallel Looped Prefill: Recurrently computes only the top $k=2$ layers of a causal transformer backbone, coupled with sequence right-shifting and Scale-Preserving RMS Injection to maintain 100% representation fidelity.
  • 📈 Endogenous Trajectory Confidence: Extracts authentic calibrated probabilities directly from hidden state convergence dynamics ($\Delta\cos$), decision entropy reduction ($\Delta H$), and softmax margin trajectories—free of RL overhead and extra generation tokens.
  • ⚡ Adaptive Dual-Channel Early Exit: Margin gating ($m_1 \ge 0.90$) allows 85%+ of simple queries to terminate on loop 1 in ~45ms, while ambiguous problems dynamically iterate up to 4 loops before reaching fixed-point convergence ($\Delta_t < 0.30$).
  • 🌐 Full TypeSafe AI Jev Compatibility: Drop-in support for Jev's POST /v1/systemone specification (choice, noul, score) with high-performance FastAPI server and typed Python SDK.

🏆 2. Hugging Face Model Zoo

All weights are available as self-contained standalone full models or lightweight modular adapters on Hugging Face:

Model Repository Parameter Scale Target Deployment Scenario Latency (RTX 3090 Ti) Model Size Hugging Face Hub
Jev-LCT-Qwen2.5-0.5B 0.49B Ultra-low memory edge devices, Raspberry Pi, high-QPS API gateways 50.8 ms ~1.9 GB 🤗 Model Card
Jev-LCT-Qwen2.5-1.5B
(🌟 Recommended Flagship Balance)
1.54B Golden balance: General generative reasoning at discriminative speed 61.9 ms ~3.0 GB 🤗 Model Card
Jev-LCT-Qwen3-8B 7.61B Enterprise agent core, high-risk security audit & selective prediction 89.2 ms ~15.8 GB 🤗 Model Card
Jev-LCT-Adapters Modular Adapters Plug-and-play .pt looped layer weights for base Qwen models - ~2.0 GB 🤗 Adapter Hub

💡 One-Line CLI Weight Downloader:

python scripts/download_weights.py --scale 1.5b  # Download 1.5B golden balanced model
python scripts/download_weights.py --adapters    # Download lightweight modular adapters

📊 3. Rigorous 300-Item Benchmark (NVIDIA RTX 3090 Ti Verified)

Tested on local NVIDIA RTX 3090 Ti (24GB VRAM) across 300 rigorous evaluation items spanning financial intent (Banking77), scientific reasoning (AI2 ARC), factual verification (TruthfulQA), reading comprehension (BoolQ), and multi-task academic reasoning (MMLU):

Model Architecture Parameters Intent (Banking77) Science (ARC) Factuality (TQA) Reading (BoolQ) Academic (MMLU) Overall Accuracy Avg Latency Avg Loops
Convai Laya Base (ModernBERT) 421M 95.0% 28.3% 23.3% 76.7% 33.3% 51.3% 49.3 ms 1.00 (Single-Pass)
Convai Laya Typed (ModernBERT) 421M 95.0% 30.0% 18.3% 81.7% 31.7% 51.3% 52.9 ms 1.00 (Single-Pass)
Open-Jev (DeBERTa-v3) 435M 100.0% 45.0% 25.0% 91.7% 35.0% 59.3% 59.7 ms 1.00 (Single-Pass)
Qwen-0.5B Single-Pass 0.49B 91.7% 43.3% 18.3% 55.0% 51.7% 52.0% 41.6 ms 1.00 (Single-Pass)
Qwen-0.5B Adaptive LCT 0.49B 91.7% 40.0% 13.3% 53.3% 50.0% 49.7% 50.8 ms 1.36 loops
Qwen-1.5B Single-Pass 1.54B 93.3% 71.7% 53.3% 71.7% 61.7% 70.3% 61.6 ms 1.00 (Single-Pass)
🌟 Jev-LCT-Qwen2.5-1.5B 1.54B 93.3% 71.7% 55.0% 73.3% 58.3% 70.3% 61.9 ms 1.23 loops
Qwen3-8B Single-Pass 7.61B 95.0% 85.0% 76.7% 85.0% 71.7% 82.7% 88.5 ms 1.00 (Single-Pass)
Jev-LCT-Qwen3-8B 7.61B 95.0% 85.0% 75.0% 83.3% 70.0% 81.7% 89.2 ms 1.09 loops

Key Findings:

  1. Generative Reasoning Without Generative Latency: Jev-LCT-1.5B achieves 71.7% on ARC, surpassing Convai Laya (30.0%) by +41.7% and Open-Jev (45.0%) by +26.7% at practically identical latency (~62ms).
  2. Superior Self-Error Detection: Post-hoc calibrated softmax margins achieve AUROC of 0.9043 (In-Distribution) and 0.9524 (Out-of-Distribution).
  3. Calibrated Probabilities: Expected Calibration Error (ECE-15) is reduced from 0.1646 down to 0.1259 (a 23.5% relative improvement).

Jev-LCT vs Laya & Open-Jev Benchmark Comparison


🎮 4. Interactive Showcase: Real-Time Snake Benchmark (snake/)

Following the community benchmark sorrycc/typesafe-snake, this repository features an autonomous Snake game decision environment:

  • Automatically extracts symbolic game invariants per tick (candidate directions, Manhattan food distances, FloodFill connected spaces, DeadEnd traps, and tail-chase escape paths);
  • The Jev-LCT model makes real-time direction decisions (up / down / left / right) with calibrated confidence under strict SLA deadlines;
  • Features a standalone HTML5 Canvas web dashboard and an interactive ASCII terminal UI!

Jev-LCT Scaling & Calibration Plots

Launch the Interactive Game:

# 1. Launch server and auto-open browser canvas UI:
python snake/server.py --browser

# 2. Or run interactive ASCII terminal dashboard:
python snake/ui_terminal.py

⚡ 5. Quickstart & Deployment

5.1 Installation

git clone https://github.com/gitchw/LCT.git
cd LCT
pip install -r requirements.txt

5.2 Run Verification Test Suite (52/52 Passing)

python run_tests.py
# Ran 52 tests in 230.6s -> OK (52/52 Passing)

5.3 Standalone Zero-Dependency Inference (3 Lines of Code)

from lct_qwen_standalone import LCTQwen

# 1. Load standalone model directly from Hugging Face
engine = LCTQwen.from_pretrained("CaoHaoWei/Jev-LCT-Qwen2.5-1.5B", device="cuda")

# 2. Predict multiple-choice decision
res = engine.predict_choice(
    prompt="Patient reports severe chest pain radiating to left shoulder. Determine triage urgency level:",
    choices=["emergency", "urgent", "routine", "elective"]
)

print(f"Decision: {res['choice']}")
print(f"Calibrated Confidence: {res['confidence']:.2%}")
print(f"Loops Executed: {res['loops']}")

5.4 Production Jev System-One REST API Server

# Start FastAPI service on port 8000
python lct_infer.py serve --model 1.5b --port 8000
# Execute standard Jev System-One request
curl -X POST http://127.0.0.1:8000/v1/systemone \
  -H "Content-Type: application/json" \
  -d '{
    "state": "The customer requests an immediate freeze on credit card ending in 4081.",
    "questions": {
      "target_team": {
        "type": "choice",
        "instructions": "Determine routing queue:",
        "criteria": {
          "fraud_ops": "Urgent risk & fraud intervention",
          "billing": "Standard billing inquiries",
          "general": "General customer service"
        }
      }
    }
  }'

🔬 6. Adaptive Early Exit State Machine

flowchart TD
    Input[Input Query / State Context] --> Loop1[Loop 1: Initial Forward Pass t=1]
    Loop1 --> CalcMargin[Calculate Softmax Margin: m_1 = p_1 - p_2]
    
    CalcMargin --> Gate1{m_1 >= 0.90 ?\nHigh Confidence?}
    Gate1 -- Yes (85%+ simple queries) --> ExitFast([★ Exit Immediately: Loop=1\nSingle-pass latency, zero drift])
    Gate1 -- No (Complex / Ambiguous) --> LoopDeep[Recurrent Refinement: t = t + 1]
    
    LoopDeep --> CalcCos[Compute Residual Contraction\nΔ_t = 1 - CosSim]
    CalcCos --> Gate2{Δ_t < 0.30 ?\nFixed-Point Attractor?}
    Gate2 -- Yes (Sufficiently Converged) --> ExitStable([★ Early Exit: Loop=t\nDynamics stabilized & calibrated])
    
    Gate2 -- No (Active Representation Drift) --> Gate3{t >= Max_Loops (4)?\nCompute Budget Limit?}
    Gate3 -- No --> LoopDeep
    Gate3 -- Yes --> ExitForce([★ Forced Exit: Loop=4\nStrict SLA Guarantee])
Loading

📜 7. License & Citation

Distributed under the Apache License 2.0.

@article{cao2026lct,
  title={Looped Calibration Transformer: Free Calibrated Confidence from Recurrent Computation Trajectories for Small Decision Models},
  author={Cao, Haowei},
  year={2026},
  publisher={GitHub},
  journal={GitHub repository},
  howpublished={\url{https://github.com/gitchw/LCT}}
}

About

Jev-LCT: Open System-One Decision Engine with Free Calibrated Confidence from Recurrent Trajectories

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages