FastLlama is a highly optimized version of the Llama-3.2-1B-Instruct model. Designed for superior performance in constrained environments, it combines speed, compactness, and high accuracy. This version has been fine-tuned using the MetaMathQA-50k section of the HuggingFaceTB/smoltalk dataset to enhance its mathematical reasoning and problem-solving abilities.
Features:
Lightweight and Fast: Optimized to deliver Llama-class capabilities with reduced computational overhead.
Fine-Tuned for Math Reasoning: Utilizes MetaMathQA-50k for better handling of complex mathematical problems and logical reasoning tasks.
Instruction-Tuned: Pre-trained on instruction-following tasks, making it robust in understanding and executing detailed queries.
Versatile Use Cases: Suitable for educational tools, tutoring systems, or any application requiring mathematical reasoning.
Performance Highlights:
Smaller Footprint: The model delivers comparable results to larger counterparts while operating efficiently on smaller hardware.
Enhanced Accuracy: Demonstrates improved performance on mathematical QA benchmarks.
Instruction Adherence: Retains high fidelity in understanding and following user instructions, even for complex queries.
Loading the Model:
py
1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
3from peft import PeftModel, PeftConfig
45base_model_id ="meta-llama/Llama-3.2-1B-Instruct"# Base model ID6adapter_id ="suayptalha/FastLlama-3.2-LoRA"# Adapter ID78tokenizer = AutoTokenizer.from_pretrained(base_model_id)9base_model = AutoModelForCausalLM.from_pretrained(10 base_model_id,11 torch_dtype=torch.bfloat16,12 device_map="auto"13)1415model = PeftModel.from_pretrained(base_model, adapter_id)1617# Text generation pipeline18pipe = pipeline(19"text-generation",20 model=model,21 tokenizer=tokenizer,22 device_map="auto",23)2425messages =[26{"role":"system","content":"You are a friendly assistant named FastLlama."},27{"role":"user","content":"Who are you?"},28]2930outputs = pipe(31 messages,32 max_new_tokens=256,33)3435print(outputs[0]["generated_text"][-1])
Dataset:
Dataset: MetaMathQA-50k
The MetaMathQA-50k subset of HuggingFaceTB/smoltalk was selected for fine-tuning due to its focus on mathematical reasoning, multi-step problem-solving, and logical inference. The dataset includes: