You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 62d7ebd
Browse filesBrowse the repository at this point in the historyBrowse files
from `text_config.expert_dtype`, which the composite config hoists from the released config.json's
137
+
from `text_config.expert_dtype`, which the configuration loaders preserve from the released config.json's
138
138
`quantization_config.expert_dtype = "fp4"`. The bf16 projections without a `.scale` (`compressor.kv_proj`,
139
139
`compressor.gate_proj`, `indexer.k_proj`, `indexer.weights_proj`) are auto-skipped by the quantizer
140
140
(`_keep_in_fp32_modules`), like V4's.
141
141
142
-
`DeepseekV41ForCausalLM`takes the composite [`DeepseekV41Config`] (`config_class`) because the released
143
-
config.json nests the text backbone under `text_config` and puts `quantization_config` at the top level — pointing
144
-
the class at the bare text config would silently drop the quantization config and corrupt the fp8 tensors on load.
145
-
The text config is unwrapped in `__init__`; instantiating with a [`DeepseekV41TextConfig`] directly also works.
142
+
`DeepseekV41ForCausalLM`uses the composite [`DeepseekV41Config`]; its text configuration is unwrapped during
143
+
initialization. [`DeepseekV41TextModel`] uses [`DeepseekV41TextConfig`] and preserves the outer
144
+
`quantization_config` before extracting `text_config`, so the bare backbone also recognizes the released
145
+
quantized checkpoint. Flat text checkpoints and direct text-config construction remain supported.
146
146
147
147
## Usage
148
148
@@ -233,20 +233,24 @@ tokens per second of prefill).
233
233
shared compressed KV / indexer keys); consumer layers read the source's cache through a per-forward `shared` dict.
234
234
`DynamicCache(config=…)` builds the right layers from `config.layer_types` — the new
235
235
`"shared_compressed_attention"` layer type is registered with the cache and masking utilities.
236
-
***Group state across calls.** The compressor buffers partial groups, so chunked prefill and decode are exact:
237
-
a prompt fed in chunks produces the same logits as a one-shot prefill, including when a chunk boundary lands
238
-
inside a group.
236
+
CSA caches are not croppable: removing tokens cannot rewind the compressor's partial groups or emitted entries.
237
+
Nonzero rollback requests are rejected before any cache layer is mutated; `crop(0)` retains trim-only behavior.
238
+
***Padding and group state.** Compression groups contain only live tokens from each batch row. Their first-token
239
+
RoPE positions, live-token counts and partial groups follow the row through cached calls and beam operations.
240
+
Chunked prefill and decode use the same groups as one-shot prefill, even when a chunk ends inside a group or
241
+
contains only padding for some rows. Floating-point reduction and hard top-k boundaries can still affect
242
+
numerical equivalence.
239
243
***Top-k ties.** The indexer's per-head scores are ReLU-rectified, so keys every head scores negatively tie at
240
244
exactly 0.0 and `torch.topk` may order them by layout. Like DeepSeek-V3.2, cross-backend output-equivalence
241
245
guarantees do not hold for this model; the equivalence tests in `tests/models/deepseek_v41` select all visible
242
246
blocks to stay deterministic.
243
247
***Stale indexer keys on incomplete-group decode steps (reference deviation).** The reference reassigns the
244
248
shared indexer key cache only when a latent is emitted, but scores against it unconditionally: on decode steps
245
249
where no group completes, a layer scores its queries against the *last publisher's* keys — typically layer 20's,
246
-
since it owns the last index-source slot. This implementation (and vLLM, MLX and llama.cpp) instead always
247
-
publishes the owner layer's running key cache, so those steps read the correct owner keys. The parity harness is
248
-
blind to the difference (its tiny config saturates the top-k: `index_topk` exceeds the compressed length), so
249
-
this is a documented deviation, not an asserted equivalence.
250
+
since it owns the last index-source slot. This implementation republishes the owning layer's running cache.
251
+
The same reference fix is proposed in [DeepSeek's model PR #12](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash/discussions/12).
252
+
[Discussion #41](https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash/discussions/41) provides a reduced-model CPU
253
+
reproduction and states its kernel-adaptation and numerical-validation limits.
0 commit comments