Skip to content

feat: hardware-aware automatic KV quantization configuration (#253) - #262

Open
rajveer43 wants to merge 1 commit into
masterfrom
claude/issue-253-yqr7h5
Open

feat: hardware-aware automatic KV quantization configuration (#253)#262
rajveer43 wants to merge 1 commit into
masterfrom
claude/issue-253-yqr7h5

Conversation

@rajveer43

Copy link
Copy Markdown
Owner

Add a lightweight, calibration-free config selector that picks a KV-cache
quantization method, bit-width, group size, and packing strategy directly
from workload (context length, head dimension) and hardware (unified
memory, Metal availability) characteristics, so callers don't have to
hand-tune every KVCacheConfig field themselves.

  • veloxquant_mlx/tools/auto_kv_config.py: pure-heuristic selector
    (WorkloadProfile, HardwareProfile, select_kv_config, to_kv_cache_config).
    Short contexts get higher precision (kivi, 4-bit), long contexts get
    aggressive compression (turboquant_rvq, 1-bit), large head dims get a
    coarser group size, and memory pressure lowers bit-width or falls back
    to a bounded-memory eviction method (streaming_llm) when no bit-width
    fits the budget. No MLX import at module scope, mirroring
    tools/mac_recommender.py.
  • veloxquant_mlx/cli/autoconfig.py + main.py: veloxquant autoconfig
    CLI entry point.
  • tests/non_metal/test_auto_kv_config.py: pure-Python unit tests (wired
    into non-metal-unit.yml, no MLX required).
  • veloxquant_mlx/tests/tools/test_auto_kv_config_integration.py: builds
    real KVCacheFactory caches from the selector's output and round-trips
    tensors through update_and_fetch for every method it can choose.

Add a lightweight, calibration-free config selector that picks a KV-cache
quantization method, bit-width, group size, and packing strategy directly
from workload (context length, head dimension) and hardware (unified
memory, Metal availability) characteristics, so callers don't have to
hand-tune every KVCacheConfig field themselves.

- veloxquant_mlx/tools/auto_kv_config.py: pure-heuristic selector
  (WorkloadProfile, HardwareProfile, select_kv_config, to_kv_cache_config).
  Short contexts get higher precision (kivi, 4-bit), long contexts get
  aggressive compression (turboquant_rvq, 1-bit), large head dims get a
  coarser group size, and memory pressure lowers bit-width or falls back
  to a bounded-memory eviction method (streaming_llm) when no bit-width
  fits the budget. No MLX import at module scope, mirroring
  tools/mac_recommender.py.
- veloxquant_mlx/cli/autoconfig.py + __main__.py: `veloxquant autoconfig`
  CLI entry point.
- tests/non_metal/test_auto_kv_config.py: pure-Python unit tests (wired
  into non-metal-unit.yml, no MLX required).
- veloxquant_mlx/tests/tools/test_auto_kv_config_integration.py: builds
  real KVCacheFactory caches from the selector's output and round-trips
  tensors through update_and_fetch for every method it can choose.
@netlify

netlify Bot commented Aug 26, 2026

Copy link
Copy Markdown

Deploy Preview for veloxquant-mlx ready!

Name Link
🔨 Latest commit 2f14b83
🔍 Latest deploy log https://app.netlify.com/projects/veloxquant-mlx/deploys/6a8f1256f3f0930007573437
😎 Deploy Preview https://deploy-preview-262--veloxquant-mlx.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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