# ProvableWorldModel — Usage Guide ProvableWorldModel lets anyone verify, on a CPU with no floating point, that a committed quantized [LeWorldModel](https://github.com/lucas-maes/le-wm) (action-conditioned JEPA world model) was run exactly as specified: rolling out candidate action plans, scoring them against a goal, and picking the best. It Freivalds-checks the large matmuls and exactly re-executes everything else, all bound by Merkle commitments and a Fiat-Shamir transcript. The `pwm-tui` demo proves the pretrained checkpoint end to end on your machine. ## Quickstart ```bash git clone https://github.com/AbdelStark/ProvableWorldModel cd ProvableWorldModel # the flagship demo: download, quantize, prove, verify, and tamper-check the # pretrained checkpoint, live in your terminal (needs uv; cached after run one) cargo run -p pwm-tui --release ``` Or the same pipeline through Docker, no local toolchain needed: ```bash docker compose up --build ``` Default pipeline: `checkpoint -> quantize -> commit -> encode -> infer -> prove -> verify`. Stages: LOAD -> INFER -> COMMIT -> VERIFY -> TAMPER (one forged matmul is rejected with `FreivaldsCheckFailed`). Exit code 0 means the honest proof was ACCEPTED and the forged one REJECTED. ## Running without Docker ```bash cargo run -p pwm-tui --release # REAL checkpoint, full TUI demo cargo run -p pwm-tui --release -- --offline # warm cache: no network at all cargo run -p pwm-tui --release -- --headless --json # CI mode: plain log + JSON summary cargo run -p pwm-tui --release -- cache ls # see what is cached (path|ls|clear) cargo run -p pwm-testkit --bin pwm --release -- prove-predictor # real architecture, synthetic weights cargo run -p pwm-testkit --bin pwm --release # the tiny compact story cargo test --workspace # the accept and reject suites ``` ## Docker profiles | Command | What it runs | |---|---| | `docker compose up --build` | Real le-wm predictor architecture (192-dim, 16 heads, 6 blocks), synthetic weights, exact integer arithmetic. Fast, offline. | | `docker compose --profile real up --build export predictor-real` (or `./demo/run-real.sh`) | The REAL `quentinll/lewm-pusht` checkpoint end to end: download, quantize the full V0, then prove + verify the real-weight predictor. Heavy: PyTorch image + ~70 MB checkpoint on first run. | | `docker compose --profile compact up --build prover verifier` | Tiny two-party teaching handoff: a `prover` container writes a proof to a shared volume (`pwm prove /shared/artifact.bin`), a `verifier` container accepts it, forges a matmul, and rejects it (`pwm audit /shared/artifact.bin`). | ## Cache (pwm-tui) Assets (checkpoint, dataset, bundle) land under a configurable cache. A warm bundle cache skips Python entirely, so repeat runs are pure Rust and take about a second. The only stage-1 dependency is [`uv`](https://docs.astral.sh/uv/) (it provisions Python and the pinned torch environment from `uv.lock` on first run). Cache precedence: `--cache-dir ` > `PWM_CACHE_DIR` env var > the platform default (e.g. `~/Library/Caches/ProvableWorldModel` on macOS). ## What gets proven | Tier | Claim | Status | |---|---|---| | **P0** | One predictor step: `z_next = PredProj(ARPredictor(z_hist, ActEnc(actions)))`. | implemented and tested (full 192-dim 6-block 16-head predictor, real checkpoint weights) | | **P1** | Autoregressive rollout with checked recurrence wiring. | implemented and tested | | **P2** | Fixed-candidate planning (V0): roll out all `S` candidates, score by goal MSE, prove the selected is the argmin. | implemented and tested | | P3 | Full CEM planner. | deferred | | P4 | Pixel to plan, including the ViT encoder. | deferred | Trust boundary: the export bundle is cryptographically bound into the proof (weights Merkle root); checkpoint download, input encoding, and float-to-int8 quantization are trusted offline preprocessing. The verifier is `no_std` and float-free: it never re-runs the model, Freivalds-checks every fixed matmul (soundness error `<= 1/p`, `p = 2^61 - 1`), exactly recomputes attention, softmax, GELU, SiLU, LayerNorm, and residuals, and range-checks accumulators against a mod-`p` forgery. ## Further docs - [demo.md](demo.md) — demo modes and the real-checkpoint walkthrough. - [cli.md](cli.md) — the `pwm` CLI and `pwm-tui` flags. - [export.md](export.md) — exporting a checkpoint bundle (input/output formats). ## License Apache-2.0.