[BUG] kvpress algorithm: KVzipPress and FastKVzipPress never compress during generate
Nadie ha tomado este issue todavía.
- #797 de @RajVardhan853381 — cerrado sin fusionar
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- machine-learning, performance
Línea de trabajo
Read src/pruna/algorithms/kvpress.py around the model.generate wrapper and inspect tests/algorithms/testers/kvpress.py. Reproduce the reported behavior with KVzipPress or FastKVzipPress, then check whether the cache is compressed during generation. Done means the supported presses compress before decoding, or are rejected clearly, with a test that catches the reported uncompressed-cache behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
For a causal LM, KVPress._apply wraps model.generate in the press context (kvpress.py#L163-L165):
def generate_with_press(*args, **kwargs):
with press(model):
return original_generate(*args, **kwargs)
Some KVPress presses compress only when their context manager exits. Two of them are in PRESS_TYPES: KVzipPress and FastKVzipPress. Under this wrapper the exit comes after generation has finished, so nothing is compressed while the model generates. No KV entry is masked, and the output equals the uncompressed model's. A model smashed with kvpress_press_type="KVzipPress" therefore silently runs uncompressed.
This is upstream KVPress behaviour for this usage (NVIDIA/kvpress#297; a maintainer replied that the README will be updated). Pruna's wrapper uses exactly that usage, so it inherits the problem.
What I did
I reproduced the underlying behaviour with kvpress alone, using the same with press(model): model.generate(...) pattern as the wrapper. Setup: kvpress 66c5b09, transformers 5.2.0, SmolLM2-360M-Instruct, SDPA, CPU, compression_ratio=0.5.
KVzipPress: prompt 1111 tokens, cache 1126 rows, masked entries 0, output identical to no press: True
FastKVzipPress on Qwen3-4B-Instruct-2507 (the smallest model with released gates) gives the same result: 0 entries masked during generation. With prefill-only usage under the press, it masks 50% of entries as expected.
I have not run this through Pruna itself. The kvpress algorithm declares runs_on: ["cuda"] and my reproduction ran on CPU and Apple silicon, so the Pruna part of this report rests on the wrapper code above.
Expected behavior
Either:
- compression is applied before decoding starts: prefill under the press, then generate from the compressed cache, as kvpress's own
kv-press-text-generationpipeline does; or - these presses are removed from
PRESS_TYPESor rejected with a clear error.
tests/algorithms/testers/kvpress.py only checks that _kvpress_press and _kvpress_original_generate are attached. A test that checks the cache is actually smaller, or that entries are masked, after a smashed generate would catch this.
Environment
- pruna version: main @ c622a77 (code reading; not executed)
- reproduction: kvpress 66c5b09, transformers 5.2.0, torch 2.9.1
- python version: 3.12
- Operating System: macOS (reproduction)
Additional context
KVgradPress and KVComposePress share the exit-time compression upstream but are not in PRESS_TYPES.
AI-assisted: drafted with an AI coding assistant. I reviewed the report and the reproduction output above.
- Lenguaje dominante
- Python
- Estrellas
- 1.4k
- Forks
- 129
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PrunaAI/pruna
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
[BUG] set_to_eval calls Llama.eval() on llama.cpp models, so latency/energy/memory metrics log a warning on every runPosiblemente ocupada @zuhalsicim la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
[FEATURE] Add speculative decoding to the decoder algorithm familyPosiblemente ocupada @mohityadav8 la tomó hace 6 días. Abiertoenhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
Todos los issues de PrunaAI/pruna
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Rose22/openlumara#166 ·
-
documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
enhancement feature/signals self-driving team/self-driving
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PostHog/posthog#144208 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
good first issue help wanted tests
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
LMPrado-DZ23/open_notas_br#14 ·
Los mantenedores suelen responder en 1 día