Skip to content

Build definitive MLX porting standard#12

Open
Amal-David wants to merge 20 commits into
mainfrom
codex/unify-mlx-porting-skill
Open

Build definitive MLX porting standard#12
Amal-David wants to merge 20 commits into
mainfrom
codex/unify-mlx-porting-skill

Conversation

@Amal-David

@Amal-David Amal-David commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

This PR ships two releases:

v0.4.0 — architecture-aware, evidence-gated MLX porting standard (original scope): rebuilds the app as an evidence-gated advisory standard, retires the public Worker for a deterministic static site, expands routing to 17 golden architecture families, centralizes numeric-claim authority in generated artifacts, and hardens every intake/benchmark/research/network/installer/CI surface.

v0.5.0 — the execution toolchain (added after a full multi-agent review + efficacy audit of v0.4.0): closes the "guides but never builds" gap and turns the skill into a working porting tool for dense-decoder transformers, proven by a real port.

v0.5.0 highlights

  • Execution tool chain (6 new tools): capture_oracle.py (PyTorch source-tensor capture), scaffold_port.py (generates a runnable MLX package: config parser, RoPE incl. scaling, GQA attention + KV cache, gated MLP, greedy generate, capture hooks), convert_checkpoint.py (safetensors→MLX via explicit WEIGHT_MAP schema 2 with rename/transpose/split/merge/cast, fail-closed), capture_mlx.py, run_parity.py (one-command parity ladder that stops at the first failing rung), shared _capture_common.py.
  • First real end-to-end port, checked in as a worked example: Qwen2.5-0.5B-Instruct on an Apple M4 Pro, fully offline — 290-tensor explicit weight map, 29-rung parity ladder pass, and exact greedy-token agreement between the torch oracle, the scaffolded MLX port, and offline mlx_lm (examples/worked-port-qwen2.5-0.5b-instruct/, no weights checked in). Two tool bugs found and fixed on real bytes.
  • Promotion lane legitimately unsealed: new content-attested benchmark runner (validator-owned runner bytes digest-pinned under -I -B, parent-owned per-run random challenges, dependency-byte attestation from actually-loaded modules, independent validator re-derivation; five tamper scenarios fail closed). Result: 13 receipts = 11 observations / 1 promotion-ready / 1 rejected, and the first promoted claim — bf16-weight-cast at 1.0x–1.8122x, fingerprint-scoped. The other 9 claims remain withheld.
  • Knowledge layer wired in: the advisor surfaces knowledge-graph edges (697 nodes / 499 edges) as clearly-labeled unreviewed research signals (no numeric imports, fail-closed schema validation); research_backlog.json is deterministically reconciled and drift-gated; every asset now has a consumer (contract-enforced); orphan collect_top_models.py removed.
  • Review-driven hardening (from the multi-agent review of this PR): DNS-rebind/SSRF pinning for all public HTTPS fetches, assessment-ratio tamper-proofing, evidence-index Markdown-injection sanitization, crash-recoverable --force install, a retirement IOC guard that matches real workers.dev hosts, CI job timeouts, and site/knowledge-graph drift-guard tests.

Honest proof boundary (v0.5.0)

  • Dense-decoder transformers: tooled end to end, proven by one real port of one model. The other 16 families keep executable intake/routing/planning/validation with runbook-guided module implementation.
  • Exact-output parity is still the only controlled quality gate; domain-specific audio/vision/diffusion/streaming/long-context evaluation remains future work.
  • One promoted claim, narrowly fingerprint-scoped to the attested Qwen2.5 experiment; no generic speedup claims.
  • The attestation trust chain and its residual assumptions (interpreter, OS, Metal driver, native libraries) are documented in VALIDATION.md, not hidden.

Verification

  • 423/423 tests pass (up from 357), including real-Metal execution tests, five attestation tamper tests, and the dual-framework parity keystone test.
  • All offline release gates pass: strict audit, source validation (350 sources), benchmark validation (0 integrity errors), claim catalog / evidence index / site data drift checks, node syntax, manifest attestation, git hygiene.
  • 17/17 golden scenarios and the public-claims linter pass.
  • Every task was implemented by a codex worker and independently re-verified on Apple Silicon before commit.

Supersedes #11.

🤖 Generated with Claude Code

