/ Модель

Характеристики

Контекст
262 144 токена
Размер весов
71,9 ГБ
Лицензия
Apache 2.0
Архитектура
qwen3_5_moe · dense
Базовая модель
Qwen3.6-35B-A3B
Библиотека
vllm
Опубликована
25 окт 2026

Qwen3.6-35B-A3B-TinyKV

Генерация текстаТекст → текст13 профессий
97скачиваний за 30 дней0лайковвеса обновлены26 окт 2026

Описание модели

Составлено на русском по карточке модели и метаданным Hugging Face

Производная от Qwen3.6-35B-A3B модель для генерации текста и диалогов с длинным контекстом, требующая примерно в 2,5 раза меньше памяти KV-кэша.

Qwen3.6-35B-A3B-TinyKV — производная версия Qwen3.6-35B-A3B, созданная автором репозитория методом дистилляции для сокращения памяти KV-кэша. В десяти слоях с полным вниманием изменены представления ключей и значений, а часть слоёв использует общий кэш; остальные слои, эксперты MoE, эмбеддинги и визуальный модуль совпадают с базовой моделью. Дельта изменений хранится отдельно в файле tinykv-patch.safetensors размером 560 МБ.

Модель предназначена для генерации текста и диалогов с длинным контекстом, включая сценарии вызова инструментов. По результатам автора, KV-кэш занимает примерно в 2,5 раза меньше места при том же типе кэша; в проверках на чистом тексте наблюдалось небольшое снижение качества, а качество в диалогах и вызовах инструментов отличается от исходной модели. Указан контекст до 131 072 токенов в примере запуска. Репозиторий рассчитан на vLLM 0.32.0 с включённым плагином; для bf16-весов нужна видеокарта с не менее чем 80 ГБ памяти, а работа на нескольких GPU в плагине не реализована. Оценивался только текстовый режим: изображения и видео не проверялись. Лицензия — Apache-2.0.

Сценарии применения

  • генерация ответов в диалогах с длинной историей
  • обработка длинных документов и поиск фактов в контексте
  • обслуживание большего числа параллельных текстовых запросов при ограниченной памяти GPU
  • генерация текста с вызовом инструментов через vLLM

Ограничения

Текстовые возможности оценивались ограниченно, а изображения и видео с изменённым вниманием не проверялись; пропускная способность и длинноконтекстный поиск фактов в vLLM не измерены. Плагин рассчитан на одну видеокарту, а bf16-веса требуют не менее 80 ГБ видеопамяти.

Публичные бенчмарки

Результаты из открытых лидербордов в сравнении с лидерами каталога

Публичных оценок пока нет

В подключённых источниках результатов этой модели не нашлось. Отсутствие оценки не значит, что модель хуже: её могли просто не проверять.

Источники: Hugging Face Leaderboards, Hugging Face Eval Results, Open LLM v2, MTEB, timm, Open ASR, EvalPlus, LLM Stats

Для каких профессий подходит13

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Qwen3.6-35B-A3B-TinyKV

Qwen3.6-35B-A3B with a 2.5× smaller KV cache at the same cache dtype. Only the 10 full-attention layers were retrained, by distillation from the original model. The 30 Gated DeltaNet layers, the MoE experts, the embeddings and the vision tower are byte-identical to the base model; the stock shards in this repo are untouched, and tinykv-patch.safetensors (560 MB) is the whole delta.

KV cache per tokenbf16 cachefp8 cacheNVFP4 (4.5 bit)
Qwen3.6-35B-A3B20,480 B10,240 B5,760 B
TinyKV (this repo)8,192 B4,096 B2,304 B

