Views
No views yet
deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5Bagentica-org/DeepCoder-1.5B-PreviewRLinf/RLinf-math-1.5Bmobiuslabsgmbh/DeepSeek-R1-ReDistill-Qwen-1.5B-v1.1MATH-500 Level 4/5, LeetCodeDataset, and Mixture-of-Thoughts), we extracted the first-order Taylor expansion approximations of parameter sensitivity via backpropagation. We combined this with $L_2$ cross-task logit alignment to generate temperature-scaled Softmax routing coefficients ($\sigma_i^l$) for every parameterized layer $l$. This guarantees that the Code model dominates syntax layers while the Math model dominates logical reasoning layers.<think> tags for complex reasoning.1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4model_id = "ForSureTesterSim/Qwen2.5-R1-Minny-1.5B-v2"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.bfloat16,
10 device_map="auto"
11)
12
13prompt = """Solve the following problem using Python.
14First, explain the mathematical theory behind finding the nth Fibonacci number in O(log n) time using matrix exponentiation.
15Then, write a highly optimized Python function to implement it. Provide your reasoning inside a <think> block."""
16
17messages = [{"role": "user", "content": prompt}]
18text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
19inputs = tokenizer([text], return_tensors="pt").to(model.device)
20
21with torch.no_grad():
22 outputs = model.generate(
23 **inputs,
24 max_new_tokens=1024,
25 temperature=0.6,
26 do_sample=True
27 )
28
29print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=False))