Skip to content

v0.4 — ModelPool (multi-model + LRU + pin)#27

Merged
magicnight merged 6 commits intomainfrom
feat/v0.4-model-pool
Apr 24, 2026
Merged

v0.4 — ModelPool (multi-model + LRU + pin)#27
magicnight merged 6 commits intomainfrom
feat/v0.4-model-pool

Conversation

@magicnight
Copy link
Copy Markdown
Owner

Summary

Second of three v0.4.0 engine-parity sub-features.

  • ModelPool actor: holds multiple InferenceEngine instances, LRU-evicts under a byte budget, respects pinned entries, deduplicates concurrent loads of the same ID
  • EngineCoordinator delegates load / unload / generate / clearPromptCache through the pool (public API unchanged — activeEngine is now async)
  • Settings → Model Pool slider (default: 50% of total RAM, 2–256 GB)
  • Models tab: pin icon per row (orange when pinned)
  • 6 new ModelPoolTests passing

User-visible win

External API cold-swap no longer unloads the GUI's current model. Multi-context workflows ("Claude Code uses small-fast, Cursor uses big-smart") keep both resident.

MVP scope

  • Pinned state is in-memory only this release; persistence deferred
  • Live DispatchSource memory-pressure watcher deferred to v0.4.0.1
  • Per-model live RSS display not included (coarse resident count only)

Test plan

  • MacMLXCore: swift build + swift test — 93/93
  • Xcode app: xcodebuild -scheme macMLX -configuration Debug build — SUCCEEDED
  • Manual: load A → load B → reload A, observe "Model loaded: A" shows without "Loading from disk" (pool hit)

🤖 Generated with Claude Code

magicnight and others added 6 commits April 18, 2026 22:01
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…lPool

Single active model is still the UX default — currentModelID is the
one shown in the toolbar + menu bar. But previously-loaded models
now stay resident in the pool until LRU evicts, so the next
switch-back skips disk read. Engines spawn via an injected factory
so tests can stub.
@magicnight magicnight merged commit 1bdcf70 into main Apr 24, 2026
2 checks passed
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