Model Card: LoRA Fine-Tuned Sentiment Classifier for Tweets
Model Information
Model Name: Lite-Oute-1-300M-Instruct (LoRA Fine-Tuned)
Base Model: OuteAI/Lite-Oute-1-300M-Instruct
Task: Sentiment Analysis – Tweet Classification
Frameworks Used: HuggingFace Transformers, PEFT (LoRA)
Hardware: Google Colab T4 GPU
Repository: https://huggingface.co/YourUsername/llm-course-hw3-lora
Model Description
This model is a fine-tuned version of the Lite-Oute-1-300M-Instruct model, adapted specifically for classifying the sentiment of tweets into one of three categories: negative, neutral, or positive. The fine-tuning was carried out using the Parameter-Efficient Fine-Tuning (PEFT) approach via the LoRA method. The aim was to achieve competitive performance on a curated dataset (cardiffnlp/tweet_eval), leveraging a small but highly representative set of tweets to adjust the model to the nuances of tweet language and tone.
During fine-tuning, the original weights of the model were frozen, and only the LoRA adapters—introduced to key projection layers (k_proj and v_proj)—were trained. The training was conducted with a classic PyTorch training loop on a T4 GPU using Google Colab. Key hyperparameters included:
- Batch Size: 16
- Learning Rate: 5e-4
- Number of Epochs: 1 (with validation performed at each epoch)
- Gradient Clipping: Norm of 1.0
- Optimizer: AdamW (applied exclusively to LoRA parameters)
Data preprocessing was performed on the cardiffnlp/tweet_eval dataset where the tweet text and associated sentiment labels were formatted into a conversational prompt. The model was evaluated using the macro F1 metric, and a confusion matrix was generated for further analysis.
Results
The LoRA hyperparameters were carefully chosen to balance adaptation capacity and memory efficiency. This targeted fine-tuning approach led to a substantial performance improvement. The macro F1 score increased dramatically from an initial value of 0.07 (before fine-tuning) to 0.53 (after fine-tuning).
Two detailed confusion matrix heatmaps were generated to illustrate the model's performance before and after fine-tuning:
- Heatmap Before Fine-Tuning:
Sample Generation Outputs
The following examples demonstrate the model's ability to classify tweet sentiments after fine-tuning:
Tweet:
"QT @user In the original draft of the 7th book, Remus Lupin survived the Battle of Hogwarts. #HappyBirthdayRemusLupin"
Expected Label: positive
Model Generation: positiveTweet:
"Chase Headley's RBI double in the 8th inning off David Price snapped a Yankees streak of 33 consecutive scoreless innings against Blue Jays"
Expected Label: neutral
Model Generation: neutralTweet:
"@user Alciato: Bee will invest 150 million in January, another 200 in the Summer and plans to bring Messi by 2017"
Expected Label: positive
Model Generation: positive
Experiment and Training Details
Data Preparation:
The model was fine-tuned on thecardiffnlp/tweet_eval
dataset with sentiment labels mapped to string names (negative
,neutral
,positive
). A chat-based prompt format was constructed with a system instruction describing the task and a user message containing the tweet text.Model Adaptation:
PEFT was applied by replacing the target submodules in the transformer architecture (specifically, k_proj and v_proj) with LoRA adapter wrappers. The adapter design followed the standard LoRA update mechanism, with low-rank matrices trained while keeping the original model weights frozen.Training Loop:
A custom training loop was implemented using PyTorch with attention to tensor padding and optimized memory usage. The training involved computing losses based on model outputs, gradient clipping, and learning rate scheduling with evaluation performed at each epoch.Evaluation:
Performance was evaluated using the macro F1 score and confusion matrices. Detailed evaluation plots and logs are available in the repositoryHardware & Environment:
Training was executed in Google Colab with T4 GPUs, ensuring efficient resource utilization and reproducibility.
Repository & Experiment Links
Model Repository: https://huggingface.co/estnafinema0/llm-course-hw3-lora
Conclusion
This model card summarizes the development, fine-tuning, and evaluation of a sentiment classifier optimized for tweet classification. By employing a LoRA-based PEFT approach, the model was effectively adapted to a challenging real-world task while achieving a significant improvement in macro F1 score—from 0.07 to 0.53. The training and evaluation process was rigorously conducted on T4 GPUs using Google Colab, ensuring the approach is both practical and reproducible. Further improvements and analyses (such as detailed heatmaps of confusion matrices) are provided in the repository for in-depth study.
For any questions or further details, please refer to the repository or contact the model maintainer on [email protected]
.
- Downloads last month
- 13
Model tree for estnafinema0/llm-course-hw3-lora
Base model
OuteAI/Lite-Oute-1-300M-Instruct