Llama-3.1-8B-Instruct Math Rft Gold
LoRA for Math Problem Solving
2 min readupdated
This LoRA adapter (a small add-on built on top of the base model) is based on meta-llama/Llama-3.1-8B-Instruct and trained using rejection-sampling fine-tuning on a training split of the MATH dataset. The model specializes in step-by-step mathematical problem-solving with outputs delivered in a dedicated format. It features improved results on the MATH-500 benchmark thanks to the curation of high-quality training examples. The adapter will come in handy for researchers and developers looking to boost the accuracy of a language model in mathematical computations.
Key features
- Trained on 2,000 tasks from the MATH dataset using the golden standard of sample selection.
- Uses a LoRA rank of r=16 and alpha=32 for all linear projections.
- Boosts accuracy on the MATH-500 benchmark to 53.2% compared to 49.2% for the base model.
- Fully compatible with the
peftlibrary for working withbf16weights.
What you can do
- Apply the adapter on top of the
meta-llama/Llama-3.1-8B-Instructbase model to generate step-by-step math solutions. - Use the model in educational projects for checking and breaking down complex word problems.
- Integrate it into Telegram bots or assistants helping students with math.
Example
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct", torch_dtype="bfloat16")
model = PeftModel.from_pretrained(base, "Jongbin-kr/llama3.1-8b-instruct_math_RFT-gold_k10_lora-r16a32_lr1e-4_ep3_n2000")
tok = AutoTokenizer.from_pretrained("meta-llama/Llama-3.1-8B-Instruct")
Read more
DetailsEvaluation results: accuracy on MATH-500 increased to 53.2% (base model: 49.2%).
Dataset: 1,761 examples with 100% data accuracy after filtering.
Training: 3 epochs, lr 1e-4 cosine, batch size 32, bf16.
License: Llama 3.1 Community License.










Comments