Skip to content

model-saver : emit kda_gate_lower_bound for Kimi K3 - #22

Merged
fairydreaming merged 1 commit into
pwilkin:kimi-k3-textfrom
SolshineCode:kimi-k3-saver-kda-gate
Aug 6, 2026
Merged

model-saver : emit kda_gate_lower_bound for Kimi K3#22
fairydreaming merged 1 commit into
pwilkin:kimi-k3-textfrom
SolshineCode:kimi-k3-saver-kda-gate

Conversation

@SolshineCode

Copy link
Copy Markdown

This is a simple follow-up to the Kimi K3 arch-test work (now merged into kimi-k3-text).

While the saver roundtrips the other K3 hyperparameters, it never emitted
kda_gate_lower_bound. The K3 loader reads that key and gates a graph branch on it. So in this way it scales the KDA gate when the bound is above -INFINITY (kimi-k3.cpp).
The saver dropped the key, thus a save->load roundtrip silently reset it to
the -INFINITY default and changed the model's output. The real K3 config sets
gate_lower_bound = -5.0.

Changes includes:

  • llama-model-saver.cpp: emit LLM_KV_KDA_GATE_LOWER_BOUND from the model.
  • test-llama-archs.cpp: set it to -5.0 in the K3 case so the roundtrip check
    actually exercises the key.

Verified with the test value in place, the save->load roundtrip FAILS without
the saver line and PASSES with it. The full test-llama-archs sweep shows no
regressions on the other arches.

Quick fix. The Kimi K3 loader reads kda_gate_lower_bound and gates a graph branch on it (it scales the KDA gate when the bound is above -INFINITY), but the model
saver never wrote the key, so a save->load roundtrip silently dropped it back to the -INFINITY default and changed the model's output. The real K3 config sets gate_lower_bound = -5.0.

I propose to emit it from the saver, and set it to -5.0 in the test-llama-archs K3 case so the roundtrip check exercises it (the roundtrip fails without the saver line).
@fairydreaming

Copy link
Copy Markdown

@SolshineCode Thanks! Piotr is currently on vacation, so I'm going to merge this directly to his kimi-k3-text branch.

@fairydreaming
fairydreaming merged commit d5ab207 into pwilkin:kimi-k3-text Aug 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants