r/LocalLLaMA • u/ramendik • Feb 02 '26
Discussion Kimi distillation attempt
So the question of a "small Kimi" arises time and time again. And at least once Moonshot said they would welcome community distills: https://github.com/MoonshotAI/Kimi-K2/issues/16 . Sadly I keep missing AMAs to ask their present view of community distills.
I've been interested in the topic for a while, and for the last couple of months was actually trying to do it. I could probably do a lot better, so I'll outline what went on, and the end of the post has a link to my test checkpoint - suggestions of what to change in my process are very mush welcome as is any feedback on the checkpoint. I would also love to learn about other distill projects; so far I know of one, a part of a CoT distill set of leading thinking models: https://huggingface.co/TeichAI/Qwen3-8B-Kimi-K2-Thinking-Distill . Compared to what I am trying to do, it seems more technical-oriented and also sources Kimi K2 Thinking while my favourite is K2 Instruct 0905 (never tried the non-0905 though).
To make mistakes cheap (this is my first model trainjing project) and to ensure the result runs on anything, I picked a very small first target/student model, Granite 4.0 hybrid 1B (really 1.5B). It's actually one heck of a 1B, trained on 15T tokens from scratch - not a sequential distill of something bigger like the Gemma and Qwen examples in this size. Granite's expression style is very neutral and quite constrained (it ignores style/persona instructions in the system prompt); but that also means one is not fighting an existing "vibe" when implanting a new one. The Mamba-hybrid nature means it can scale to longer contexts withoug choking, even when running on CPU.
There's the big question of what one is distilling for; I went for vibe/style/conversation (with roleplay a potential addition at a later stage), but of course there are other options. And from there one gets to "where to get the prompts for generation". The best I could think of was to grab user prompts off existing datasets.
First I generated a max_seq_len 6000 dataset of Kimi K2 Instruct 0905 answers - including some seriously strong prose, based on prompts from https://huggingface.co/datasets/HuggingFaceTB/smoltalk-multilingual8-Qwen3-32B-main-gen (advice seeking category) and the magpie-ultra source in main Smoltalk. I worked out a Qwen-based pipeline to detect typical hallucinations and also to find facts that need verification; I used Gemini 2.5 Flash with grounding to verify the facts and dropped the lines with wrong or dubious claims. https://huggingface.co/datasets/ramendik/kimify-20251115
Unfortunately, after *a lot* of checkpoints it turned out that such long form won't fly with a 1.5B, at least immediately. The result was always too prone to looping (somehow, ifeval at t=0 is a good looping tendency detector and I have a script that specifically checks for loops and counts them; Granite 4.0 h 1b has <20 loops in ifeval while the long-form trained checkpoionts resulted in around 50).
While training on that dataset and trying to defeat the instabilty, I found a training algorithm, CorDA KPM https://huggingface.co/docs/peft/v0.18.0/en/developer_guides/lora#corda , that makes things much more stable. As the "knowledge" dataset I just use tool calls (a random subset of the xLAM dataset, reformatted for Granite - can publish if there's any need for it); this lets me avoid locking in Granite's style. While it made things better, I eventually had to give up on the long-form dataset, at least for the first stage.
So I generated a larger dataset of smaller answers, using a system prompt to make Kimi birfer but still quite punchy. The typical hallucination filter and fact verifier happened again, and I also filtered out entries where any one assistant message is over 1000 Granite tokens. https://huggingface.co/datasets/ramendik/kimify-short-20260131
I also wanted to buttress instruction following but not to benchmax for ifeval, so I never used ifeval prompts but instead took prompts from https://huggingface.co/datasets/HuggingFaceH4/ifeval-like-data - then verified the results of Kimi's generation against the constraints. The result is https://huggingface.co/datasets/ramendik/kimify-ifeval-like
My hope is to get a good first checkpoint that has picked up at least the basics of Kimi's stype - and then expand my CorDA KPM dataset with actual text generation in the new style. I would hope that, with the basic style and the new CorDA KPM dataset in place, I can train the next checkpoint on longer samples and on actual multiturn conversations (generated with a red-teaming model). For now it's short-ish single-turn advice-seeking answers and three-turn magpie-ultra-short answers.
So, I made my candidate "stage 1" checkpoint. Unlike baselike Granite, it does change its style on system prompts - this is an emergent behaviour, my dataset has no system prompts. So please test with different system prompts; if you don't supply a system prompt, the Granite tokenizer uses a default one that dampens things a bit (or should I cut that out of the tokenizer?). With the larger dataset, the emergent system prompt plasticity was more pronounced and when "creative" was requested the style got quite exuberant - but the loops made me pull away; I am hoping to bring that back in stage 2 with a "fatter" CorDA KPM.
(I named the project "Miki" and the 1B size "pebble" - there are suitable Granite models for "cobble" and "boulder" but I want to polish the technique on "pebble" first).
The hyperparameters I used - CorDA KPM, r=128 a=256, target_modules = ["q_proj", "k_proj", "v_proj", "o_proj", "mamba.in_proj", "mamba.out_proj"] (but notably not the MLP layers - targeting those somehow dilutes any styke impact significantly), Muon optimizer (somehow better on the style), LR=1.5e-5. These gave the best result out of a rather large sweep.
This candidate checkpoint is at https://huggingface.co/ramendik/miki-pebble-20260131 - that's the GGUFs in BF16 and Q8_0 ; if anyone actually needs a lower quant at this size please tell me and I'll bother with the imatrix thing. There is a safetensors version too, at https://huggingface.co/ramendik/miki-pebble-20260131-safetensors .
Again, feedback very much appreciated, *especially* what I can do better. Better sources of prompts, anything really. (One thing I'm not changing is the general style/writing/conversational direction; I just don't think I know enough to do a coding or agentic oriented distill). And links to other Kimi distill projects are very welcome too.
P.S. Yeah, I did use a Nano-GPT subscription for the mass-generation waves. It really did a lot to help me afford it.
2
u/nomorebuttsplz Mar 18 '26
Came here to say the original K2 instruct has such a good personality for an assistant bot. Logical, succinct, precise, undefensive, huge vocabulary, I would even say nice prose (for non-fiction topics: its brain turns off for fiction).
Any progress with this?
4
u/Firepal64 Feb 03 '26
Damn, not half-bad for a 1B distill. It's not very smart but it's got the style better than that other Thinking distill. Could probably use it as an "answer reworder" output filter for a bigger model lol
2
u/ClimateBoss llama.cpp Feb 02 '26
distill into qwen3 coder 30b a3b then its useful
1
u/kouteiheika Feb 03 '26
You might need some stronger filtering, or regenerate the answers with lower temperature and/or min_p set. I clicked entirely at random on the
kimify-20251115dataset and saw this:I assume the random "夜间" in there is not intended?
That's not surprising; Muon essentially has higher per-token efficiency than Adam, so you get "more data" out of your data.
How do you measure this? Just by eyeballing? Have you checked whether the "vibes" you get from whatever the model generates are correlated (and improve) along with the loss measured on a held-out evaluation set also generated by Kimi?