strot-ai/Project-STROT: STROT (arXiv:2505.01636): compile-time LLM code synthesis with deterministic, self-routing NLU runtimes. PyPI: strot-ai · GitHub


The open choice compiler

Compile your intent as soon as with an LLM. Then resolve on each file perpetually —
classification, scoring, routing — as type-safe JSON with chances and
confidence, by yourself {hardware}, at zero marginal price.


License
Tests
Python

Website · Docs · Benchmarks · PyPI

Agents at compile time.  Never at runtime.

import strot

consequence = strot.run(
    tickets,
    question="Triage incoming help tickets into the right workflow.",
    action_registry={
        "billing_dispute":  "Refunds, bill corrections, double fees",
        "technical_defect": "Crashes, bugs, damaged conduct",
    },
    llm="anthropic/claude-opus-4-8",   # used as soon as, on first compile solely
)

for o in consequence.outcomes:
    print(o["action"], spherical(o["confidence"], 2))
# billing_dispute 0.97
# technical_defect 0.94

The LLM runs as soon as, at compile time. Production is a frozen, self-contained
Python artifact: a small native choice mannequin arbitrates each file, nothing
is generated, each output is bounded, and low-confidence data abstain
as a substitute of guessing.

STROT = Agentic Schema Intent + Compiler & State + Code + Execution + NLU
                      ⟹  JSON Decisions
          (classification · scoring · routing · typed solutions)
            COMPILE  (as soon as per intent + schema)
  intent + pattern ─▶ synthesize ─▶ golden gate ─▶ instructor labels ─▶ calibrate
                     (labels,      (your identified      (annotate         (match the
                      projection,   solutions should     a pattern,         confidence
                      handlers)     move)            as soon as)             threshold)
                                        │
                                        ▼
                             frozen artifact  (.py)

            RUNTIME  (each file, perpetually)
  file ─▶ projection ─▶ choice mannequin ─▶ confidence gate ─▶ typed JSON
            (compiled)     (144M, CPU,        (resolve or         choice
                            ~60 ms)            abstain)

run() — route every file to an motion and execute the compiled handler.

resolve() — reply typed questions (alternative / rating / boolean) per file:

consequence = strot.resolve(data, questions={
    "is_bug_report":     {"sort": "boolean", "directions": "mentions crashes/errors?"},
    "customer_sentiment":{"sort": "rating", "min": 1, "max": 5, "directions": "1 indignant, 5 completely satisfied"},
    "routing_bucket":    {"sort": "alternative", "choices": ["billing", "engineering", "spam"]},
})
# → {"booleans": {...}, "scores": {...}, "selections": {...}}  with chances + confidence

Real mannequin (SupersonicLabs/Julia-1, 144M, CPU), actual datasets, clear Docker containers:

Result
Grounded routing accuracy (398 data) 92.5% compiled vs 74.8% naive — the compiler is price +18pp on the identical mannequin
Semantic textual content (AG News, unseen labels) 86.7% compiled vs 72.7% naive (+14pp)
Typed choices vs the main hosted choice API’s personal instance near-identical (sentiment 1.79 vs 1.8)
Latency / marginal price / LLM calls per file ~60 ms · $0 · 0

Reproduce all the pieces: benchmarks/ — with the losses printed too.

  • Compile as soon as, resolve perpetually — content-addressed artifact cache; schema drift triggers precisely one recompile.
  • Golden-record promotion — artifacts should move your identified solutions earlier than they serve.
  • Fitted ensures — temperature scaling + cut up conformal prediction, baked in: dispatched choices are incorrect ≤ α of all data (marginal); the remainder abstain.
  • Measured, not guessed — the compiler scores labelings, and may practice a distilled head, preserving solely what beats the baseline on held-out knowledge.
  • 0% structural hallucination — output is choice + computation over your registry; nothing is generated at runtime.
  • Model-independent — the choice mannequin is a slot (nlu=): native Julia-1 by default, hosted APIs, or any drop-in specialist.
pip set up strot-ai            # core: pure stdlib
pip set up strot-ai[local]     # + the native choice mannequin (torch/transformers)
pip set up strot-ai[hosted]    # + openai, for a hosted choice runtime
pip set up strot-ai[anthropic] # + anthropic, for the synthesizer

Bake the native mannequin into your picture for offline manufacturing:

RUN pip set up strot-ai[local] 
 && python -c "import strot; strot.prefetch_nlu(local_dir="/decide/julia-1", set up=True)"
ENV STROT_NLU_CHECKPOINT=/decide/julia-1

(Never pip set up julia — unrelated bundle.)

DEVELOPERS.md — structure, compile lifecycle, calibration
semantics and caveats, deployment, mannequin swapping, full API reference.

MIT. Default choice mannequin: Apache-2.0 (SupersonicLabs/Julia-1). Implements concepts from STROT (arXiv:2505.01636).



Source link