Sprout Qwen2.5 1.5B SFT LoRA
a fine-tuned adapter for tailoring answers to children of different ages
2 min read
The Sprout model is a LoRA adapter (a small add-on layer for a base model) for Qwen/Qwen2.5-1.5B-Instruct that adjusts the complexity and vocabulary of responses to match a specific child's age. The age range is set in the system prompt (ranging from 0-3 to 14-18 years old). The model was created as a generator for the Sprout agent, which uses Simple English Wikipedia search and safety filters. It helps parents and developers of children's applications explain complex topics at a level a child can easily understand.
Key features
- Age adaptation: accounts for reading levels across five age groups (from toddlers to teenagers).
- Fact integration: trained to work both with and without context from an external knowledge base.
- Metric improvements: increases the proportion of responses within two Flesch-Kincaid classes from 43.8% to 62.6% compared to the base model.
- Efficient training: LoRA rank 32, alpha 64 using TRL SFTTrainer and PEFT on a single T4 GPU.
What you can do
- Build a kids' chatbot: integrate into a Telegram bot or application to answer children's endless questions.
- Adjust difficulty levels: use in educational services to automatically simplify texts to match a student's age.
- Connect with search: link an external search (RAG) to answer factual questions relying on reliable sources.
Example
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct", torch_dtype="auto")
model = PeftModel.from_pretrained(base, "yxpan/sprout-qwen2.5-1.5b-sft-lora")
tok = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct")
messages = [
{"role": "system", "content": "You are talking to a child aged 7-9. Generate a friendly response with age-appropriate knowledge."},
{"role": "user", "content": "Why is the sky blue?"},
]
ids = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt")
out = model.generate(ids, max_new_tokens=160, do_sample=True, temperature=0.3, top_p=0.9, top_k=30, repetition_penalty=1.05)
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True))Read more
Details• Base model: Qwen/Qwen2.5-1.5B-Instruct
• Training: rank 32, alpha 64, dropout 0.1, lr 1e-4, 350 steps, batch 4, fp16, single T4 GPU
• Dataset: yxpan/children_sft_dataset_v2 (700 rows)
• Metrics: Flesch-Kincaid match 62.6% (vs. 43.8% for the base), BERTScore-F1 0.890
• Limitations: English only, may produce factual errors (about 1 error per 6-7 responses), does not replace a safety and filtering system










Comments