Downloads · 30 days
7
6% of all-time downloads
eurecom-ds/qwen3-4b-socratic
qwen3-4b-socratic is a machine learning model from eurecom-ds. 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 mit.
Using Large Language Models (LLMs) in education presents unique challenges. Typically, LLMs are designed to provide direct answers to questions, which can hinder students' critical thinking and self-discovery skills.…
Downloads · 30 days
7
6% of all-time downloads
All-time downloads
110
Public
Repo size
1.1 GB
Likes
2
Public
Click a slice to open those files.
.safetensors1.1 GB · 100%
From the Hugging Face model README
Using Large Language Models (LLMs) in education presents unique challenges. Typically, LLMs are designed to provide direct answers to questions, which can hinder students' critical thinking and self-discovery skills. To address this, we focus on fine-tuning LLMs to facilitate Socratic interactions. Instead of giving straightforward answers, these models guide students to explore and find the answers themselves. We achieve this through Supervised Fine-Tuning (SFT) Qwen3:4b with a LoRA adapter over 754 successiful socratic conversations (or 7384 conversation turns) generated with socratic-bench.
SFT traces available at socratic-bench/datasets/positive-traces.
You need to install unsloth (see Docs).
import torch
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="eurecom-ds/qwen3-4b-socratic",
dtype=torch.bfloat16,
max_seq_length=1024,
load_in_4bit=False,
load_in_8bit=False,
)
model = FastLanguageModel.for_inference(model)
# ✅ Patch apply_chat_template to default enable_thinking=False
if hasattr(tokenizer, "apply_chat_template"):
original_fn = tokenizer.apply_chat_template
def patched_apply_chat_template(conversation, **kwargs):
kwargs.setdefault("enable_thinking", False)
return original_fn(conversation, **kwargs)
tokenizer.apply_chat_template = patched_apply_chat_template
messages = [
{"role": "user", "content": "why is the sky blue?"},
]
raw_prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True, enable_thinking=False
)
inputs = tokenizer([raw_prompt], return_tensors="pt").to("cuda")
outputs = model.generate(
**inputs, max_new_tokens=128, do_sample=True, temperature=0.3
)
generation = outputs[0, len(inputs['input_ids'][0]):]
decoded = tokenizer.decode(generation, skip_special_tokens=True)
print(decoded)
# Have you ever looked at the sky on a clear day and wondered why it appears blue? What do you think might be happening with the light from the sun that makes the sky look that way?