You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeSafe's Jev is a hosted decision API: great latency/accuracy, but closed weights,
per-token cost, and vendor lock-in. Laya proves an open, self-hostable equivalent exists
(Apache 2.0, fine-tuned checkpoint beats Jev's published typed-decisions score), but it is
Python-first and research-oriented: torch eager, FastAPI, broad surface area. Production
teams need a small, fast, strict, operable artifact.
2. Product
knot is a Rust implementation of the same decision-engine inference path, exposed as:
knot binary — Jev/Laya-compatible HTTP server (POST /v1/systemone, POST /v1/systemone/batch,
/health, /models) with auth, budgets, and concurrency controls.
Runtime trait: ONNX first, candle native later, own kernels after
License/cost
Apache-2.0, zero per-token cost, CPU baseline (x86_64 Linux + macOS arm64), GPU opt-in via ort CUDA EP (KNOT_DEVICE=cuda, x86_64 Linux)
Model development
Reproducible, optional training experiments that produce a canonical checkpoint for both configured inference runtimes
4. Non-goals (out of scope)
Deliberate exclusions — each exists in Laya's ecosystem but outside knot's
remit (a local, hosted-free HTTP/MCP decision server). Evidence for every
row is in RESEARCH-COMPARE.md ("Laya's experimental
layer vs knot scope").
Excluded
Why
Hooks framework + hook MCP tools
knot refuses them by name on the MCP surface; a fixed inference path keeps responses auditable
structured.decide API, presets
preset sugar over the single /v1/systemone contract; callers compose the same behaviour themselves
Eval harnesses (laya-evals regression gate, per-language research reports)
knot gates on parity fixtures plus its own evidence harness (latency bench + golden replay); accuracy evals stay in Laya's research tree
RLCD/online reward training, production calibration, broad hyperparameter sweeps, and model-quality claims from synthetic smoke data
keep stage one to a bounded, supervised CPU experiment; require licensed labels and separate held-out evaluation before release
CPU x86_64 Linux + Apple Silicon is the v1 baseline; ort CUDA EP is explicit opt-in behind KNOT_DEVICE=cuda (SPEC §10) — automatic selection and silent fallback stay out
Intel Macs (x86_64-apple-darwin); CUDA outside x86_64 Linux
ONNX Runtime ships no prebuilt binaries for Intel Macs and ort's CUDA distributions are x86_64-Linux-only (ort-sys dist matrix); Apple Silicon stays on the CPU path (SPEC §10)
ONNX export scripts, TensorRT capacity sweeps
checkpoints ship as ready-made ONNX; export belongs to Laya's toolchain and TRT rides on ONNX Runtime later
Softlist retrieval training
the shortlist feature hook ships; training its retriever does not
Not excluded — scheduled instead: batch_size/sort_by_length batch
controls (implemented, G3) and the evidence harness (latency bench + golden
replay), per the gap ranking at the end of RESEARCH-COMPARE.md.
5. Users
Platform teams self-hosting decision endpoints for agents/workflow automation
Teams migrating from hosted Jev who want a drop-in base URL change
Shortlist hook: embedding-based pre-filter before typed head
F12
MCP stdio server exposing predict/route/batch tools (v2 of serve crate)
7. Non-functional requirements
ID
Requirement
N1
x86_64 Linux + macOS arm64 (Apple Silicon) v1 with a CPU-only baseline (no GPU required; opt-in CUDA per SPEC §10, x86_64 Linux only); release build with thin LTO
N2
Bounded concurrency via semaphore; token-budget cap env
No network at inference time; models fetched explicitly with pinned revision + digest check
N5
Test gates: fixture parity vs Laya ONNXAgent, unit tests per prompt-budget rule, clippy/rustfmt clean
N6
Training tools are optional and isolated from the Rust inference dependency graph; no training-time downloads or Python dependencies are required to build or serve KNOT
8. Success metrics (measurable, tracked in docs rounds)
Decision agreement vs Laya ONNXAgent ≥ 99% on frozen fixtures (fp32)
p50 single-question latency ≤ Laya ONNXAgent CPU on same hardware
Zero silent truncation: every dropped-state call returns state_tokens_dropped
100% of F1–F9 covered by automated tests before v0.2
9. Risks
Risk
Mitigation
Numerical drift ONNX vs torch
Parity fixture gate per checkpoint; block release on regression
Head token budget edge cases (option collision)
Port Laya's #538 guard + tests
Tokenizer thread-safety
Single shared tokenizer behind lock, token cache like Laya