Skip to content

feat(compute): MVP-A inference execution contract (mbongo-infer:v1, kaayu-cv-extract:v1) - #151

Merged
gkalombo21 merged 2 commits into
devfrom
feat/mvp-a-inference-contract
Oct 17, 2026
Merged

gkalombo21 merged 2 commits into
devfrom
feat/mvp-a-inference-contract

Conversation

@gkalombo21

Copy link
Copy Markdown
Collaborator

MVP-A — AI Inference Execution Contract (mbongo-infer:v1)

First implementation gate on the frozen MVP v0.1 path (docs/product/MVP_v0.1.md §11, #148). Baseline 38445ef278894ec31ac30b12660c6afe5d738f62. Tracks #150.

What it freezes. Exactly what a ComputeTask means when it asks for the MVP inference, without touching the v0.4 protocol:

  • execution_spec = "mbongo-infer:v1" (15 bytes) ‖ job_spec_digest (32 bytes) — fixed 47 bytes inside the 1,024-byte RFC 0005 bound; family prefix, then version, then length are checked in that order.
  • job_spec_digest = BLAKE3("mbongo:infer-job-spec:v1" ‖ canonical job spec); constrained canonical JSON (sorted keys, no whitespace, integers only, defined escapes; no floats, booleans or nulls) shared by job spec, input object and result.
  • InferenceJobSpecV1: runtime llama.cpp / llama-server v0.7.0 @ 620d2225 (MIT, verified at that commit); model Qwen3-4B-Instruct-2507 GGUF Q4_K_M, artifact_sha256 = 3605803b…e597 from the Hugging Face LFS metadata of unsloth/Qwen3-4B-Instruct-2507-GGUF @ a06e946b (Apache-2.0), to be recomputed from the downloaded bytes in MVP-B set-up — not fabricated, not downloaded here; the digest is authoritative, names are not; the GGUF embeds the tokenizer and chat template, so no separate tokenizer id.
  • Profile kaayu-cv-extract:v1: input {"contract":"kaayu-cv-extract-input:v1","cv_text":…} ≤ 10,000 bytes; prompt = template file verbatim as the system message + CV text as the user message (template SHA-256 pinned in the job spec); output kaayu-cv-profile:v1 JSON Schema (identity-free: no name or contact field exists; additionalProperties:false, enums, bounds; only keywords llama.cpp's grammar converter supports), schema SHA-256 pinned; generation temperature 0 / top_p 1.0 / seed 42 / max_tokens 400 with frozen ranges.
  • Result rule: raw output → strict parse → schema validation → canonical bytes → persisted → output_commitment. Whitespace and key order never change a commitment.
  • Worker gate preflight (8 ordered steps, fail-closed, no execution/result/receipt on any failure) and finish; 17 application error codes; retry keeps the job spec immutable by construction; model/runtime drift fails closed at start-up and per task.

Evidence. Named group inference_contract: 25 tests (A01–A24 + negative controls: digest-blind, version-blind, model-digest-blind each accept what the strict gate refuses), golden vector byte-exact (A20) and the committed job-spec.json identical to the canonical bytes; wire shapes of ComputeTask and Receipt asserted unchanged (A18, A19). Full validation in the PR thread. 62 protected paths (RFC 0005, RFC 0002, RECEIPT_SPEC, lock v0.4, rpc_v0.3, consensus, SDK wire/source, reference worker core, conformance, J, K, SNP adapter, protocol vectors, MVP_v0.1.md) byte-identical to the baseline.

Not in this PR. No llama.cpp execution, HTTP front, CLI, GPU, pricing, metering, MBO, SDK change (helpers deferred to MVP-C, which must reproduce the golden vector).

Refs #150, #148, #144, #52.

🤖 Generated with Claude Code

…aayu-cv-extract:v1)

Freezes what a ComputeTask means when it asks for the MVP inference, as an
off-chain convention on the opaque execution_spec of RFC 0005 (§2.10,
§2.12): a fixed 47-byte layout "mbongo-infer:v1" || BLAKE3 job-spec digest
(domain mbongo:infer-job-spec:v1), a constrained canonical JSON with every
rule local and tested, InferenceJobSpecV1 (exact field set, identity rules,
generation and limit bounds), and the frozen kaayu-cv-extract:v1 profile:
llama.cpp llama-server v0.7.0 @ 620d2225 (MIT), Qwen3-4B-Instruct-2507 GGUF
Q4_K_M pinned by SHA-256 (Apache-2.0, unsloth repository revision a06e946b),
a verbatim system-prompt template and an identity-free output JSON Schema
both pinned by digest, temperature 0 / top_p 1.0 / seed 42 / max 400 tokens,
10,000-byte input and 8,000-byte output limits.

The worker gate is executable: preflight (parse spec, resolve and re-hash
the job spec, validate it, runtime tag and commit, model digest, input
commitment, input contract) and finish (JSON, schema, canonical bytes,
output_commitment). Seventeen error codes, none consensus. Golden vector
and negative vectors in test-vectors/inference/; the committed job-spec
document in docs/product/inference/kaayu-cv-extract-v1/; test group
inference_contract (A01–A24 + three negative controls) with CI step
"Mbongo MVP Inference Contract"; .gitattributes keeps the digest-pinned
artifacts byte-stable on every checkout.

No model runs here. No ComputeTask, receipt, RPC or SDK wire change; the
reference worker, conformance suite, J, K and the SNP adapter are untouched.

Refs #150, #148

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@gkalombo21 gkalombo21 added this to the MVP v0.1 milestone Oct 17, 2026
@gkalombo21

Copy link
Copy Markdown
Collaborator Author

Validation at source 122bce1b28e50910df17f0fce38fc8a49281f134 (local, Windows; CI binds the same SHA)

Check Result
cargo fmt --all -- --check clean
cargo clippy --workspace --all-targets --all-features -- -D warnings clean (exit 0)
cargo test --workspace all suites ok, 0 failed (ignored: 2 baseline + the SEV-SNP live test)
Mbongo MVP Inference Contract (inference_contract) 25 passed / 0 failed / 0 ignored — A01–A24 + negative controls (digest-blind, version-blind, model-digest-blind caught)
Mbongo Compute Provider Policy 41/41
Mbongo Compute Conformance PASS 38/38
Mbongo Compute Confidential Authorization CONFIDENTIAL AUTHORIZATION: PASS (6/6 test group)
Mbongo Compute Hardware Attestation 18 passed / 1 ignored (live test, never counted as pass)
reference harness REFERENCE COMPUTE FLOW: PASS
replay harness DETERMINISTIC REPLAY: PASS
SDK 153 tests, 153 pass, 0 fail (no SDK source touched)
docs 79 relative links and anchors resolve across the contract document, INDEX, vectors README and the scope document; 67 section citations; typos (CI's checker, 1.49.0) clean on every touched path; git diff --check clean; 0 CR bytes in any touched file; ci.yml parses (js-yaml)
golden vector job_spec_digest = be9ae960…fe0e; execution_spec = 6d626f6e676f2d696e6665723a7631 ‖ digest (47 bytes); committed job-spec.json is byte-identical to the canonical bytes (A20)
protected surfaces 62 paths (RFC 0005, RFC 0002, RECEIPT_SPEC, PROTOCOL_LOCK_v0.4, rpc_v0.3, consensus and node sources, SDK wire and sources, reference worker core, conformance, J, K, SNP adapter, protocol vectors, SNP fixtures, MVP_v0.1.md) resolve to the same blob ids at 38445ef2 and at this source: expected 62, found 62, identical

Change surface: .gitattributes (+2), ci.yml (+6, one named step), lib.rs (+1 module line), docs/INDEX.md (+1 row), and new files only — the inference module (5 files), the test group, the contract document, three profile artifacts, six vector files. Nothing deleted, nothing else modified.

The devnet image copies only Cargo manifests and crates/ (Dockerfile,
.dockerignore), so include_str! of files under docs/ failed the Docker
Devnet Bootstrap job. The prompt template, output schema and committed
job-spec document move to crates/mbongo-compute/profiles/kaayu-cv-extract-v1/
unchanged (same bytes, same digests, golden vector unchanged); every
reference follows.

Refs #150

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@gkalombo21

Copy link
Copy Markdown
Collaborator Author

Addendum — source 6ec31ab310c6708c68c5dec674d7a1f7eb9a21e1

The first source (122bce1b) failed Docker Devnet Bootstrap only: the devnet image copies Cargo.* and crates/ alone, so include_str! of files under docs/ could not resolve inside the image (every other job and the new named step passed: Rust Checks green, inference_contract 25/25). The three profile artifacts moved to crates/mbongo-compute/profiles/kaayu-cv-extract-v1/ with identical blob ids (fb185b39 job-spec.json, 0ae00839 output-schema.json, e279df66 prompt-template.txt), so the digests and the golden vector are unchanged; every reference follows. Local validation re-run at this source: fmt clean, workspace clippy -D warnings clean, workspace tests 0 failed, inference_contract 25/25, provider policy 41/41, hardware attestation 18/0/1 ignored, conformance 38/38, confidential authorization PASS, reference and replay harnesses PASS, SDK 153/153; 62 protected blobs identical to 38445ef2. Diff against the baseline: 20 files, +3861 / −0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants