Llama 3.2 1B Instruction Chatbot (LoRA Adapter)
Overview
This repository contains a LoRA adapter fine-tuned from Meta's Llama 3.2 1B Instruct model using supervised instruction tuning.
This repository does not contain the base model. Users must have access to the original base model before loading this adapter.
The purpose of this project was educational—to learn the complete workflow of instruction tuning, QLoRA, PEFT, model evaluation, and deployment using Hugging Face.
Base Model
- meta-llama/Llama-3.2-1B-Instruct
Training Dataset
Approximately 40,000 instruction-response examples.
Dataset format:
- Instruction
- Optional Input
- Response
The dataset was converted into a conversational chat format using the Llama chat template prior to training.
Training Configuration
Fine-tuning Method
- QLoRA
- PEFT
- 4-bit NF4 Quantization
Frameworks
- Transformers
- TRL
- PEFT
- BitsAndBytes
- Accelerate
Hyperparameters
| Parameter | Value |
|---|
| Epochs | 1 |
| Batch Size | 2 |
| Gradient Accumulation | 4 |
| Learning Rate | 2e-4 |
| Optimizer | paged_adamw_8bit |
| Scheduler | Cosine |
| Precision | FP16 |
Training Results
| Metric | Value |
|---|
| Training Loss | 0.15088 |
| Runtime | 6789.63 seconds |
| Global Steps | 5000 |
| Samples / Second | 5.89 |
| Steps / Second | 0.736 |
Intended Uses
- Instruction following
- Conversational AI
- Educational projects
- Fine-tuning demonstrations
- Research
Limitations
This adapter was created for educational purposes.
It has not undergone extensive benchmark evaluation or safety alignment beyond the underlying base model.
Responses may contain inaccuracies or hallucinations.
Loading the Adapter
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from peft import PeftModel
3
4base_model = AutoModelForCausalLM.from_pretrained(
5 "meta-llama/Llama-3.2-1B-Instruct"
6)
7
8model = PeftModel.from_pretrained(
9 base_model,
10 "mjpsm/Llama-3.2-1B-Instruction-Chatbot-LoRA"
11)
12
13tokenizer = AutoTokenizer.from_pretrained(
14 "meta-llama/Llama-3.2-1B-Instruct"
15)
Citation
If you use this adapter in your work, please cite this repository.