Skip to content

docs: clarify turbo KV cache size - #119

Open
sayampy wants to merge 1 commit into
RustingStudio:mainfrom
sayampy:docs/kv-size-fix
Open

sayampy wants to merge 1 commit into
RustingStudio:mainfrom
sayampy:docs/kv-size-fix

Conversation

@sayampy

@sayampy sayampy commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Docs-only correction. docs/USAGE.md:148 says the turbo variants select narrower centroids, which is true, but it can be read as implying smaller cache formats. The code packs every turbo mode into 4-bit nibbles: kv_mode_words in src/cuda/mod.rs:144 maps modes 4 through 6 to the same word width, and kv_put_tq in src/cuda/kernels.cu:2857-2870 writes one byte per two values plus one fp16 corrected norm per 128. turbo3, turbo2 and the mixed variants therefore use the same cache size as turbo4 and only change the centroids.

For reference, TheTom's CUDA header stores turbo4 codes as nibbles in qs[j / 2] but stores turbo3 as a 2-bit code plane in qs[j / 4] plus a 1-bit sign plane in signs[j / 8], which is a genuinely smaller 50 B per 128 layout. That packing is not implemented here yet. Source: https://raw.githubusercontent.com/TheTom/llama-cpp-turboquant/feature/turboquant-kv-cache/ggml/src/ggml-cuda/turbo-quant.cuh

This PR adds no benchmark numbers and changes no behavior.

Comment thread docs/USAGE.md
when the K cache is TurboQuant, and the attention output is de-rotated when the V cache is TurboQuant.
`--kv turbo4-3`, `turbo4-2`, `turbo3`, `turbo2` and `turbo3-2` select narrower K/V centroids.
`--kv turbo4-3`, `turbo4-2`, `turbo3`, `turbo2` and `turbo3-2` select narrower K/V centroids. All of them
currently use the same 4-bit nibble packing and cache size as `--kv turbo4`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High · Correctness · 1 of 2

The new claim that all turbo variants share turbo4's packing and cache size cannot be checked from this diff. If any of turbo4-3, turbo4-2, turbo3, turbo2 or turbo3-2 uses a different bit width or packing than turbo4, users sizing GPU memory from this doc will under- or over-allocate the KV cache. The diff gives no code or test evidence for the claim.

Prompt for your AI agent
File: docs/USAGE.md
Line: 149
Issue: The new claim that all turbo variants share turbo4's packing and cache size cannot be checked from this diff. If any of turbo4-3, turbo4-2, turbo3, turbo2 or turbo3-2 uses a different bit width or packing than turbo4, users sizing GPU memory from this doc will under- or over-allocate the KV cache. The diff gives no code or test evidence for the claim.
Make the smallest change that fixes this, add a test, and change nothing unrelated.

Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.

Comment thread docs/USAGE.md
`--kv turbo4-3`, `turbo4-2`, `turbo3`, `turbo2` and `turbo3-2` select narrower K/V centroids.
`--kv turbo4-3`, `turbo4-2`, `turbo3`, `turbo2` and `turbo3-2` select narrower K/V centroids. All of them
currently use the same 4-bit nibble packing and cache size as `--kv turbo4`.
- `--k TYPE` and `--v TYPE` set the two cache formats independently (CUDA). Either half may be `f16`, `q8`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Low · Maintainability · 2 of 2

'Currently' is undated and has no version reference, so the statement will go stale without anyone noticing. When a later change gives turbo3 or turbo2 a packed narrower layout, this sentence stays in the docs and tells users the old cache size is still in effect, so the doc contradicts the code.

Prompt for your AI agent
File: docs/USAGE.md
Line: 150
Issue: 'Currently' is undated and has no version reference, so the statement will go stale without anyone noticing. When a later change gives turbo3 or turbo2 a packed narrower layout, this sentence stays in the docs and tells users the old cache size is still in effect, so the doc contradicts the code.
Make the smallest change that fixes this, add a test, and change nothing unrelated.

Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.

@aletheore

aletheore Bot commented Nov 26, 2026

Copy link
Copy Markdown

Aletheore Flash Lite review

What this PR does. This PR adds a documentation note to docs/USAGE.md stating that the narrower turbo KV cache options (turbo4-3, turbo4-2, turbo3, turbo2, turbo3-2) currently use the same 4-bit nibble packing and cache size as turbo4. It affects users who run Strata with these --kv settings, since they should not expect memory savings from the lower-bit names.

Merge confidence Review effort Merge risk
3 / 5 1 / 5 Medium
Area Files Lines
docs 1 +2 −1

2 finding(s) posted as inline review comment(s).

# Severity Category Where
1 🟠 High Correctness USAGE.md:149 The new claim that all turbo variants share turbo4's packing and cache size cannot be checked from this diff…
2 🔵 Low Maintainability USAGE.md:150 'Currently' is undated and has no version reference, so the statement will go stale without anyone noticing…
Review details

Reviewed 1 file(s); skipped 0. Dismissed 0; outside PR diff 0. Grounding: 2 of 2 proposed finding(s).

Fix all with your agent
File: docs/USAGE.md
Line: 149
Issue: The new claim that all turbo variants share turbo4's packing and cache size cannot be checked from this diff. If any of turbo4-3, turbo4-2, turbo3, turbo2 or turbo3-2 uses a different bit width or packing than turbo4, users sizing GPU memory from this doc will under- or over-allocate the KV cache. The diff gives no code or test evidence for the claim.
Make the smallest change that fixes this, add a test, and change nothing unrelated.

File: docs/USAGE.md
Line: 150
Issue: 'Currently' is undated and has no version reference, so the statement will go stale without anyone noticing. When a later change gives turbo3 or turbo2 a packed narrower layout, this sentence stays in the docs and tells users the old cache size is still in effect, so the doc contradicts the code.
Make the smallest change that fixes this, add a test, and change nothing unrelated.

@aletheore

aletheore Bot commented Nov 26, 2026

Copy link
Copy Markdown

🔍 Aletheore evidence diff

What changed
Deterministic, computed from this commit's real scan and import graph - posted on every run, whether or not Flash Review found anything.

  • docs/USAGE.md · modified · +2/-1

Aggregate deltas

  • Modules: +0
  • Dependency graph edges: +0
  • Commits: 1

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