Skip to content

Circle STARK classifier proofs

The classifier workflow: train, export, compile and enroll once; then build the witness, prove with STWO, verify in a fresh process and bind the result, nine times.

The separate A100 classifier GPU benchmark passes 54 proofs under the unchanged stock verifier. Median nine-proof command sums are 92.41 s CPU / 22.22 s CUDA across three pairs. The optional CUDA candidate does not change the stock Mac default or historical CPU comparisons.

The classifier backend produces real, serialized STWO proofs for the existing literal rule, four-hidden-unit integer MLP and contextual byte CNN. A fresh verifier process checks each proof using enrollment and public inputs retained by the caller. It does not receive the witness, model checkpoint or native execution trace.

The acceptance record contains nine passing proofs: all three classifiers on each of the three frozen requests. The verdicts match native execution. All 63 direct public-input mutations, 18 cross-request substitutions and three invalid rosters reject. A second acceptance run confirms those counts. Full-length conformance adds three passing proofs and rejects 21 invalid witnesses in real STWO constraints; an omitted dense edge rejects at program-pin admission. These are exploratory acceptance results. Circle is the only classifier backend under decision 0090; this does not change its unqualified research status.

Run the acceptance workflow

Use an Apple Silicon Mac, CPython 3.12.12, uv 0.9.18 and Rust's nightly-2025-07-14 toolchain. The workflow trains the frozen models and exports their integer graphs. Allow a 30-GiB sampled worker-memory stop, up to 4 GiB of proof outputs, and at least 12 GiB free plus build caches. The proof driver stops below 8 GiB free. Run:

make e2e

To reuse only the exact hash-pinned quantizations from a caller-owned run:

make e2e CLASSIFIER_RUN=runs/e2e-circle-<your-run>

The target builds the locked prover and a verifier without the prover feature, pins both binaries, enrolls all three fixed circuits, constructs the three caller requests, generates nine new proofs, and runs fresh verification and rejection checks. It prints a new evidence directory. Success requires status: passed, fresh_proofs: 9, fresh_proof_only_verifications: 9, 63 direct rejections, 18 cross-request rejections and three invalid-roster rejections. A block verdict can be a successful proof result. No paid compute is launched.

The directory retains protocol/source/binary hashes, caller enrollment and its pin written before proving, request/bundle files, worker logs, proof files, resource samples and result.json. Failures retain failure.json and their partial outputs. Inspect the named worker's stderr.txt first; do not replace a failed directory or adopt an enrollment hash supplied only by a prover.

The recorded Make reproduction executes an earlier entrypoint, builds both locked targets and passes all nine proofs and rejection checks. Its driver takes 97.81 s excluding compilation.

Check constraint failures

After make e2e, retain its native-preparation-pin.json and proofs/caller-pin.json hashes while the run is under your control. Keep the binaries it built; the conformance command checks their hashes against that run's protocol before using them. Replace the paths and both saved pins:

uv run --locked --python 3.12.12 --extra train python scripts/check_circle_classifiers.py \
  --classifier-run runs/e2e-circle-<your-run> \
  --expected-preparation <your-saved-native-preparation-sha256> \
  --circle-run runs/e2e-circle-<your-run>/proofs \
  --expected-circle-enrollment <your-saved-circle-enrollment-sha256> \
  --prover research/probes/circle/target/release/circle-prove \
  --verifier research/probes/circle/target/release/circle-verify \
  --output runs/circle-conformance-<new-run>

Success requires three new maximum-length proofs and fresh verifications, 21 invalid witnesses rejected by STWO's constraint check, and one omitted dense edge rejected against the enrolled program. Ten input boundaries include empty, 96/97-byte and multibyte UTF-8 cases; each admitted case checks all three graphs against native arithmetic. The output directory must be new. Failures retain their logs and partial outputs; parser rejection cannot substitute for the required invalid-witness constraint failures. These are conformance checks.

Separate arithmetic fixtures exercise scores one below, equal to and one above both frozen thresholds. Equality blocks; changed public threshold limbs and verdicts fail the gate equations. These fixtures test the arithmetic boundary, not whether the trained models can attain each score.

