Downloads · 30 days
15
9% of all-time downloads
MoistPotato/dsa-reasoning-coach-7b-lora
dsa-reasoning-coach-7b-lora is a text generation model from MoistPotato. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A LoRA adapter that turns Qwen2.5-7B-Instruct into a tutor that teaches you how to derive a Data Structures & Algorithms solution — observations, the bottleneck, the key insight, the pattern — instead of dumping the c…
Downloads · 30 days
15
9% of all-time downloads
All-time downloads
161
Public
Repo size
173 MB
Likes
0
Public
Click a slice to open those files.
.safetensors162 MB · 93%
From the Hugging Face model README
A LoRA adapter that turns Qwen2.5-7B-Instruct into a tutor that teaches you how to derive a Data Structures & Algorithms solution — observations, the bottleneck, the key insight, the pattern — instead of dumping the code.
Qwen/Qwen2.5-7B-InstructTwo behaviors are internalized by the fine-tune — they appear even with a minimal system
prompt ("You are a helpful DSA tutor."):
Held-out 16 problems, no schema in the prompt, greedy decoding, LLM-as-judge
(Cerebras gpt-oss-120b). Base = stock Qwen2.5-7B-Instruct with the same minimal prompt.
| Criterion | Base | Fine-tuned 7B | Δ |
|---|---|---|---|
| Format adherence (/2) | 0.00 | 1.94 | +1.94 |
| Insight correctness (/2) | 1.56 | 1.56 | +0.00 |
| Complexity correct (/2) | 0.44 | 1.50 | +1.06 |
| Answer not leaked (/1) | 0.00 | 1.00 | +1.00 |
| TOTAL (/7) | 2.00 | 6.00 | +4.00 |
With no schema in the prompt, the base model free-forms and dumps full code on all 16 problems; the fine-tune emits the teaching format and refuses code — a 3× total-score win, holding insight parity.
{full schema, minimal, none} so the behavior binds to the task, not the instruction text.
This is what makes the format + no-code-leak survive a minimal prompt at inference.import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
BASE = "Qwen/Qwen2.5-7B-Instruct"
ADAPTER = "MoistPotato/dsa-reasoning-coach-7b-lora"
tok = AutoTokenizer.from_pretrained(BASE)
model = AutoModelForCausalLM.from_pretrained(BASE, torch_dtype=torch.bfloat16).to("cuda")
model = PeftModel.from_pretrained(model, ADAPTER)
model = model.merge_and_unload() # optional: faster inference
model.eval()
messages = [
{"role": "system", "content": "You are a helpful DSA tutor."}, # minimal prompt on purpose
{"role": "user", "content": "Given a string, find the length of the longest substring "
"without repeating characters."},
]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True,
return_tensors="pt", return_dict=True).to("cuda")
out = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Apache-2.0 (matches the base model).