Codex and others added 13 commits July 10, 2026 16:10
Close the DNS-rebind TOCTOU in validate_sources.py by resolving once,
vetting every address, and pinning vetted sockaddrs into the actual
connection while TLS verification stays on the original hostname.
Shared transport applied to contributor/top-model collectors; env
proxies disabled in the pinned opener; redirects re-vet and re-pin.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
generate_claim_catalog.py no longer trusts recomputed_median_ratios
from receipt_assessments.json: the field is structurally validated and,
when receipts are available, recomputed from the re-hashed receipt
payloads and compared exactly; mismatch fails closed. Adds a tamper
regression test (inflated ratio, intact fingerprint). Promotion stays
sealed: 10 observations / 0 promotion-ready / 1 rejected, 9 withheld.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
generate_evidence_index.py now enforces https link schemes, percent-
encodes link-destination breakout characters without double-encoding,
and escapes raw HTML in table cells. Hostile-fixture regression tests
added; regenerated EVIDENCE_INDEX.md is byte-identical for the current
clean sources.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
install_skill.py now uses a deterministic .<name>.backup directory for
the force-replace swap and recovers at startup: restores the backup when
the target is missing, finishes cleanup when the replacement already
landed, and warns about legacy random-suffix backups without touching
them. Adds four interrupted-state regression tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
test_worker_retirement.py now catches real workers.dev hosts and any
mlx-model-advisor*.pages.dev reference while allowing the current site
host, and scans the whole repo with an explicit ignore-list instead of
a hardcoded surfaces allowlist. daily-research.yml jobs get
timeout-minutes and lose a dead variable. New contract tests pin
site/data.js summary counts to live asset counts and verify
knowledge-graph node/edge counts and edge endpoints.
profile_eligible_range was left intact: it is consumed by
recommend_optimizations.py, contrary to the review finding.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
First execution tool: captures token ids, embeddings, per-layer hidden
states, attention/MLP intermediates where hookable, final norm, logits,
and greedy continuations from a local PyTorch/HF checkpoint into a
bounded .npz plus a deterministic digest manifest. torch/transformers
stay optional lazy imports (fail closed with install guidance);
trust_remote_code is impossible; output paths reject symlink
components. Stable tensor-key scheme documented for the MLX-side
mirror. 10 new contract tests (7 dependency-free, 3 torch-gated).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Generates a user-owned MLX implementation package (config parser,
RMSNorm/RoPE incl. linear+dynamic-NTK scaling, GQA/MHA attention with
KV cache, gated MLP, greedy generate CLI, oracle-mirroring capture
mode) from a trusted inspection for the dense-decoder family via an
explicit per-family registry. Computation-relevant config outside the
feature allowlist fails closed with runbook guidance; generator is
dependency-free; parameter names mirror HF conventions for the weight
converter. Tests: 6 dependency-free contracts + real MLX tiny-model
forward/generate/cache-consistency execution.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
safetensors-to-MLX conversion driven entirely by an explicit
WEIGHT_MAP.json (schema 2: rename/transpose/permute/reshape/slice/
split/merge/cast with keep|f16|bf16|f32 dtype policies; legacy maps
still accepted). Bounded pure-python safetensors header validation is
always on; hostile headers, partial shards, unmapped or missing
tensors, post-transform shape mismatches, and draft maps fail closed.
Emits a validate_weight_map-compatible target manifest and a strict
JSON conversion report; draft-map mode pairs only exact names. Tests:
10 dependency-free + 2 real mlx.core.load round-trips.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
capture_mlx.py mirrors the oracle tensor-key scheme from a scaffolded
package + converted weights (package drift detection, --allow-modified,
lazy mlx). run_parity.py orchestrates capture_oracle -> capture_mlx ->
compare_tensors through bounded subprocesses and emits a strict-JSON
parity ladder that stops at the first failing rung with a debug
target. Shared capture/manifest logic factored into _capture_common.py;
scaffold_port.py now emits scaffold-manifest.json. Keystone E2E test
builds a tiny stock Llama in both frameworks, drives the real chain,
passes clean parity, and catches a seeded transposed q_proj at
layer.0.hidden (test init strengthened to std=0.20 attention
projections after real-hardware verification exposed uniform-softmax
insensitivity at default init).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Full chain on real bytes, fully offline from the local HF cache:
inspect -> plan -> oracle capture -> scaffold -> explicit 290-entry
WEIGHT_MAP -> convert (f32 parity artifact + bf16 variant) -> weight-map
validation -> 29-rung parity ladder -> exact greedy-token match across
torch oracle, scaffolded MLX port, and offline mlx_lm 0.31.1
(' The sky is blue because it reflects sunlight').