What the proof establishes

What one classifier proof states: a witness of prompt bytes, salt and intermediate values; four constrained steps; a public statement of 100 fields.

Each circuit covers the complete input up to 96 UTF-8 bytes. Oversized inputs reject. No floating-point inference, truncated prefix, alternative hash or native replay is substituted for a proof.

Part Constrained computation
Input 96 bounded byte slots, prefix mask, exact count and zero padding
Commitment Canonical CBOR integer/array encoding; exact salted SHA-256 hallmark/v1/input preimage; correct variable-length SHA padding
Rule Literal BAD at every possible position, including across four-byte chunk boundaries; exact chunk count and verdict
MLP All 256 byte counts; four exact affine accumulators; signed ties-to-even rescaling; ReLU; output affine/rescaling; strict threshold zero
CNN Byte embedding; masks; all 96 width-24 causal windows and 32 channels; signed rescaling; ReLU; masked maximum; head; strict threshold −3733

The CNN computes inactive positions too, then excludes them from pooling. Signed 32-bit head accumulators use two 16-bit limbs and constrained carries. A field equality alone would allow integer aliases modulo M31. Narrow signed values use bounded decompositions; SHA's 32-bit words use bounded limbs. Equality with either classifier threshold blocks.

The logical public statement has 100 fields: context, classifier and input digests, unit/chunk counts, biased signed threshold and verdict. Its M31 transport splits the 32-bit threshold into two 16-bit limbs and adds public zero/one wires. It does not reduce 32-bit transport values modulo M31.

MLP decision limitation

The frozen seed-17 MLP always returns allow in the admitted 96-byte domain. Its quantization is unchanged. An independent interval relaxation over all nonnegative byte-count vectors with sum at most 96 gives hidden ReLU ranges [0,1], [0,14], [221,320], [0,14], output accumulator [−22399,−9351], and ties-to-even score [−5600,−2338]. The score remains strictly below threshold 0. This includes all valid UTF-8 inputs, not only the benchmark examples.

The numeric certificate pins the quantization, canonical model, analysis source and native program. The checker reproduces it using exact rational rounding; four tests include exhaustive small-domain cases. It is a conservative bound, not a tight optimization result, test-set evaluation or cryptographic proof. Do not fabricate an MLP block case or retune the frozen threshold. The combined workflow has actual allow/block controls through the rule and CNN. Follow-up #131 keeps new model training separate from this backend work.

The STARK still constrains every MLP operation and its input commitment. A constant decision over this domain does not imply constant intermediate values or establish classifier quality.

What the caller checks

The caller admits the frozen exports, creates the expected request, enrolls the compiled program and preprocessing root before proving, and retains their hash outside the proof bundle. It reconstructs the native public statement and requires exactly one proof for each enrolled classifier. The current caller still reruns native inference; its cost belongs in the complete-workflow timing.

Context construction, policy identities, classifier identities, salt derivation, UTF-8 admission and complete roster checks are host checks. They are not a proof that a transcript was authentically captured.

flowchart TD
    A[Caller: frozen model, profiles and request] --> B[Compile fixed arithmetic circuit]
    B --> C[Enroll program hash, wiring, constants, fanout and STWO root]
    C --> D[Retain enrollment hash outside proof bundle]
    A --> E[Native statement and bounded witness construction]
    D --> E
    E --> F[STWO prover: commitments, wire LogUp, OODS and FRI]
    F --> G[Serialized proof]
    A --> H[Caller reconstructs expected public inputs and complete roster]
    D --> H
    H --> I[Fresh verifier: enrollment, public inputs and proof only]
    G --> I
    I --> J[Integrity result and separate policy verdict]

Code and dependency ownership

This backend depends directly on STWO 2.2.0, pinned in its own Cargo lockfile, with nightly-2025-07-14. It does not invoke SASH's Llama CLI or modify the existing LLM backend. The LLM continues to use the separately pinned SASH/Nitroo fork. Their APIs, roots and proof encodings differ.

