--- base_model: prajjwal1/bert-tiny library_name: peft tags: - base_model:adapter:prajjwal1/bert-tiny - lora - transformers - sentiment-analysis - text-classification - paladim - continual-learning license: mit --- # PALADIM Sentiment Analysis (Improved) **A balanced, production-ready sentiment analysis model using PALADIM architecture** ## 🎯 Model Performance - **Overall Accuracy**: 78.68% - **Positive Sentiment**: 74.61% accuracy - **Negative Sentiment**: 82.87% accuracy - **Training Data**: 22,500 balanced samples from IMDb - **Balanced Training**: Equal positive/negative samples (no bias!) ## 📊 Test Results All predictions correct with high confidence: | Text | Prediction | Confidence | |------|------------|------------| | "This movie was absolutely fantastic!" | ✅ POSITIVE | 93.5% | | "Terrible experience. Waste of time and money." | ❌ NEGATIVE | 92.1% | | "Pretty good, I enjoyed it overall." | ✅ POSITIVE | 88.5% | | "Not great, kind of boring and disappointing." | ❌ NEGATIVE | 86.4% | | "Amazing! Best thing I've ever seen!" | ✅ POSITIVE | 94.0% | | "Awful. Would not recommend to anyone." | ❌ NEGATIVE | 95.7% | ## 🚀 Quick Start ```python from peft import PeftModel from transformers import AutoModelForSequenceClassification, AutoTokenizer import torch # Load model base_model = AutoModelForSequenceClassification.from_pretrained( "prajjwal1/bert-tiny", num_labels=2 ) model = PeftModel.from_pretrained(base_model, "nickagge/paladim-sentiment-improved") tokenizer = AutoTokenizer.from_pretrained("nickagge/paladim-sentiment-improved") # Predict text = "This movie was fantastic!" inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True) outputs = model(**inputs) prediction = torch.argmax(outputs.logits, dim=-1).item() sentiment = "POSITIVE" if prediction == 1 else "NEGATIVE" confidence = torch.softmax(outputs.logits, dim=-1).max().item() print(f"{sentiment} ({confidence*100:.1f}%)") ``` ## Model Details **PALADIM** (Pre Adaptive Learning Architecture of Dual-Process Hebbian-MoE Schema) is a continual learning system that combines: - **Stable Core**: Pre-trained BERT-tiny (4.4M parameters) - frozen - **Plastic Memory**: LoRA adapters (12,546 trainable = 0.29%) - **MoE Layer**: Mixture of Experts routing - **Consolidation**: EWC + Knowledge Distillation - **Meta-Controller**: Adaptive learning triggers - **Replay Buffer**: Anti-forgetting mechanism ### Model Description This model is fine-tuned for binary sentiment classification (positive/negative) with balanced training to avoid prediction bias. It achieves 78.68% accuracy with high confidence predictions on both sentiment classes. - **Developed by:** nickagge - **Model type:** BERT-tiny with LoRA adapters - **Language(s):** English - **License:** MIT - **Finetuned from model:** prajjwal1/bert-tiny ## Training Details ### Training Data - **Dataset**: IMDb movie reviews - **Training samples**: 22,500 (11,250 positive + 11,250 negative) - **Validation samples**: 2,500 (balanced) - **Max sequence length**: 128 tokens ### Training Procedure #### Training Hyperparameters - **Training regime**: fp32 (CPU training) - **Epochs**: 3 - **Batch size**: 16 - **Learning rate**: 5e-4 - **Optimizer**: AdamW - **LoRA rank (r)**: 8 - **LoRA alpha**: 16 - **LoRA dropout**: 0.1 - **Target modules**: ["query", "value", "key"] #### Training Progress | Epoch | Train Loss | Train Acc | Eval Acc | Pos Acc | Neg Acc | |-------|------------|-----------|----------|---------|---------| | 1 | 0.5514 | 71.31% | 77.48% | 77.44% | 77.52% | | 2 | 0.4933 | 76.00% | 77.68% | 86.59% | 68.51% | | 3 | 0.4805 | 76.94% | **78.68%** | 74.61% | 82.87% | ## Evaluation ### Testing Data & Metrics - **Test set**: 2,500 balanced samples from IMDb - **Metrics**: Accuracy (overall and per-class) - **Positive class accuracy**: 74.61% - **Negative class accuracy**: 82.87% ### Results ✅ **Balanced predictions** - No systematic bias ✅ **High confidence** - 86-96% on test sentences ✅ **Consistent performance** - Both classes above 74% ## Uses ### Direct Use - Sentiment analysis for movie reviews, product reviews, customer feedback - Social media sentiment monitoring - Content moderation and filtering - Market research and opinion mining ### Limitations - Trained specifically on movie reviews (may need domain adaptation for other contexts) - Binary classification only (positive/negative, no neutral class) - English language only - Max sequence length: 128 tokens ## Citation ```bibtex @misc{paladim-sentiment-improved, title={PALADIM Sentiment Analysis Model}, author={nickagge}, year={2025}, publisher={HuggingFace}, howpublished={\url{https://huggingface.co/nickagge/paladim-sentiment-improved}} } ``` ## Related Models - [Original PALADIM Model](https://huggingface.co/nickagge/paladim-sentiment) - [BERT-tiny Base](https://huggingface.co/prajjwal1/bert-tiny) ### Framework versions - PEFT 0.18.0