Two real tool bugs fixed: inert sliding-window metadata now allowed
only with use_sliding_window=false, and Q/K/V/O attention biases
inferred independently from tensor coverage (Qwen2 has QKV bias, no O
bias). Parity used a documented model-specific tolerance for
bf16-arithmetic source vs f32-arithmetic target; defaults and exact
token gate unchanged. Schema-2 receipt pair checked in and honestly
classified: 13 receipts = 12 observations / 0 promotion-ready / 1
rejected, execution_attested=false. Worked example (no weights,
portable paths) under examples/worked-port-qwen2.5-0.5b-instruct/.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
New attested benchmark lane: a repository-owned runner
(assets/benchmarks/runners/attested_mlx_port.py) whose bytes are
digest-pinned at argv position 1 under -I -B isolation, parent-owned
per-invocation random challenges binding label/phase/run/argv/quality
bytes, dependency attestation from actually-loaded module bytes, and
independent validator re-derivation of every digest. Five tamper
scenarios fail closed with specific gate tokens; unattested lanes stay
sealed. Real M4 Pro re-run of the Qwen2.5-0.5B pair yields the first
legitimate promotion: bf16-weight-cast promoted at 1.0x-1.8122x,
fingerprint-scoped, quality window and residual trust assumptions
documented in VALIDATION.md. 13 receipts = 11 observations /
1 promotion-ready / 1 rejected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
recommend_optimizations.py now surfaces the knowledge graph as a
clearly-labeled unreviewed-research-signals section (bounded 2MiB
reads, schema fail-closed without blocking canonical advice, no
numeric imports, execution_allowed=false). contributor-refresh.json
feeds knowledge_curator source selection as review-only nodes.
Orphan collect_top_models.py and its write-only snapshot removed.
research_backlog.json is now deterministically reconciled from graph +
update candidates with --reconcile-backlog/--check-backlog drift
gates; graph grew to 697 nodes / 499 edges from checked-in candidates.
New asset-consumer contract test prevents future write-only drift.
Promoted claim machinery untouched (10 claims, 1 promoted).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Every doc surface reconciled with reality: dense-decoder transformers
are tooled end to end and proven by one real Qwen2.5-0.5B port; the
other 16 families keep executable intake/routing/planning/validation
with runbook-guided module implementation; domain evaluation beyond
exact-output parity remains future work. Counts updated everywhere
(29 scripts, 66 techniques, 423 tests, 13 receipts = 11/1/1, 10 claims
with 1 fingerprint-scoped promotion, graph 697/499). Public-claims
linter and 17/17 golden scenarios pass; no overclaims introduced.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Amal-David

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@greptileai review

…e lint

statistics.pstdev became correctly-rounded in CPython 3.12, so 3.10
recomputed committed assessment bytes 1 ulp differently and failed the
drift gate. All stored/diffed aggregates now use version-stable IEEE
helpers (stable_mean/stable_median/stable_pstdev via math.fsum) in
_common.py; zero statistics.* calls remain. Drift checks verified
byte-identical on Python 3.10, 3.12, and 3.14. New .gitattributes marks
byte-exact attestation evidence (-diff -merge) so the patch whitespace
gate no longer lints dependency snapshots; evidence bytes and the
promoted fingerprint are unchanged (13 receipts stay 11/1/1).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Amal-David

Copy link
Copy Markdown
Owner Author

@coderabbitai full review

@greptileai review

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 276 files, which is 126 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd78ef8d-df58-4e26-af1a-9738f7cd0771

📥 Commits

Reviewing files that changed from the base of the PR and between 7dbaaa5 and 282ed5a.

