An updated attempt at distilling Claude Opus 4.6/4.7 reasoning traces into a small-form-factor model. The predecessor
Llama 3.2 1B Claude Opus Reasoning Distill demonstrated that a 1B model could adopt
<think> blocks but suffered from echolalia and a GSM8K regression. This run addresses the two root causes identified from that experiment:
The LoRA adapter is available separately — load it on top of the base model without downloading the full merged weights.
1from unsloth import FastLanguageModel
2from transformers import AutoTokenizer, TextStreamer
3from peft import PeftModel
4
5ADAPTER_PATH = "codestrate/Llama3.2-3B-Claude-Reasoning-Distill"
6
7model, _ = FastLanguageModel.from_pretrained(
8 model_name="unsloth/Llama-3.2-3B-Instruct-bnb-4bit",
9 load_in_4bit=True,
10 max_seq_length=2048,
11)
12tokenizer = AutoTokenizer.from_pretrained(ADAPTER_PATH) # vocab=128258
13model.resize_token_embeddings(len(tokenizer))
14model = PeftModel.from_pretrained(model, ADAPTER_PATH)
15FastLanguageModel.for_inference(model)
16
17SYSTEM_PROMPT = "You are a helpful assistant. Think step by step inside <think>...</think> before giving your final answer."
18messages = [
19 {"role": "system", "content": SYSTEM_PROMPT},
20 {"role": "user", "content": "Write a Python function to check if a number is prime."},
21]
22inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cuda")
23
24streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
25_ = model.generate(
26 input_ids=inputs,
27 streamer=streamer,
28 max_new_tokens=1024,
29 temperature=0.7,
30 min_p=0.1,
31 repetition_penalty=1.3,
32 no_repeat_ngram_size=6,
33 use_cache=True,
34)
A Modelfile is included for Ollama. For direct use:
angrygiraffe/claude-opus-4.6-4.7-reasoning-8.7k —
instruct_train.jsonl split (full instruct + reasoning, ~7,700 examples). Data already in OpenAI messages format; mapped directly through
apply_chat_template with no additional preprocessing.
Drop: 2.14 → 1.74 (~0.40 absolute). Visible cross-epoch improvement at step ~452 (−0.082). Plateau reached in epoch 2 from step 750 — a third epoch would not have been beneficial on this dataset.