Base: DeepSeek-Math-7B (5,500 steps pre-trained)
↓
LoRA Fine-tuning
- Rank: 64
- Alpha: 128
- Target: All attention + MLP layers
- Trainable params: 149.9M (2.12% of 7.06B)
↓
Phase 1 Output: Text-only model
1 Batch size : 16 ( per device )
2 Gradient accumulation : 4
3 Effective batch : 64
4 Learning rate : 1e-4 → 3.8e-10 ( cosine decay )
5 Optimizer : AdamW 8 - bit
6 Max sequence length : 4096
7 Precision : bfloat16
1 from transformers import AutoModelForCausalLM , AutoTokenizer
2
3 model_path = "sid172002/deepseek-math-7b-rl-phase1"
4 model = AutoModelForCausalLM . from_pretrained (
5 model_path ,
6 torch_dtype = torch . bfloat16 ,
7 device_map = "auto"
8 )
9 tokenizer = AutoTokenizer . from_pretrained ( model_path )
10
11 # Inference
12 problem = "Find the sum of 1 + 2 + ... + 100"
13 prompt = f"### Problem: { problem } \n### Solution:"
14 inputs = tokenizer ( prompt , return_tensors = "pt" ) . to ( model . device )
15 outputs = model . generate ( ** inputs , max_new_tokens = 512 , temperature = 0.3 )
16 response = tokenizer . decode ( outputs [ 0 ] , skip_special_tokens = True )
Phase 1 Output (Text)
↓
+ CLIP Vision Encoder (frozen)
+ Projection Layer (trainable)
+ 5,000 Vision Problems
↓
Phase 2 Output (Multimodal)
deepseek-math-phase1-final/
├── final/
│ ├── adapter_model.safetensors (572 MB)
│ ├── adapter_config.json
│ ├── tokenizer.json
│ └── README.md
├── checkpoint-15000/
├── checkpoint-16000/
└── checkpoint-17000/
1 @misc{deepseek-math-phase1,
2 title={DeepSeek-Math-7B-RL-Phase1: Fine-tuned on 379K International Math Problems},
3 author={sid172002},
4 year={2026},
5 howpublished={HuggingFace Model Hub}
6 }