⛔ Files ignored due to path filters (30)
  • apps/model-advisor-worker/package-lock.json is excluded by !**/package-lock.json
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/18e18afcaccafade98daf13a54092927904649e1dd4eba8299ab717d5d94ff45.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/29ef203c13d9bebb6b8cad6aadb44d1ad495e2bbc19184ca5415b6a505eb36f6.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/311bb75620c546b7ad092f6864e45452a3d5a4fc8a698b3e691769484e2f0469.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/3a2364d8096a54c302c820e24beabb976d2b8b9502ca865337711307ed8a4d61.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/3bbfbecc997379696313844c6056ffaf7c88d59300dcb92adb47709eb2410e9e.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/4b0b2f3a82a33037efafd221d83c4add53ef7915b7fedaf04ed546d8c3f7ba75.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/623e1dd10d518a2461ef30229cf63ea36cb9b61b93ebb7f5371ec5b05f479aae.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/700eff903c2312233b464bb0f49f0d9d22241d93801a8c137b2e0119c150e822.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/7bdd4fd41047a617ec84f7eb214cde3aaa3c3e4c932550468bae1204d1df6550.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/8f61a6438d46b55ce5579edf247f9988bd98bd801a37e4ccdaf295f1c3aa5bc0.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/9050a138850c3d4e1f10057ea46425ae41ee80900a98524468742f3a44db91e5.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/90e8e529c1cc2e48d81caf697247b5f46912ab83446014087c7116075542b235.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/92cfbc9ba53d4b2d7681a9096881d8cce4c7f5aff06ce054efbd6d454cf8c14f.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/933c0376d99e23e3348569d9029809caeb66e96e14f89d80c120cb280e871f14.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/99bbc9e8f50ab6aa1942d8afde9ae4f5f36fd3af31c916f769b66108299676af.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/a129a2c913db5bb7004a76e189c1121d8957cac174934a4b4b671200199dd659.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/b325de6ce79d3cb39a0541aecd42a60296ad37f8dde5720c9a3775811151ce1b.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/ba01c5485dfe46d9819ecf016f844ef2ca2e721418e805fe0e4ddec852a5a8c3.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/c02ca21d6abf70d741db7a322e8cdde793b97604a926d0014223b22b011b5adf.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/c055c2e5658faa050c0814e2eaac1ad5d31212a199e659f729abe6e2c6c86fa9.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/d1a2088211cfe5b4cb9723da93243efdc0a2b94e5cf74f7d1af31cc6a42aaf1e.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/d1e740f70dc8a2dcce8f24f39c1c43db1824724312314919cb40109a81ec6fe8.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/e34b902aa24fe1971420b7ef33935f322c7cf24d6f16911d46171f770ee60bd0.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/e538cddf7479f1aad592a0058e9a1eb29120fbbb4c6e6507b54ed1fbad02fb45.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/e62a3b11aff60a72009bd7690502043cdfdcd493ff71a27f557a7f299ca74ec8.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/f16d40bace757e068a3afac593b5df900743ea69f71d42bd34efd352567981dd.bin is excluded by !**/*.bin
  • mlx-model-porting/assets/benchmarks/attestations/dependencies/f748ea4f10995bf30ed6ba76ed3539f23c18cdf541031e1c0968dd60dc98f723.bin is excluded by !**/*.bin
  • mlx-model-porting/requirements-tools.lock is excluded by !**/*.lock
  • site/favicon.svg is excluded by !**/*.svg
