Skip to content

chore: remove PR14 research artifacts - #15

Closed
TheTom wants to merge 1 commit into
ekryski:ek/tom-eric-moe-tuningfrom
TheTom:cleanup/pr14-research-artifacts
Closed

TheTom wants to merge 1 commit into
ekryski:ek/tom-eric-moe-tuningfrom
TheTom:cleanup/pr14-research-artifacts

Conversation

@TheTom

@TheTom TheTom commented Apr 10, 2026

Copy link
Copy Markdown

Summary

  • Deleted ~280 timestamped benchmark result files across 15 model-specific subdirectories
  • Deleted ~40 research/architecture notes from benchmarks/notes/
  • Deleted benchmarks/scripts/int8_matmul_microbench.py (microbench script)
  • Deleted Tests/MLXLMTests/CompileTests.swift (tested compiled QKV projections — disabled)
  • Deleted Tests/MLXLMTests/FusedQGEMVTests.swift (tested fused QGEMV kernel — disabled)

What was kept

  • All .swift source files in Libraries/ (the actual perf fixes)
  • benchmarks/README.md — documents how to use the benchmark tool
  • scripts/benchmark.sh, scripts/build-metallib.sh, scripts/setup-dev.sh — useful tooling
  • Tests/Benchmarks/ — the benchmark runner code and resources
  • Tests/MLXLMTests/TurboQuantTests.swift — active test file
  • All other test files, Package.swift, READMEs, .github/, .gitignore, skills/

Test plan

  • Verify swift build still succeeds
  • Verify swift test still passes (no references to deleted test files)
  • Confirm benchmark runner still works with scripts/benchmark.sh

🤖 Generated with Claude Code

Delete ~280 timestamped benchmark result files, ~40 research/architecture
notes, and test files for disabled infrastructure (compiled QKV, fused QGEMV).

Keeps the benchmark runner, its resources, README, and all scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: tturney@psyguard.ai
@ekryski

ekryski commented Apr 11, 2026

Copy link
Copy Markdown
Owner

Leaving open for now. We'll do a clean up pass in a bit (today/tomorrow). Wouldn't mind even trying to prune from commit history so they're not bloating it.

@ekryski

ekryski commented Apr 16, 2026

Copy link
Copy Markdown
Owner

Closing. As we've now moved clean commits to the alpha branch. We'll likely remove the ek/tom-eric-moe-tuning branch entirely shortly.

@ekryski ekryski closed this Apr 16, 2026
ekryski added a commit that referenced this pull request Apr 30, 2026
Several follow-ups to spec 023 (Leviathan) bundled into PR #154's tail
since they share the "set up the rest of the speculative-decoding
roadmap" theme.

**Q2 — spec 013 close-out:**

- Implements phase 3.3 ("ngram-map-k4v" / "first 1-2 tokens"): adds
  `multiCandidateLookahead: Int = 1` parameter to
  `NGramLookup.proposeDraft` plus `MLX_NGRAM_MULTI_LOOKAHEAD=N` env
  var (default 1, preserves prior behaviour). Lookahead=2 disambiguates
  patterns where multiple prior occurrences share the same first
  continuation token but diverge on the second — group key changes
  from `Int` to `[Int]` for the multi-candidate grouping.
- 2 new unit tests cover lookahead=1 vs lookahead=2 disambiguation
  (the "[A,B] → [X,Y] count 2 vs [X,Z] count 1" canonical case).
  37/37 ngram tests pass.
- Updates `specs/013-ngram-speculative-decoding.md` with an
  implementation-status table at the bottom: phases 1.4 / 2.2 / 2.3 /
  3.1 / 3.2 / 3.3 shipped; 1.1 / 1.5 deferred (need real-model test
  harness); 1.2 mitigated; 2.1 partial (more model coverage as needed);
  3.4 superseded by spec 020 tape-replay.

**Q3 — eval harness:**

- `scripts/spec-decode-sweep.sh` — parameterised sweep runner. Takes
  `--model`, `--quant`, `--prompts` (file or directory), `--cells`
  (colon-separated `LABEL:NGRAM:TEMP:EXTRA_ENV` specs comma-joined),
  `--trials`, `--max-tokens`. Replaces the per-PR ad-hoc shell loops
  in /tmp/ that we've been writing fresh each time.
- `scripts/spec-decode-compare.py` — A vs B compare on two sweep
  logs. Computes per-cell medians + speedup-ratios with directional
  emoji (✅ / ⚠️ / ≈). Tolerates both the new `extra=...` cell-line
  format and the older `leviathan=...` format from /tmp/ legacy runs.
- `Tests/Benchmarks/Resources/ngram-sweep-prompts/README.md` —
  regime-classified workload guide. Three regimes (regurgitative /
  structured / paraphrastic) with expected speedup bands per regime,
  per-directory prompt counts, and the canonical 6-cell × 5-trial
  cell-set used in the Leviathan analysis. Reference for any future
  spec-decode PR's eval section.
