Real-time world-model inference runtime (Phase 176.8.1.1), Rust, zero external dependencies.
rust/crates/wm-serving-kernel:
WorldModelRuntime— batched, action-conditioned autoregressive token generation. One decode state (KV cache + token history) per concurrent world session;generate_frameadvances every session under its own action.KvCache— a growing key/value cache withtruncatefor speculative rollback.- Speculative decoding (
speculative.rs) — the Leviathan et al. acceptance rule (acceptmin(1, p/q), resample the normalised residual on rejection, bonus token on full acceptance) for a future-frame preview from a cheap draft model; preserves the target distribution exactly. FrameScheduler— paces generation to a target FPS: achievable-FPS and meets-target checks plus a virtual-clock pacer (the 24 FPS / 720p target from the task is ameets_targetquery given tokens-per-frame and per-token cost).LogitModel— the trained-weights boundary;ReferenceWorldModelis a deterministic peaked model that makes the runtime end-to-end runnable and testable without accelerator weights.
The WebRTC egress and the actual H100-resident weights are deployment boundaries; this crate is the CPU-testable serving kernel (generation loop, cache, speculation, pacing).
text
cd libs/nous/wm-serving/rust && cargo test && cargo clippy --all-targets