TinyLlama 1.1B Chat - GSM8K Math LoRA Adapter

This is a Low-Rank Adaptation (LoRA) adapter for TinyLlama/TinyLlama-1.1B-Chat-v1.0, fine-tuned on a subset of the GSM8K (Grade School Math) dataset. It has been trained to answer mathematical word problems using instruction-response formatting.

Model Details

Training Hyperparameters

  • LoRA Rank (r): 8
  • LoRA Alpha: 16
  • LoRA Dropout: 0.05
  • Target Modules: q_proj, v_proj
  • Batch Size: 4 (with Gradient Accumulation Steps = 4, effective batch size = 16)
  • Learning Rate: 1e-3
  • Epochs: 50
  • Precision: FP16 Mixed Precision
  • Max Sequence Length: 256 tokens

Training Results & Metrics

  • Global Steps: 650
  • Final Training Loss: ~0.2268
  • Training Runtime: 1434.66 seconds (24 minutes)
  • Samples per second: 6.97

Prompt Template

The model was fine-tuned using the following prompt template:

### Instruction:
{question}
### Response:
{answer}

How to Use

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base_model_name = "TinyLlama/TinyLlama-1.1B-Chat-v1.0"
adapter_name = "jhaveribhavya/tinyllama-math-lora-tuned-adapter"

# Load Base Model and Tokenizer
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
model = AutoModelForCausalLM.from_pretrained(
    base_model_name,
    torch_dtype=torch.float16,
    device_map="auto"
)

# Load and Merge LoRA Adapter
model = PeftModel.from_pretrained(model, adapter_name)

# Generate a response
instruction = "Weng earns $12 an hour for babysitting. Yesterday, she babysat for 5 hours. How much money did she earn?"
prompt = f"### Instruction:
{instruction}
### Response:
"

inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Downloads last month
34
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for jhaveribhavya/tinyllama-math-lora-tuned-adapter

Adapter
(1,626)
this model

Dataset used to train jhaveribhavya/tinyllama-math-lora-tuned-adapter