Downloads · 30 days
6
6% of all-time downloads
Beebey/qwen-coder-1.5b-educational
qwen-coder-1.5b-educational is a machine learning model from Beebey. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
Downloads · 30 days
6
6% of all-time downloads
All-time downloads
106
Public
Repo size
20.2 MB
Likes
0
Public
Click a slice to open those files.
.json14.2 MB · 70%
From the Hugging Face model README
Qwen2.5-Coder-1.5B-Educational is a LoRA adapter fine-tuned on the Qwen2.5-Coder-1.5B-Instruct base model, specifically optimized for educational code generation in Python. This model excels at producing clear, well-documented, and pedagogically sound code examples.
⚠️ Model Updated: Now using checkpoint-500 (best performing on HumanEval benchmarks)
| Metric | Score | Comparison |
|---|---|---|
| Pass@1 | 64.0% | vs 65-70% base model |
| Problems Passed | 105/164 | Excellent generalization |
| Training Loss | 0.5695 | Optimal convergence |
| Training Steps | 500 | Best checkpoint |
After rigorous evaluation across multiple checkpoints, checkpoint-500 emerged as the optimal choice:
| Checkpoint | Steps | Final Loss | HumanEval Pass@1 | Verdict |
|---|---|---|---|---|
| checkpoint-500 | 500 | 0.5695 | 64.0% | ✅ Selected |
| checkpoint-2000 | 2000 | 0.5300 | 57.3% | ❌ Overfitted |
Key Insights:
pip install transformers peft torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model and adapter
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-Coder-1.5B-Instruct",
device_map="auto",
torch_dtype="auto"
)
model = PeftModel.from_pretrained(
base_model,
"Beebey/qwen-coder-1.5b-educational"
)
tokenizer = AutoTokenizer.from_pretrained(
"Beebey/qwen-coder-1.5b-educational"
)
# Generate code
prompt = "Instruction: Write a Python function to check if a number is prime\nRéponse:\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=200,
temperature=0.7,
top_p=0.9,
do_sample=True
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# For more deterministic outputs
outputs = model.generate(
**inputs,
max_new_tokens=300,
temperature=0.2,
top_p=0.95,
repetition_penalty=1.1,
do_sample=True
)
# For creative/exploratory code
outputs = model.generate(
**inputs,
max_new_tokens=400,
temperature=0.9,
top_k=50,
do_sample=True
)
{
"r": 8,
"lora_alpha": 16,
"lora_dropout": 0.05,
"target_modules": ["q_proj", "v_proj"],
"task_type": "CAUSAL_LM"
}
educational_instruct# Hyperparameters
learning_rate = 2e-4
warmup_steps = 50
max_steps = 500
per_device_train_batch_size = 16
gradient_accumulation_steps = 4
effective_batch_size = 1024
# Optimization
optimizer = "adamw_torch_xla"
lr_scheduler = "cosine"
weight_decay = 0.01
# Model Settings
sequence_length = 256
precision = "bfloat16"
The model was evaluated on the complete HumanEval benchmark (164 programming problems):
This demonstrates that the educational fine-tuning maintains strong algorithmic correctness while improving code clarity and documentation.
This model is released under the Apache 2.0 License.
Copyright 2025 Beebey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
If you use this model in your research or applications, please cite:
@misc{qwen-coder-educational-2025,
author = {Beebey},
title = {Qwen2.5-Coder-1.5B-Educational: A LoRA Adapter for Educational Code Generation},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/Beebey/qwen-coder-1.5b-educational}},
note = {Fine-tuned on OpenCoder educational instruction dataset}
}
Made with ❤️ for the educational coding community
</div>