Owner Files and responsibility
Upstream STWO Circle FFT, polynomial commitments, Blake2s Merkle/transcript, OODS, FRI and constraint framework; locked registry dependencies
Hallmark Rust adapter Gate AIR and verifier, prover, separate CLI binaries
Hallmark circuit compiler Boolean/SHA circuit, signed arithmetic, classifier graphs
Hallmark caller Enrollment and bundle binding, acceptance workflow

The gate AIR/LogUp code adapts the upstream PLONK example's API patterns. NOTICE and the Apache-2.0 licence are retained. The caller fixes wiring, constants and producer fanout in preprocessing; they are not prover-chosen witness multiplicities. An explicit product column and unbatched wire lookups keep all constraints quadratic. Every wire reference is checked against the enrolled producer through LogUp. This executes a fixed circuit; there is no instruction set or general-purpose VM.

How the gate proof binds the graph

Every fixed gate row carries three wire values a, b, c and a product column t. Its enrolled selectors enforce:

t = a * b
q_m * t + q_a * a + q_b * b + q_k = q_out * c
(active - write) * c = 0

Arithmetic rows write c; assertion rows require their expression and output to be zero. Private-input rows deliberately leave c free until the classifier, SHA and range constraints consume it. Padding rows require zero wire values. The product column keeps the selector equation quadratic; multiplying a varying selector directly by a*b would make it cubic.

A gate equation alone cannot require two rows to use the same value for a shared wire. The fixed preprocessing therefore also commits each wire ID and its exact consumer count. After the base trace is committed, transcript challenges define a tuple combiner L(id, value). Three unbatched LogUp columns enforce the balance:

sum_rows(active / L(id_a,a) + active / L(id_b,b) - fanout_c / L(id_c,c))
    = sum_public(public_multiplicity / L(public_id, caller_value))

The verifier computes the right-hand side from caller values and the enrolled multiplicities. It accepts no free prover-chosen boundary sum. The independently enrolled preprocessing root binds wiring, constants, selectors and fanout before proving. This checks a fixed arithmetic graph; there is no instruction set, program counter or general-purpose VM execution trace. The concrete parameters and unqualified security boundary are below.

Parameters and limits

The fixed profile uses M31, QM31 lookup challenges, Blake2s commitments/transcript, 80 FRI queries, blowup factor 16, folding step one, final-layer log degree five and 16 proof-of-work bits. Tree domains share log_rows + 4; quadratic constraint evaluation uses log_rows + 1.

These are concrete parameters, not a claim of a production security level. Statistical lookup error depends on the extension field and relation size; FRI, Fiat–Shamir and hash assumptions also apply. The prover/verifier share STWO and the same AIR implementation. Fresh-process verification is not an independent implementation or audit.

There is no witness blinding, hardware attestation or production qualification. The tests establish arithmetic and integration behavior, not classifier safety quality. The original synthetic data, model exports, thresholds and historical timings are unchanged.

Timing scope

The stateless Circle CLI reconstructs twiddles and preprocessing commitments for every new proof; its raw preprocessing_and_model_commitment stage records that repeated cost. Fixed weights share the graph/preprocessing commitment; a separate weight-commitment time is null with an explicit reason, rather than zero. The parameter profile fixes the cases, threads and concrete parameters.

See decision 0083 and the engine review for the frozen baseline, budgets, provenance and rejected implementation paths.

LLM request composition

make e2e-composed prepares native classifiers and joins three new Circle proofs to freshly checked SASH proofs. See the run guide.

flowchart TD
  A[Caller-frozen prompt, response, model, nonce and Circle policy] --> B[Three new Circle classifier proofs]
  C[Retained SASH TinyLlama proof bundle] --> D[Fresh native verification: 23 proofs and 22 links]
  A --> E[Host checks text, model and complete classifier roster]
  B --> F[Fresh Circle proof-only verification against caller inputs]
  D --> E
  F --> E
  E --> G[Integrity result plus separate all-pass policy verdict]

The host join is not recursive aggregation. The retained LLM proof is replayable and does not bind the caller's new nonce; the classifier context does. This is a fresh verification of an existing inference proof, not fresh LLM proving. The synthetic CNN may block the ordinary question even when every proof is valid. Proof integrity is separate from classifier usefulness or policy release.