Repository navigation
Add experimental selective KV retention and native-model qualification - #1412
Draft
Gajesh2007 wants to merge 3 commits into
Draft
Gajesh2007 wants to merge 3 commits into
Gajesh2007 wants to merge 3 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Full-attention KV keeps growing during decode. This adds an explicit singleton benchmark mode that retains the native recent window and reduces older full-attention history. The provider rejects serving activation: qualification exposed a reproducible GPT completion regression, and temporary scoring/compaction allocations still need serving ownership.
Depends on mlx-swift-lm #295, pinned at verified signed commit
46477f0.DARKBLOOM_CBV2_SELECTIVE_KV=halfrequires an explicit contiguous backend, benchmark construction, one concurrent request, and MTP off. MiMo and other model families are excluded. All exact prefix-cache paths are fenced; existing admission bounds remain conservative.The policy preserves dense prefill, native K/V dtype, original absolute positions, the first four tokens, at least the latest 512 tokens, and native sliding windows. It selects half of older full history in 16-token chunks using bounded recent-query attention and evenly spaced coverage. The dedicated refactor removed the redundant gather-to-new-row copy: one owned gather includes bounded spare capacity that remains unreachable until overwritten.
Before
After
flowchart LR I["Benchmark input + explicit half policy"] --> G{"Allowed experiment scope?"} G -->|"yes"| F["Factory: selective full rows + native windows"] F --> D["Dense prefill; selected-history decode"] D --> R["Scores, actual pruning, allocator observations"] G -->|"no"| X["Refuse incompatible activation"] F -.-> C["Fence every prefix cache; require MTP off"] classDef input fill:#dbeafe,color:#172554,stroke:#2563eb classDef candidate fill:#fef3c7,color:#78350f,stroke:#d97706 classDef fence fill:#fee2e2,color:#7f1d1d,stroke:#dc2626 class I,R input class G,F,D candidate class X,C fenceMeasured qualification:
Full results, exact artifact hashes, compressed raw reports, limitations and follow-up hypotheses. All measured inputs are synthetic text. Both arms disable MTP and prefix reuse; this does not qualify multimodal retention, concurrent serving, or combination with quantized KV.
Validation:
393aa0007; this final commit adds evidence/docs only. SDK feat(console-ui): image upload in chat for vision models (Gemma 4) #295 build/tests, lint, fork map and CodeQL pass on46477f0.gemmheaders. These local failures remain separately documented.coordinator/registry/cache_match_groups.go. Parent Before/After figures were visually verified on GitHub.Memory limitation: BF16 Gemma keys are cast in full to FP32 while scoring. At 32K its two global KV heads and D512 require 128 MiB per global layer (640 MiB across five if graph lifetimes overlap), plus score/normalization intermediates and source/destination overlap. The serving gate stays closed until this temporary ownership and the quality regression are addressed.