Measured in vLLM 0.32.0 on one RTX PRO 6000 (96 GB, gpu_memory_utilization=0.9): the KV cache holds 1.93M tokens instead of 820k (2.35×; the Gated DeltaNet state is a fixed cost that doesn't shrink), so 58.8 concurrent 32k-token requests fit instead of 25. With --kv-cache-dtype fp8: 3.21M tokens instead of 1.43M.

Status (read this first):

  • Quality was measured teacher-forced in PyTorch (tables below), with the cache rounded to NVFP4 as in training.
  • vLLM 0.32.0 loads it through the included plugin and matches the PyTorch reference (see "Use with vLLM").
  • Single GPU only (tensor parallel is not implemented in the plugin): the bf16 weights need a ≥80 GB GPU.
  • Text only was evaluated; the vision tower is unchanged but image/video inputs were not tested with the new attention.
  • Quantized variants and GGUFs: see Variants below (GGUFs need the tinykv branch of llama.cpp).

Variants

RepoFor
this repo (bf16)vLLM, ≥80 GB GPU
Qwen3.6-35B-A3B-TinyKV-NVFP4vLLM on Blackwell, ~22 GB weights
Qwen3.6-35B-A3B-TinyKV-FP8vLLM on Ada / Hopper / Blackwell, ~37 GB weights
Qwen3.6-35B-A3B-TinyKV-GPTQ-Int4vLLM with GPTQ, 24 GB class and up; on one Intel Arc Pro B70 the full 262K context in 25 GB, 233 tok/s decode at a 130K prompt (stock: 186)
Qwen3.6-35B-A3B-TinyKV-GGUFllama.cpp (tinykv fork), Q8_0 down to IQ2_M, with a what-fits-on-your-GPU table

Quality

All numbers compare against the original Qwen3.6-35B-A3B (bf16 weights, original cache).

Needle retrieval with 32 near-duplicate distractor facts ("the secret code for amber-123 is …" next to amber-456, …): exact match of the 8-digit answer, and its mean log-probability. These needles were held out: they were not used to choose the checkpoint (see "How the checkpoint was chosen").

ContextNeedlesTinyKV exactOriginal exactTinyKV logpOriginal logp
30k tokens9696.9 %97.9 %−0.503−0.372
130k tokens2495.8 %91.7 %−0.677−0.427

KL divergence from the original model's next-token distribution on held-out 8k-token documents (4 per source), counting only tokens whose target lies in no 32-gram of the training data. The "NVFP4 only" column is the original attention with its cache rounded to NVFP4: the floor any 4-bit cache pays.

SourceTinyKV KLNVFP4-only KLTinyKV ΔCE (nats/token)
books (PG-19)0.0400.008+0.019
web (FineWeb-Edu)0.0270.006+0.012
code0.0500.009+0.007
math (FineMath)0.0270.005+0.009
reasoning traces (math / code)0.024 / 0.0270.003 / 0.005−0.001 / +0.001
chat (SmolTalk)0.1170.031—
tool calls (Toucan)0.3240.206—

On clean text the cost is roughly +1–2 % perplexity. Chat and tool-call traffic is further from the original (ΔCE is not shown there because the template boilerplate in those sets is partly memorized, which makes ΔCE misleading).

Use with vLLM

pip install vllm==0.32.0
pip install ./plugin            # registers TinyKVQwen3_5MoeForConditionalGeneration with vLLM
vllm serve darioooooo0o/Qwen3.6-35B-A3B-TinyKV --max-model-len 131072 --gpu-memory-utilization 0.9 \
    --limit-mm-per-prompt '{"image":0,"video":0}'

Get plugin/ from the repo first (hf download darioooooo0o/Qwen3.6-35B-A3B-TinyKV --include "plugin/*" --local-dir .). vLLM picks the plugin up through its vllm.general_plugins entry point, also in its engine subprocesses. --kv-cache-dtype fp8 works and halves the cache again.

vLLM check (offline LLM API, vLLM 0.32.0, FlashAttention 2, eager mode): per-token log-probs of 4 held-out prompts (~1k tokens each) against the PyTorch reference, with stock Qwen3.6 in vLLM vs PyTorch as the noise floor:

mean |Δ logp| vs PyTorchKV cache (tokens)
stock, bf16 cache0.071820,062
TinyKV, bf16 cache0.0461,927,868
stock, fp8 cache0.0771,426,897
TinyKV, fp8 cache0.0423,212,140

Greedy answer to "Explain in three sentences why the sky is blue." (TinyKV in vLLM): "Sunlight appears white but is actually composed of all colors of the rainbow, which travel as waves of different lengths. When this light enters Earth's atmosphere, it collides with gas molecules and other particles, causing shorter blue and violet wavelengths to …"

Not measured yet: throughput, and long-context needles through vLLM (the needle tables above come from the PyTorch path).

How it works

A retrofit: only the 10 full-attention layers are rebuilt, trained by distillation against the original model. The 30 Gated DeltaNet layers, the MoE experts and the embeddings are untouched.

Every converted layer computes queries, keys and values exactly like the original (projections, q/k RMSNorm, partial RoPE on the first 64 of 256 dims, output gate). On top of that, small linear maps change what is cached:

  1. Layer sharing (cross-layer attention). Layers 19, 27 and 39 read the cache of layers 15, 23 and 35, so 7 of the 10 layers store anything.
  2. Compressed keys. A key head has 256 dims: 64 carry RoPE and 192 don't. The 64 RoPE dims are kept exactly; the 192 others are compressed to 64 by a learned linear map (the partial-RoPE idea from MLA retrofits such as MHA2MLA and TransMLA).
  3. Compressed values, 256 → 128 dims, also a learned linear map.
  4. Query and output maps. Queries are mapped into the compressed key space: a complex scale per RoPE frequency pair (it commutes with RoPE, so positions stay exact) plus a linear map on the non-RoPE dims. Attention outputs are mapped back to 256 dims before the gate and o_proj.
  5. Layer 35 stays full width. It is the most retrieval-critical layer in a sensitivity sweep.

Because every map is linear and sits around ordinary attention, the serving engine just sees attention with head size 128 instead of 256 and uses its stock kernels: no custom attention kernel. The compressed cache lives in vLLM's normal paged KV cache, and the plugin is ~120 lines (plugin/tinykv_vllm/model.py).

Training

On one RTX PRO 6000, training only the attention modules of the 10 full-attention layers, with the cache rounded to NVFP4 throughout (quantization-aware), so the 4-bit cache (2,304 B/token) is what the model learned to work with:

StepTokensWhat it does
Init—Closed form: PCA / least squares on calibration activations, a reasonable model before any training
1. Layer-wise distillation115M at 8kEach layer's attention output matched to the original's
2. End-to-end distillation160M at 8kKL to the original's next-token distribution over the full vocabulary, plus 0.3× the layer-wise loss; copy/induction tokens up-weighted, 0.3× learning rate, repeated boilerplate masked out (cross-row 32-gram dedup)
3. Long-context distillation10M at 32kThe same KL on long documents; snapshots every 10M, picked by a pre-registered rule (below)

What mattered along the way:

  • A lower learning rate plus deduplicated data. Before that, stage 2 mostly memorized repeated system prompts and tool schemas instead of improving on real text.
  • Short long-context training. 10M tokens at 32k fixed long-range retrieval; more KL-only training wore it back down.

Prior art it combines: MLA-style retrofits, low-rank KV compression (Palu), cross-layer KV sharing, and KV quantization-aware training, applied here to a hybrid Gated DeltaNet / MoE model with ~300M distillation tokens.

Data: FineWeb-Edu, FineMath, codeparrot-clean, OpenR1-Math, OpenCodeReasoning, SmolTalk, Toucan-1.5M and Hermes function-calling (tool calls rendered in Qwen3.6's native format), PG-19, and synthetic key-value lookups. The whole conversion took 38 GPU-hours.

How the checkpoint was chosen

The rule was written down before the long-context phase ran: among the snapshots taken every 10M tokens whose clean-text KL stayed within 10 % of the stage-2 result, take the one with the best needle score on a fixed needle set (seed 1, 48 needles at 30k), then judge it only on fresh needles (the tables above), with a pass bar of a ≤ 0.2 logp gap at 30k and no collapse at 130k. The 10M snapshot was picked (needle gap 0.07) and passed (0.13 on the fresh needles).

Longer KL-only training at 32k wore retrieval down: the 30M snapshot found 70.8 % of the fresh 30k needles and 83.3 % at 130k. The run was stopped there; results/ has every eval.

Files

PathWhat
model-*.safetensorsthe unmodified Qwen3.6-35B-A3B shards
tinykv-patch.safetensorstrained attention weights (*.self_attn.tk.*) and the cache maps (tk_q/tk_k/tk_v/tk_d)
config.jsonarchitecture TinyKVQwen3_5MoeForConditionalGeneration, layout under text_config.tinykv
plugin/the vLLM plugin (pip install ./plugin)
training/tinykv/conversion, training, eval and export code
results/metric logs: stage 1, the stage-2 A/B, stage 2, the long phase, and the held-out gate (gate.jsonl)

Credits

Made by @imdariotoo. I post my local-model releases on X, so follow there for the next ones.

All training, evaluation and the vLLM checks ran on CloudRift RTX PRO 6000 GPUs, provided through their AI Builder Grant. Thanks to CloudRift for the compute.

License

Apache-2.0, as the base model (Qwen/Qwen3.6-35B-A3B).

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

vLLM

Нельзя запустить

Модели нужен vLLM (несколько GPU), но архитектура TinyKVQwen3_5MoeForConditionalGeneration ему неизвестна.

Класс архитектуры
TinyKVQwen3_5MoeForConditionalGeneration
Ревизия весов
e8358b3

0 моделей