Enhanced model card with variance data, reproduction instructions, and context
Browse files
README.md
CHANGED
|
@@ -5,6 +5,7 @@ tags:
|
|
| 5 |
- humaneval
|
| 6 |
- codeforces
|
| 7 |
- lora
|
|
|
|
| 8 |
base_model: Qwen/Qwen3-0.6B
|
| 9 |
datasets:
|
| 10 |
- open-r1/codeforces-cots
|
|
@@ -12,7 +13,7 @@ datasets:
|
|
| 12 |
|
| 13 |
# Qwen3-0.6B Fine-tuned on Codeforces-CoTS (Python)
|
| 14 |
|
| 15 |
-
Fine-tuned using SFT on the **solutions_py** subset of `open-r1/codeforces-cots`.
|
| 16 |
|
| 17 |
## Results on HumanEval
|
| 18 |
|
|
@@ -20,14 +21,51 @@ Fine-tuned using SFT on the **solutions_py** subset of `open-r1/codeforces-cots`
|
|
| 20 |
|-------|-------|-----------------|
|
| 21 |
| Base (Qwen3-0.6B) | 40.24% | 66/164 |
|
| 22 |
| **Fine-tuned** | **40.85%** | **67/164** |
|
| 23 |
-
| **Improvement** | **+0.61%** | **+1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
## Training Details
|
| 26 |
|
| 27 |
-
- **Dataset**: open-r1/codeforces-cots (solutions_py subset) - 500 examples
|
| 28 |
-
- **Method**: LoRA (r=8, alpha=16)
|
| 29 |
- **Steps**: 150
|
| 30 |
- **Learning Rate**: 5e-6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
## Usage
|
| 33 |
|
|
@@ -36,4 +74,23 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
| 36 |
|
| 37 |
model = AutoModelForCausalLM.from_pretrained("passagereptile455/qwen3-humaneval-sft")
|
| 38 |
tokenizer = AutoTokenizer.from_pretrained("passagereptile455/qwen3-humaneval-sft")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
- humaneval
|
| 6 |
- codeforces
|
| 7 |
- lora
|
| 8 |
+
- sft
|
| 9 |
base_model: Qwen/Qwen3-0.6B
|
| 10 |
datasets:
|
| 11 |
- open-r1/codeforces-cots
|
|
|
|
| 13 |
|
| 14 |
# Qwen3-0.6B Fine-tuned on Codeforces-CoTS (Python)
|
| 15 |
|
| 16 |
+
Reproduction of [Ben Burtenshaw's HuggingFace fine-tuning challenge](https://x.com/ben_burtenshaw/status/1871606555461214584) (Claude Code vs Codex). Fine-tuned using SFT on the **solutions_py** subset of `open-r1/codeforces-cots`.
|
| 17 |
|
| 18 |
## Results on HumanEval
|
| 19 |
|
|
|
|
| 21 |
|-------|-------|-----------------|
|
| 22 |
| Base (Qwen3-0.6B) | 40.24% | 66/164 |
|
| 23 |
| **Fine-tuned** | **40.85%** | **67/164** |
|
| 24 |
+
| **Improvement** | **+0.61%** | **+1 problem** |
|
| 25 |
+
|
| 26 |
+
### Variance Across Runs
|
| 27 |
+
|
| 28 |
+
Same script, same hardware, 3 parallel runs:
|
| 29 |
+
|
| 30 |
+
| Run | Score | Result |
|
| 31 |
+
|-----|-------|--------|
|
| 32 |
+
| 1 | 40.85% | Win (+1) |
|
| 33 |
+
| 2 | 40.24% | Tie |
|
| 34 |
+
| 3 | 39.63% | Loss (-1) |
|
| 35 |
+
|
| 36 |
+
Fine-tuning has randomness. Multiple attempts are expected.
|
| 37 |
+
|
| 38 |
+
## Key Insight
|
| 39 |
+
|
| 40 |
+
The default `codeforces-cots` dataset is ~90% C++. Training on it for a Python benchmark (HumanEval) hurt performance in early attempts. Using the `solutions_py` subset doubled the baseline from ~18% to 40%.
|
| 41 |
+
|
| 42 |
+
**Domain alignment > data quantity.**
|
| 43 |
|
| 44 |
## Training Details
|
| 45 |
|
| 46 |
+
- **Dataset**: `open-r1/codeforces-cots` (`solutions_py` subset) - 500 examples
|
| 47 |
+
- **Method**: LoRA (r=8, alpha=16, dropout=0.05)
|
| 48 |
- **Steps**: 150
|
| 49 |
- **Learning Rate**: 5e-6
|
| 50 |
+
- **Batch Size**: 2 (gradient accumulation: 4)
|
| 51 |
+
- **Hardware**: a10g-small (~$0.75/hr)
|
| 52 |
+
- **Runtime**: ~1 hour
|
| 53 |
+
|
| 54 |
+
## Reproduction
|
| 55 |
+
|
| 56 |
+
1. Get a HuggingFace Pro account
|
| 57 |
+
2. Set `HF_TOKEN` as a secret
|
| 58 |
+
3. Run:
|
| 59 |
+
|
| 60 |
+
```bash
|
| 61 |
+
hf jobs uv run \
|
| 62 |
+
--flavor a10g-small \
|
| 63 |
+
--timeout 14400 \
|
| 64 |
+
--secrets HF_TOKEN \
|
| 65 |
+
"https://huggingface.co/passagereptile455/training-scripts/resolve/main/train_humaneval_clean.py"
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
Script: [passagereptile455/training-scripts](https://huggingface.co/passagereptile455/training-scripts)
|
| 69 |
|
| 70 |
## Usage
|
| 71 |
|
|
|
|
| 74 |
|
| 75 |
model = AutoModelForCausalLM.from_pretrained("passagereptile455/qwen3-humaneval-sft")
|
| 76 |
tokenizer = AutoTokenizer.from_pretrained("passagereptile455/qwen3-humaneval-sft")
|
| 77 |
+
|
| 78 |
+
messages = [{"role": "user", "content": "Write a Python function to check if a number is prime"}]
|
| 79 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 80 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 81 |
+
outputs = model.generate(**inputs, max_new_tokens=256)
|
| 82 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 83 |
```
|
| 84 |
+
|
| 85 |
+
## Debugging Notes
|
| 86 |
+
|
| 87 |
+
What broke along the way (5 attempts total):
|
| 88 |
+
- TRL API changed: `processing_class` not `tokenizer`
|
| 89 |
+
- Auth changed: `HfApi(token=)` not `login()`
|
| 90 |
+
- Upload: Need to pass `token=` to `push_to_hub()` explicitly
|
| 91 |
+
|
| 92 |
+
Most time was spent on infrastructure debugging, not ML.
|
| 93 |
+
|
| 94 |
+
## Acknowledgments
|
| 95 |
+
|
| 96 |
+
Based on [Ben Burtenshaw's challenge](https://x.com/ben_burtenshaw/status/1871606555461214584) comparing Claude Code vs Codex for fine-tuning tasks.
|