📒 Files selected for processing (276)
  • .gitattributes
  • .github/requirements-ci.txt
  • .github/workflows/daily-research.yml
  • .github/workflows/source-health.yml
  • .github/workflows/validate.yml
  • .gitignore
  • AGENTS.md
  • CHANGELOG.md
  • CLAUDE.md
  • CONTRIBUTING.md
  • EVIDENCE_INDEX.md
  • MANIFEST.json
  • README.md
  • RESEARCH_REPORT.md
  • VALIDATION.md
  • VERSION
  • adapters/README.md
  • adapters/antigravity.md
  • adapters/claude-code.md
  • adapters/codex.md
  • adapters/cursor.md
  • adapters/gemini-cli.md
  • adapters/github-copilot.md
  • adapters/windsurf.md
  • apps/model-advisor-worker/package.json
  • apps/model-advisor-worker/scripts/build-pages.mjs
  • apps/model-advisor-worker/scripts/build-skill-data.mjs
  • apps/model-advisor-worker/scripts/check-stack-fixture.mjs
  • apps/model-advisor-worker/scripts/smoke-local.mjs
  • apps/model-advisor-worker/src/index.ts
  • apps/model-advisor-worker/src/skill-data.generated.ts
  • apps/model-advisor-worker/tsconfig.json
  • apps/model-advisor-worker/wrangler.toml
  • mlx-model-porting/LICENSE
  • mlx-model-porting/SKILL.md
  • mlx-model-porting/assets/BENCHMARK_REPORT.md
  • mlx-model-porting/assets/architectures.yaml
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-001/challenge.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-001/evidence.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-001/output.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-001/quality-contract.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-002/challenge.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-002/evidence.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-002/output.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-002/quality-contract.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-003/challenge.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-003/evidence.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-003/output.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-003/quality-contract.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-004/challenge.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-004/evidence.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-004/output.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-004/quality-contract.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-005/challenge.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-005/evidence.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-005/output.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/measure-005/quality-contract.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/warmup-001/challenge.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/warmup-001/evidence.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/warmup-001/output.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-bf16/runs/warmup-001/quality-contract.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-001/challenge.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-001/evidence.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-001/output.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-001/quality-contract.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-002/challenge.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-002/evidence.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-002/output.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-002/quality-contract.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-003/challenge.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-003/evidence.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-003/output.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-003/quality-contract.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-004/challenge.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-004/evidence.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-004/output.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-004/quality-contract.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-005/challenge.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-005/evidence.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-005/output.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/measure-005/quality-contract.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/warmup-001/challenge.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/warmup-001/evidence.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/warmup-001/output.json
  • mlx-model-porting/assets/benchmarks/attestations/qwen2.5-0.5b-port-f32/runs/warmup-001/quality-contract.json
  • mlx-model-porting/assets/benchmarks/kv-4bit-8k.json
  • mlx-model-porting/assets/benchmarks/kv-baseline-8k.json
  • mlx-model-porting/assets/benchmarks/pcache-cold.json
  • mlx-model-porting/assets/benchmarks/pcache-warm.json
  • mlx-model-porting/assets/benchmarks/quality/inputs/3e06a9863647ac4b5f2b2e29137874c73acdeddb2820714b66a7141d783909d3.json
  • mlx-model-porting/assets/benchmarks/quality/inputs/86985309c16a0ea2eb840a50c700e1b3294a612383ceedf341b22e11ccd0f56a.json
  • mlx-model-porting/assets/benchmarks/quality/outputs/qwen2.5-0.5b-port-bf16/result.json
  • mlx-model-porting/assets/benchmarks/quality/outputs/qwen2.5-0.5b-port-f32/result.json
  • mlx-model-porting/assets/benchmarks/quality/qwen2.5-0.5b-port-bf16.bound.json
  • mlx-model-porting/assets/benchmarks/quality/qwen2.5-0.5b-port-f32.bound.json
  • mlx-model-porting/assets/benchmarks/quant-4bit.json
  • mlx-model-porting/assets/benchmarks/quant-baseline-bf16.json
  • mlx-model-porting/assets/benchmarks/qwen2.5-0.5b-port-bf16.json
  • mlx-model-porting/assets/benchmarks/qwen2.5-0.5b-port-f32.json
  • mlx-model-porting/assets/benchmarks/qwen2.5-0.5b/expected.json
  • mlx-model-porting/assets/benchmarks/qwen2.5-0.5b/input.json
  • mlx-model-porting/assets/benchmarks/qwen2.5-0.5b/runner.py
  • mlx-model-porting/assets/benchmarks/raw/qwen2.5-0.5b-port-bf16/benchmark-command.json
  • mlx-model-porting/assets/benchmarks/raw/qwen2.5-0.5b-port-f32/benchmark-command.json
  • mlx-model-porting/assets/benchmarks/receipt_assessments.json
  • mlx-model-porting/assets/benchmarks/receipts_index.json
  • mlx-model-porting/assets/benchmarks/runners/attested_mlx_port.py
  • mlx-model-porting/assets/benchmarks/spec-baseline.json
  • mlx-model-porting/assets/benchmarks/spec-draft-k2.json
  • mlx-model-porting/assets/benchmarks/spec-draft-k3.json
  • mlx-model-porting/assets/benchmarks/spec-draft-k4.json
  • mlx-model-porting/assets/benchmarks/stack-measured-together.json
  • mlx-model-porting/assets/contributor-refresh.json
  • mlx-model-porting/assets/effective_claims.json
  • mlx-model-porting/assets/knowledge_graph.json
  • mlx-model-porting/assets/model_outcomes.json
  • mlx-model-porting/assets/optimization_guidance.yaml
  • mlx-model-porting/assets/optimization_stacks.yaml
  • mlx-model-porting/assets/recommendation-taxonomy.yaml
  • mlx-model-porting/assets/research_backlog.json
  • mlx-model-porting/assets/sources.yaml
  • mlx-model-porting/assets/techniques.yaml
  • mlx-model-porting/assets/top_models_snapshot.json
  • mlx-model-porting/assets/update-candidates.json
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/PORT_PLAN.md
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/README.md
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/WEIGHT_MAP.json
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/benchmark-bf16.quality.json
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/benchmark-bf16.spec.json
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/benchmark-f32.quality.json
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/benchmark-f32.spec.json
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/benchmark-receipts.md
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/inspection.json
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/mlx_lm-cross-check.txt
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/parity-report.json
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/source-oracle.manifest.json
  • mlx-model-porting/examples/worked-port-qwen2.5-0.5b-instruct/target-f32.manifest.json
  • mlx-model-porting/references/benchmarking.md
  • mlx-model-porting/references/compound-stacks.md
  • mlx-model-porting/references/model-advisor-playbook.md
  • mlx-model-porting/references/parity-and-testing.md
  • mlx-model-porting/references/porting-core.md
  • mlx-model-porting/references/runbook-decoder-transformer.md
  • mlx-model-porting/requirements-tools.txt
  • mlx-model-porting/research-runs/2026-06-27-deep-research-loop/blogs/coverage-skeptic.md
  • mlx-model-porting/research-runs/2026-06-27-deep-research-loop/returned_findings.json
  • mlx-model-porting/research-runs/2026-06-27-deep-research-loop/synthesis.json
  • mlx-model-porting/research-runs/2026-06-27-live-multi-source-gap-run/blogs/coverage-skeptic.md
  • mlx-model-porting/research-runs/2026-06-27-live-multi-source-gap-run/normalized_findings.json
  • mlx-model-porting/research-runs/2026-06-27-live-multi-source-gap-run/synthesis.json
  • mlx-model-porting/research-runs/2026-06-27-top1000-contributor-loop/blogs/coverage-skeptic.md
  • mlx-model-porting/research-runs/2026-06-27-top1000-contributor-loop/returned_findings.json
  • mlx-model-porting/research-runs/2026-06-27-top1000-contributor-loop/synthesis.json
  • mlx-model-porting/research-runs/2026-07-07-nightly-knowledge-curator/research-loop/campaign.json
  • mlx-model-porting/research-runs/2026-07-07-nightly-knowledge-curator/research-loop/campaign.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/knowledge-delta.json
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/knowledge-delta.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/nightly-run.json
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/nightly-run.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/agents/coverage-skeptic.assignment.json
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/agents/coverage-skeptic.prompt.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/agents/huggingface-ecosystem-sampler.assignment.json
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/agents/huggingface-ecosystem-sampler.prompt.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/agents/official-docs-cartographer.assignment.json
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/agents/official-docs-cartographer.prompt.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/agents/package-registry-scout.assignment.json
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/agents/package-registry-scout.prompt.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/agents/paper-architecture-scout.assignment.json
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/agents/paper-architecture-scout.prompt.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/agents/practitioner-blog-miner.assignment.json
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/agents/practitioner-blog-miner.prompt.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/assignments.json
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/blogs/coverage-skeptic.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/blogs/huggingface-ecosystem-sampler.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/blogs/official-docs-cartographer.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/blogs/package-registry-scout.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/blogs/paper-architecture-scout.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/blogs/practitioner-blog-miner.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/campaign.json
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/campaign.md
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/subagents.json
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/synthesis.json
  • mlx-model-porting/research-runs/2026-07-08-nightly-knowledge-curator/research-loop/synthesis.md
  • mlx-model-porting/research-runs/2026-07-10-source-health-reconciliation/knowledge-delta.json
  • mlx-model-porting/research-runs/2026-07-10-source-health-reconciliation/knowledge-delta.md
  • mlx-model-porting/scripts/_capture_common.py
  • mlx-model-porting/scripts/_common.py
  • mlx-model-porting/scripts/_weight_map_common.py
  • mlx-model-porting/scripts/audit_skill.py
  • mlx-model-porting/scripts/benchmark_command.py
  • mlx-model-porting/scripts/benchmark_generation.py
  • mlx-model-porting/scripts/capture_mlx.py
  • mlx-model-porting/scripts/capture_oracle.py
  • mlx-model-porting/scripts/collect_contributors.py
  • mlx-model-porting/scripts/collect_top_models.py
  • mlx-model-porting/scripts/compare_tensors.py
  • mlx-model-porting/scripts/convert_checkpoint.py
  • mlx-model-porting/scripts/generate_claim_catalog.py
  • mlx-model-porting/scripts/generate_evidence_index.py
  • mlx-model-porting/scripts/generate_site_data.py
  • mlx-model-porting/scripts/inspect_mlx_project.py
  • mlx-model-porting/scripts/inspect_model.py
  • mlx-model-porting/scripts/install_skill.py
  • mlx-model-porting/scripts/knowledge_curator.py
  • mlx-model-porting/scripts/make_port_plan.py
  • mlx-model-porting/scripts/manifest.py
  • mlx-model-porting/scripts/nightly_knowledge_curator.py
  • mlx-model-porting/scripts/recommend_optimizations.py
  • mlx-model-porting/scripts/research_loop.py
  • mlx-model-porting/scripts/run_parity.py
  • mlx-model-porting/scripts/run_research_campaign.py
  • mlx-model-porting/scripts/scaffold_port.py
  • mlx-model-porting/scripts/update_sources.py
  • mlx-model-porting/scripts/validate_benchmarks.py
  • mlx-model-porting/scripts/validate_sources.py
  • mlx-model-porting/scripts/validate_weight_map.py
  • site/app.js
  • site/data.js
  • site/docs/index.html
  • site/index.html
  • site/styles.css
  • tasks/lessons.md
  • tests/fixtures/manifests/map.json
  • tests/fixtures/manifests/oracle.json
  • tests/fixtures/routing/ambiguous-synthetic-route.json
  • tests/fixtures/routing/conflicting-hybrid-identity.json
  • tests/fixtures/routing/falcon-h1-hybrid.json
  • tests/fixtures/routing/nemotron-h-dense-hybrid.json
  • tests/fixtures/routing/nemotron-h-hybrid.json
  • tests/fixtures/routing/qwen3-next-hybrid.json
  • tests/fixtures/routing/unknown-architecture.json
  • tests/fixtures/routing/weak-shared-config.json
  • tests/fixtures/routing/whisper-composition.json
  • tests/fixtures/scenarios/autoregressive-audio-lm.json
  • tests/fixtures/scenarios/streaming-speech.json
  • tests/fixtures/scenarios/vision-language-omni.json
  • tests/fixtures/scenarios/vocoder-waveform-decoder.json
  • tests/fixtures/stack_compose_case.json
  • tests/mlx_keystone.py
  • tests/test_asset_consumer_contract.py
  • tests/test_benchmark_evidence_contract.py
  • tests/test_capture_oracle_contract.py
  • tests/test_claim_catalog_contract.py
  • tests/test_compare_tensors_boundedness.py
  • tests/test_convert_checkpoint_contract.py
  • tests/test_distribution_portability.py
  • tests/test_documentation_contract.py
  • tests/test_evidence_index_contract.py
  • tests/test_hardening_benchmark_command_contract.py
  • tests/test_hardening_campaign_contract.py
  • tests/test_hardening_common_contract.py
  • tests/test_hardening_contract.py
  • tests/test_hardening_filesystem_contract.py
  • tests/test_hardening_network_process_contract.py
  • tests/test_hardening_nightly_curator_contract.py
  • tests/test_hardening_project_inspection_contract.py
  • tests/test_installer_manifest_contract.py
  • tests/test_manifest_contract.py
  • tests/test_mlx_keystone_guard.py
  • tests/test_model_intake_hardening.py
  • tests/test_model_intake_identity_contract.py
  • tests/test_parity_runner_contract.py
  • tests/test_promotion_validation_contract.py
  • tests/test_public_claims_contract.py
  • tests/test_recommendation_contract.py
  • tests/test_release_contract.py
  • tests/test_routing_contract.py
  • tests/test_scaffold_port_contract.py
  • tests/test_scenarios.py
  • tests/test_site_contract.py
  • tests/test_site_data_contract.py
  • tests/test_source_url_security.py
  • tests/test_tooling.py
  • tests/test_update_sources_contract.py
  • tests/test_worker_retirement.py
  • tests/test_workflow_contract.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/unify-mlx-porting-skill

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

