Repository navigation
perf: accelerate GPT-OSS prefill and decode with measured controls - #840
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29ed40493e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a8058d9a2c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Speed up fresh GPT-OSS 20B prefill and decode with pinned, tested library changes, and make the benchmark report the actual shared decode interval at B=2/B=4. Add a reviewable implementation plan, portable measured evidence, paired ABBA controls, raw timing/output accounting, full-geometry warmups and load/runtime memory observations.
The integration enables final-position prefill output, exact constant conversion reuse, compatible expert fusion with bounded load materialization, and the measured M4 Max MXFP4 decode tail. Prefix reuse and MTP are excluded from all benchmarks. Optional candidates and rejected experiments are distinguished in the report; the recovered diagnostic tracer is not shipped.
flowchart LR subgraph Before A[Fresh GPT-OSS request] --> B[Full prompt vocabulary projections] B --> C[First token] C --> D[Split expert projections and repeated constant casts] D --> E[Decode output] F[ThroughputSweep] --> G[Whole-row aggregate mixes prefill stalls] end subgraph After H[Fresh GPT-OSS request] --> I[cbv2Prefill final-position output] I --> J[First token sooner] J --> K[Fused experts + constant reuse + guarded MXFP4 kernel] K --> L[Decode output] M[ThroughputSweepDecodeTiming] --> N[Raw token timestamps and common-overlap aggregate] N --> O[ABBA controls and portable evidence] endValidation: final pinned release suite passed 70 Swift Testing cases and 8 XCTest cases, plus 25 Python tooling tests. Separate real-checkpoint tests cover 42 arms and exact generated continuations/KV receipts. Matching source metallib was rebuilt. See
docs/reports/2026-09-05-gptoss20b-optimization-results.mdfor paired final measurements, numeric tolerances, load peak and workstation variance. Documentation lint passes. Large raw traces and executable/model banks remain local; portable summaries and hashes are committed.All dependency commits are pushed to the Layr-Labs forks. This is a development/PR deliverable; no production deployment, release, merge, or remote-machine benchmark was performed.
The schema-7 harness submits rows deterministically. Both corrected 8K B=2/B=4 controls preserve generated sequences; long-context timing remains variable, including unfavorable cycles. Short-context screening found roughly 12–14% lower prefill latency and 6–13% more aggregate decode throughput depending on B. Historical schema-6 B>1 screenings do not satisfy the new mandatory submission-order gate; the report preserves those measurements with that limitation. The 32K B=1 smoke matched 129 baseline tokens; 8K B=8 completed 513 tokens per row at 15.70 GiB peak MLX memory.
Dependency PRs: MLX core #14, MLX C #7, MLX-Swift #20, and MLX-Swift-LM #139. All four dependency PRs are merged. Core, C bridge, Swift and LM pins reference merged main revisions, including MLX-Swift-LM d4335f02d9c466a9d02e4bd576354b6b10ac7674, whose source tree matches the tested feature branch.
Implementation and measured results.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Review corrections make benchmark acceptance match the evidence contract: Gemma accepts current sweep schema 7; GPT-OSS B>1 performance comparisons require ordered schema-7 submissions; matrix provenance pins iterations, output-token budget and KV backend; binary/metallib/config/receipt/model contents are rechecked before and after each cell, including supplied artifact symlink resolution. Legacy scaling groups also require compatible workload settings. Failed decode warmups abort before measurements. Empty or failed trace reductions remove only their six owned CSV outputs.
flowchart LR subgraph Before A1[Warmup row failure] --> B1[measureDecode continues to timed samples] A2[Changed artifact or mixed workload] --> B2[Runner may accept incomparable rates] A3[Empty trace reduction] --> B3[Old CSV tables remain] end subgraph After C1[Warmup row failure] --> D1[warmDecodeShapes throws before measurements] C2[Each matrix cell] --> D2[Artifact and workload checks plus ordered batched validation] D2 --> E2[Accept compatible data or reject cell] C3[Trace write_results] --> D3[Clear owned tables then write current results] endReview-fix validation: release integration passed 61 Swift Testing tests and 10 XCTest cases; profiling tooling passed 33 tests; Gemma wrapper passed 65 tests; docs lint passed for 132 files.