Dolphin3.0-Llama3.1-8B r0b0tlab distill LoRA
reasoning-then-answer adapter
2 min read
This LoRA adapter (a small add-on for a base model) trains the dphn/Dolphin3.0-Llama3.1-8B model to use a reasoning-then-answer style before replying. During generation, the model adds a thinking block to its answers, helping it handle logic and math problems more accurately. Built on distilled traces, this adapter is designed for developers experimenting with chain-of-thought reasoning in language models.
Key features
- Adds a reasoning style before the answer to improve logical capabilities.
- Shows validation accuracy increasing from 0.5312 to 0.6146 in tests.
- Trained on 7,000 rows from a distillation dataset with single tool-free prompts.
- Uses LoRA parametrization r=16, alpha=32, training all 7 projections.
What you can do
- Apply the adapter on top of the base model using the
peftlibrary to generate structured responses. - Test the quality of logical reasoning and math calculations in your own tasks.
- Run validation tests to evaluate accuracy gains on specific prompts.
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = "dphn/Dolphin3.0-Llama3.1-8B"
tok = AutoTokenizer.from_pretrained("Simplyfly95/Dolphin3.0-Llama3.1-8B-r0b0tlab-distill-lora")
model = PeftModel.from_pretrained(AutoModelForCausalLM.from_pretrained(base, dtype="bfloat16"), "Simplyfly95/Dolphin3.0-Llama3.1-8B-r0b0tlab-distill-lora")
msgs = [{"role": "user", "content": "..."}]
inputs = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt", return_dict=True)
print(tok.decode(model.generate(**inputs.to(model.device), max_new_tokens=512)[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Example
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = "dphn/Dolphin3.0-Llama3.1-8B"
tok = AutoTokenizer.from_pretrained("Simplyfly95/Dolphin3.0-Llama3.1-8B-r0b0tlab-distill-lora")
model = PeftModel.from_pretrained(AutoModelForCausalLM.from_pretrained(base, dtype="bfloat16"), "Simplyfly95/Dolphin3.0-Llama3.1-8B-r0b0tlab-distill-lora")
msgs = [{"role": "user", "content": "..."}]
inputs = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt", return_dict=True)
print(tok.decode(model.generate(**inputs.to(model.device), max_new_tokens=512)[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))Read more
DetailsBenchmarks: accuracy on 96 validation rows increased from 0.5312 to 0.6146.
Hardware and VRAM: peak usage reached 22.5 GB on a single A100-80GB accelerator.
Limitations: the model always outputs a reasoning block; there is no short-answer mode.
Training details: 300 steps, learning rate 1e-4 with a cosine scheduler.










Comments