lfm3: round 6 - GPTQ INT4 baked (INT4 lm_head + INT8 embedding)

- quant/gptq_baked/: llm-compressor GPTQ W4A16 body (sequential pipeline, verified
  equal to the plain forward), B65-style GPTQ INT4 lm_head bake with a small
  damp/act-order/clipping grid, INT8 per-row embedding, assembly into one
  compressed-tensors checkpoint (1.155 GB vs 3.46 GB BF16)
- plugin: pass quant_config to the token embedding so vLLM's compressed-tensors
  INT8 embedding path is used; BF16/FP8 greedy output unchanged
- tests: INT8 embedding kernel check, quant method dump, head timing, round-6 driver
- NOTES: round 6 results (PPL +8.1%, decode 217 t/s = FP8 pc +14%, head bake
  gives no measurable decode gain on this stack), llama-swap snippet (not applied)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pascal LinxweilerandClaude Opus 5.5 committed 2026-10-30 14:48:48 +01:00
1 parent 1115927570
commit 38b0e9a345
110 files changed
+118917 -3

No files matched your search

+10 -2
View File
@@ -385,8 +385,15 @@ class Lfm3Model(nn.Module):
if t not in (*ATTENTION_LAYER_TYPES, "conv"):
raise ValueError(f"LFM3: unsupported layer type {t!r}")
# quant_config reaches the embedding only for checkpoints that quantize it
# (compressed-tensors INT8 embedding); BF16 and online FP8 resolve to the
# unquantized embedding method as before.
self.embed_tokens = VocabParallelEmbedding(
self.vocab_size, config.hidden_size, org_num_embeddings=config.vocab_size
self.vocab_size,
config.hidden_size,
org_num_embeddings=config.vocab_size,
quant_config=quant_config,
prefix=maybe_prefix(prefix, "embed_tokens"),
)
# one RoPE (cos/sin cache) per attention layer type, shared by its layers
@@ -527,7 +534,8 @@ class Lfm3ForCausalLM(nn.Module, HasInnerState, SupportsPP, IsHybrid, SupportsQu
def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
# Unknown checkpoint names make AutoWeightsLoader raise; missing ones are
# checked below. `lm_head` is tied to `embed_tokens` and not in the checkpoint.
# checked below. With tie_word_embeddings, `lm_head` is tied to `embed_tokens` and
# not in the checkpoint; untied checkpoints carry their own (possibly quantized) lm_head.
loader = AutoWeightsLoader(self)
loaded = loader.load_weights(weights, mapper=self.hf_to_vllm_mapper)