--- library_name: transformers tags: - dora - peft - Sentiment Classifier license: apache-2.0 datasets: - cardiffnlp/tweet_eval language: - en metrics: - f1 base_model: - OuteAI/Lite-Oute-1-300M-Instruct --- # Model Card: DoRA Fine-Tuned Sentiment Classifier for Tweets --- ## Model Information **Model Name:** Lite-Oute-1-300M-Instruct (DoRA Fine-Tuned) **Base Model:** [OuteAI/Lite-Oute-1-300M-Instruct](https://huggingface.co/OuteAI/Lite-Oute-1-300M-Instruct) **Task:** Sentiment Analysis – Tweet Classification **Frameworks Used:** HuggingFace Transformers, PEFT (DoRA) **Hardware:** Google Colab T4 GPU **Repository:** [https://huggingface.co/YourUsername/llm-course-hw3-dora](https://huggingface.co/YourUsername/llm-course-hw3-dora) --- ## Model Description This model represents a DoRA (Weight-Decomposed Low-Rank Adaptation) fine-tuned version of the Lite-Oute-1-300M-Instruct model for tweet sentiment classification. The objective is to adapt the base model to accurately classify tweets into **negative**, **neutral**, or **positive** categories while preserving most of the original model parameters. The DoRA method extends the LoRA approach by incorporating a trainable scaling vector and normalizing the updated weight matrix, thus providing additional flexibility. In this fine-tuning process, only the DoRA adapter components are trained. The original model weights are frozen, ensuring minimal resource usage and stability during training. The training was performed on Google Colab using a T4 GPU, leveraging a custom PyTorch training loop and efficient tensor handling. --- ## Results The DoRA hyperparameters were selected to effectively balance adaptation capability and memory efficiency. The DoRA adapter achieved a significant improvement in performance, with the macro F1 score increasing from an initial value of **0.07** (before fine-tuning) to **0.50** (after fine-tuning). Two confusion matrix heatmaps illustrate the performance change: - **Heatmap Before Fine-Tuning:** ![image/png](https://cdn-uploads.huggingface.co/production/uploads/67c40beb3a3d19149b5bdfbf/DW0URi77UKvToUUSteYrq.png) - **Heatmap After Fine-Tuning:** ![image/png](https://cdn-uploads.huggingface.co/production/uploads/67c40beb3a3d19149b5bdfbf/kBJ4mc5TdZm0GKPdjaJze.png) --- ## Sample Generation Outputs The following examples demonstrate the model’s tweet sentiment classifications: 1. **Tweet:** "QT @user In the original draft of the 7th book, Remus Lupin survived the Battle of Hogwarts. #HappyBirthdayRemusLupin" **Expected Label:** positive **Model Generation:** *positive* 2. **Tweet:** "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:** *neutral* 3. **Tweet:** "@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 training data was derived from the `cardiffnlp/tweet_eval` dataset. Each tweet was transformed into a conversational prompt featuring a system instruction defining the task, a user message with the tweet text, and an assistant message indicating the sentiment label. - **Model Adaptation:** The DoRA adapter was applied by replacing target submodules within the transformer (specifically, *k_proj* and *v_proj*) with the DoRA-enhanced layer. In this approach, the adapter computes a low-rank update (BA) and combines it with the original frozen weight, followed by column-wise normalization and scaling via a learned vector. This design ensures minimal disruption to the base model while allowing for effective adaptation. - **Training Process:** The training loop was implemented in PyTorch with attention to optimal tensor padding and memory management. Key hyperparameters include: - **Batch Size:** 16 - **Learning Rate:** 5e-4 - **Number of Epochs:** 3 - **Gradient Clipping:** Norm of 1.0 - **Optimizer:** AdamW (applied exclusively to DoRA parameters) Training was executed on a T4 GPU in Google Colab. - **Evaluation:** Model performance was assessed using the macro F1 score, with confusion matrix heatmaps generated before and after fine-tuning to visualize improvements. - **Libraries and Tools:** The process utilized HuggingFace Transformers, the PEFT library for DoRA implementation, and standard Python libraries for data preprocessing and evaluation. --- ## Repository & Experiment Links > **Model Repository:** [https://huggingface.co/estnafinema0/llm-course-hw3-lora](https://huggingface.co/estnafinema0/llm-course-hw3-dora) --- ## Conclusion This model card documents the development, fine-tuning, and evaluation of a sentiment classifier tailored for tweet analysis using the DoRA approach. By fine-tuning only the adapter components while leaving the base model weights intact, the DoRA method significantly enhanced the classifier's performance, raising the macro F1 score from 0.07 to 0.50. The experiment was rigorously conducted on Google Colab (T4 GPU) with detailed evaluation visualizations (confusion matrix heatmaps) and extensive documentation available in the repository. This fine-tuning strategy demonstrates an effective trade-off between performance improvement and computational efficiency. --- *For any questions or further details, please refer to the repository or contact the model maintainer on `s02230045@gse.cs.msu.ru`.*