- 8 draft spec PRs (#141 / #142 / #143 / #144 / #145 / #146 / #147 /
  #148) updated with per-spec "Evaluation (when phase 2+ lands)"
  sections that include the canonical sweep+compare commands +
  per-spec pass criteria.

**Q4 — IMPLEMENTATION-PLAN.md reorder:**

Tier 1 ↔ Tier 3 swap. Tape-replay (#20) + prefix cache (#17) are
now Tier 1 (deterministic infrastructure wins, scaffolds landed,
unblocks 5+ models / universal multi-turn TTFT win). DFlash (#15) +
Mirror SD (#21) are now Tier 3 (more experimental — DFlash needs
draft model availability, Mirror SD needs CoreML-LLM Swift Package
dep + ANE measurement infra).

Rationale: lower experimental risk to land deterministic wins first.
By the time DFlash + Mirror SD are unblocked (external model release,
ANE infra), tape-replay will be in place to support DFlash phase 3.

Status snapshot updated: Tier 0 (013 + 018 + 023 + eval harness)
shipped; Tier 1 in flight (phase-1 scaffolds at #143, #144); Tier 2
phase-1 scaffolds also landed (#145, #146, #147, #148).

Closing notes in the plan also reflect spec 023's phase-2 / phase-3
deferral (subsumed by issue #153) so they're not re-attempted.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ekryski added a commit that referenced this pull request Apr 30, 2026
Several follow-ups to spec 023 (Leviathan) bundled into PR #154's tail
since they share the "set up the rest of the speculative-decoding
roadmap" theme.

**Q2 — spec 013 close-out:**

- Implements phase 3.3 ("ngram-map-k4v" / "first 1-2 tokens"): adds
  `multiCandidateLookahead: Int = 1` parameter to
  `NGramLookup.proposeDraft` plus `MLX_NGRAM_MULTI_LOOKAHEAD=N` env
  var (default 1, preserves prior behaviour). Lookahead=2 disambiguates
  patterns where multiple prior occurrences share the same first
  continuation token but diverge on the second — group key changes
  from `Int` to `[Int]` for the multi-candidate grouping.
- 2 new unit tests cover lookahead=1 vs lookahead=2 disambiguation
  (the "[A,B] → [X,Y] count 2 vs [X,Z] count 1" canonical case).
  37/37 ngram tests pass.
- Updates `specs/013-ngram-speculative-decoding.md` with an
  implementation-status table at the bottom: phases 1.4 / 2.2 / 2.3 /
  3.1 / 3.2 / 3.3 shipped; 1.1 / 1.5 deferred (need real-model test
  harness); 1.2 mitigated; 2.1 partial (more model coverage as needed);
  3.4 superseded by spec 020 tape-replay.

**Q3 — eval harness:**

- `scripts/spec-decode-sweep.sh` — parameterised sweep runner. Takes
  `--model`, `--quant`, `--prompts` (file or directory), `--cells`
  (colon-separated `LABEL:NGRAM:TEMP:EXTRA_ENV` specs comma-joined),
  `--trials`, `--max-tokens`. Replaces the per-PR ad-hoc shell loops
  in /tmp/ that we've been writing fresh each time.
- `scripts/spec-decode-compare.py` — A vs B compare on two sweep
  logs. Computes per-cell medians + speedup-ratios with directional
  emoji (✅ / ⚠️ / ≈). Tolerates both the new `extra=...` cell-line
  format and the older `leviathan=...` format from /tmp/ legacy runs.
- `Tests/Benchmarks/Resources/ngram-sweep-prompts/README.md` —
  regime-classified workload guide. Three regimes (regurgitative /
  structured / paraphrastic) with expected speedup bands per regime,
  per-directory prompt counts, and the canonical 6-cell × 5-trial
  cell-set used in the Leviathan analysis. Reference for any future
  spec-decode PR's eval section.
- 8 draft spec PRs (#141 / #142 / #143 / #144 / #145 / #146 / #147 /
  #148) updated with per-spec "Evaluation (when phase 2+ lands)"
  sections that include the canonical sweep+compare commands +
  per-spec pass criteria.

**Q4 — IMPLEMENTATION-PLAN.md reorder:**

Tier 1 ↔ Tier 3 swap. Tape-replay (#20) + prefix cache (#17) are
now Tier 1 (deterministic infrastructure wins, scaffolds landed,
unblocks 5+ models / universal multi-turn TTFT win). DFlash (#15) +
Mirror SD (#21) are now Tier 3 (more experimental — DFlash needs
draft model availability, Mirror SD needs CoreML-LLM Swift Package
dep + ANE measurement infra).

Rationale: lower experimental risk to land deterministic wins first.
By the time DFlash + Mirror SD are unblocked (external model release,
ANE infra), tape-replay will be in place to support DFlash phase 3.

Status snapshot updated: Tier 0 (013 + 018 + 023 + eval harness)
shipped; Tier 1 in flight (phase-1 scaffolds at #143, #144); Tier 2
phase-1 scaffolds also landed (#145, #146, #147, #148).

Closing notes in the plan also reflect spec 023's phase-2 / phase-3
deferral (subsumed by issue #153) so they're not re-attempted.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
div0-space pushed a commit to LibraxisAI/mlx-swift-lm that referenced this pull request Nov 29, 2026
…e values

Main's upstream merge extended RotatingKVCache.metaState from five values
(keep, maxSize, step, offset, idx) to seven or eight: it appends the
capacity origin, the wrap flag and an optional rewind reserve (upstream
604fae7). MiMoV26IndependentHistoryCache keeps the five-value layout,
which RotatingKVCache still loads, so
assistantPageCompactionAndDetachedCopiesKeepMeasuredRootsIndependent
failed on the merged tree by comparing the whole arrays. It now compares
the five values both caches carry. Main already reads the five counters
the same way in MiMoV26MTPRequestCache.prefixHeads, which this branch
limits to contiguous (RotatingKVCache) histories.

Tests (merged tree built against the stitched merged stack: mlx-swift
merge/61 e6ea833a, core merge/41 668e46c6, mlx-c main-into-ekryski#15 d72e5902;
MLX_ENABLE_TF32=0, gpuA lock): MiMoV26IndependentHistoryTests and the
MiMoV26MTP* suites, 10 Swift Testing and 32 XCTest tests, pass.

Co-Authored-By: Claude Opus 5.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.

2 participants