@Amal-David I'll perform a full review of all changes in this PR.

✅ Action performed

Full review finished.

@Amal-David

Copy link
Copy Markdown
Owner Author

@greptileai review

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

Codex and others added 5 commits July 11, 2026 11:21
…city

An adversarial full-PR review found the execution-attestation gate was
author-forgeable: it verified unkeyed digests, structure, and nonce
uniqueness but had no external signer or challenge issuer, so a receipt
author could fabricate a coherent bundle (the old positive test did
exactly that) and get execution_attested=true without running MLX. A
sound gate needs an external trust root that cannot live in-repo.

Re-seal: a missing-external-attestation-signature blocker keeps
execution_attested false for every in-repo receipt. The bf16 Qwen2.5
receipt returns to performance_observation and all 10 effective claims
return to withheld (12 obs / 0 promoted / 1 rejected). The runner and
real receipts are kept as honest reproducibility evidence, not proof.
The fabricating positive test now asserts the gate stays sealed.

Docs corrected: no first-legitimate-promotion / content-signed /
independently-proved wording; the 1.8122x figure is framed as one
reproducible local observation, not a reliable speedup; VALIDATION.md
and benchmarking.md state the real trust boundary and name an external
signer as the prerequisite for any future attested promotion.
.gitattributes narrowed so only binary payloads are diff-opaque; the
validator rejects unreferenced attestation files.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two correctness bugs in the code scaffold_port.py generates. Dynamic-NTK
RoPE: cached keys were rotated under the pre-threshold base, so crossing
original_max_position_embeddings mixed bases; generated models now
reject KV-cache reuse past the threshold and recompute the full
sequence, guaranteeing one consistent base (speed tradeoff documented in
the generated README). Float16 padding: attention scores promote to
float32 before the finite -1e9 mask (no float16 -inf), and fully-masked
query rows are explicitly zeroed with where() so 0*NaN cannot propagate;
capture_oracle (torch) and capture_mlx (mlx) mask consistently. New
tests fail against the old template and pass on real Metal; generator
identity 1.0.0 -> 1.0.1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…data

