Llama Fine-Tuned Spanish
Bilingual Reasoning Model for English-to-Spanish Mathematical Problem Solving
Bilingual Reasoning Model for English-to-Spanish Mathematical Problem Solving
Llama-2-7B-Chat
NousResearch
LoRA Adapters
200 Examples
10 Epochs
English → Spanish
Reasoning Tasks
Step-by-Step
The Llama Fine-Tuned Spanish model is a specialized adaptation of NousResearch/llama-2-7b-chat-hf, designed specifically for solving reasoning-heavy mathematical problems in English and providing detailed, step-by-step solutions in Spanish. This bilingual approach makes it ideal for educational purposes and cross-language mathematical reasoning tasks.
Built using LoRA (Low-Rank Adaptation) fine-tuning with 4-bit quantization, the model is optimized for deployment in resource-constrained environments like Kaggle while maintaining high performance for mathematical reasoning tasks including speed/distance/time problems, geometry, and logic puzzles.
The model employs LoRA (Low-Rank Adaptation) fine-tuning on top of the Llama-2-7B base model, utilizing BitsAndBytesConfig for 4-bit quantization with NF4 quantization type and float16 compute dtype. This approach significantly reduces memory requirements while maintaining model performance for the specialized reasoning tasks.
Training was conducted on Kaggle's GPU infrastructure using a carefully curated dataset of 200 training examples and 20 validation examples. The training process utilized Paged AdamW optimizer with gradient accumulation and a maximum sequence length of 512 tokens, ensuring comprehensive coverage of mathematical reasoning patterns.
The model demonstrates strong performance on standard mathematical reasoning problems, correctly solving speed/distance/time problems such as calculating average speeds for multi-segment journeys. Training over 10 epochs with an effective batch size of 8 achieved convergence on the validation dataset with minimal overfitting.
Performance evaluation shows accurate step-by-step solutions for familiar problem types, though the model may struggle with complex multi-step problems or scenarios significantly different from training patterns. The 4-bit quantization maintains solution quality while enabling deployment on resource-constrained hardware with approximately 1-2 hour training time.
LoRA fine-tuning pipeline with 4-bit quantization for efficient bilingual reasoning model development
Curated dataset of 200 English mathematical problems with step-by-step Spanish solutions
Load base Llama-2-7B model with 4-bit quantization and LoRA adapters
Configure Parameter Efficient Fine-Tuning with LoRA adapters for targeted layer updates
Fine-tune with Paged AdamW optimizer over 10 epochs with gradient accumulation
Assess model performance on mathematical reasoning tasks with bilingual output validation
Push fine-tuned model to Hugging Face Hub for easy access and inference
Successfully processes English mathematical problems and generates detailed step-by-step solutions in Spanish
LoRA fine-tuning with 4-bit quantization enables training on resource-constrained hardware in 1-2 hours
Designed specifically for educational purposes with structured, pedagogical approach to mathematical explanation
Available on Hugging Face Hub with comprehensive documentation and easy integration for researchers and educators
Access the model, documentation, and implementation details for bilingual mathematical reasoning