This is a causal language model fine‑tuned to generate conceptual explanations in the style of Richard Feynman, using supervised learning on curated prompt–completion pairs. It serves as a strong pedagogical baseline before any reinforcement learning stage.
“KhushalM/Qwen2.5-1.5-SFT-Merged” is built on top of the Qwen/Qwen2.5-1.5B-Instruct base. It was supervised‑finetuned on approximately 750 high‑quality prompt–completion pairs designed to replicate the Feynman teaching approach: simple, first‑principles explanations with concrete analogies, layered structure, and occasional comprehension checks. After finetuning, LoRA adapters were merged for streamlined inference.
1from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
2
3model_id = "KhushalM/Qwen2.5-1.5-SFT-Merged"
4tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
5model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", trust_remote_code=True)
6
7generator = pipeline(
8 "text-generation",
9 model=model,
10 tokenizer=tokenizer,
11 device="cuda" # or device="cpu"
12)
13
14prompt = "Explain the concept of entropy from first principles."
15output = generator(prompt, max_new_tokens=180, temperature=0.7, top_p=0.9)
16print(output[0]["generated_text"])