recover_interrupted_install ran on every non-force install and treated a
deterministic .<name>.backup sibling as installer-owned, deleting or
moving unrelated user data of that name. Force replacement now uses a
randomized backup plus an O_EXCL|O_NOFOLLOW recovery journal recording
the exact target/backup/stage paths and device/inode/type identities,
fsynced before the destructive rename. Recovery acts only when a journal
and its recorded identities match; unjournaled .backup* siblings are
warned about but never deleted, moved, or overwritten. Destination
directory is fsynced after every rename for power-loss durability.
Regression tests prove an unrelated legacy or random .backup survives a
normal install; verified independently with a real copy-install
round-trip.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ry bound

Three converter findings from the ultra review. (A) validate_weight_map
modulo-wrapped axes while convert rejected out-of-range, so some maps
validated then failed conversion; both now share one schema/shape
executor (_weight_map_common.py) with single normalized axis/negative/
default/slice semantics, so validation accepts exactly what conversion
accepts. (B) mapping and shard-index files were parsed then reopened for
their attested digest (TOCTOU); bytes are now read once and hashed from
the same captured bytes. (C) the 16GiB cap was per-tensor with no
aggregate bound; added configurable --max-working-set-bytes with
preflight aggregate/peak estimates and one-tensor-at-a-time streaming
output so a hostile sparse file fails closed before allocating.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Three remaining ultra-review findings. generate_evidence_index.py now
escapes Markdown link-label delimiters and neutralizes emphasis/code
delimiters (code fences chosen longer than any hostile backtick run), so
a title like x](attacker) cannot hijack a rendered link destination;
tests assert the parsed destination, not just escaped source.
validate_sources.py enforces one monotonic deadline across DNS,
redirects, connection, TLS, and reads and caps attempts to four pinned
addresses per host, closing the many-black-holed-address time
amplification while keeping DNS-rebind pinning. MLX_KEYSTONE_REQUIRED=1
turns missing-MLX skips of the parity and generated-model-math keystones
into failures; both Ubuntu jobs explicitly acknowledge the uncovered MLX
math and VALIDATION.md documents the required Apple-Silicon path, so the
coverage gap is loud, not hidden.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant