SetFit Aspect Model with sentence-transformers/all-MiniLM-L6-v2

This is a SetFit model that can be used for Aspect Based Sentiment Analysis (ABSA). This SetFit model uses sentence-transformers/all-MiniLM-L6-v2 as the Sentence Transformer embedding model. A LogisticRegression instance is used for classification. In particular, this model is in charge of filtering aspect span candidates.

The model has been trained using an efficient few-shot learning technique that involves:

  1. Fine-tuning a Sentence Transformer with contrastive learning.
  2. Training a classification head with features from the fine-tuned Sentence Transformer.

This model was trained within the context of a larger system for ABSA, which looks like so:

  1. Use a spaCy model to select possible aspect span candidates.
  2. Use this SetFit model to filter these possible aspect span candidates.
  3. Use a SetFit model to classify the filtered aspect span candidates.

Model Details

Model Description

Model Sources

Model Labels

Label Examples
aspect
  • 'light weight:this computer is so light weight and easy to carry.'
  • 'carry:this computer is so light weight and easy to carry.'
  • 'lightweight:very lightweight.'
no aspect
  • 'computer:this computer is so light weight and easy to carry.'
  • "premium:The build quality feels premium but it's surprisingly heavy for daily commuting."
  • "commuting:The build quality feels premium but it's surprisingly heavy for daily commuting."

Uses

Direct Use for Inference

First install the SetFit library:

pip install setfit

Then you can load this model and run inference.

from setfit import AbsaModel

# Download from the ๐Ÿค— Hub
model = AbsaModel.from_pretrained(
    "najwaa/absa-combined-p2-aspect",
    "najwaa/absa-combined-p2-polarity",
)
# Run inference
preds = model("The food was great, but the venue is just way too busy.")

Training Details

Training Set Metrics

Training set Min Median Max
Word count 2 17.9094 52
Label Training Sample Count
no aspect 524
aspect 480

Training Hyperparameters

  • batch_size: (32, 32)
  • num_epochs: (5, 5)
  • max_steps: -1
  • sampling_strategy: oversampling
  • body_learning_rate: (2e-05, 1e-05)
  • head_learning_rate: 0.01
  • loss: CosineSimilarityLoss
  • distance_metric: cosine_distance
  • margin: 0.25
  • end_to_end: False
  • use_amp: True
  • warmup_proportion: 0.1
  • l2_weight: 0.01
  • seed: 42
  • eval_max_steps: -1
  • load_best_model_at_end: True

Training Results

Epoch Step Training Loss Validation Loss
0.0001 1 0.3707 -
0.0006 10 - 0.3251
0.0013 20 - 0.3248
0.0019 30 - 0.3243
0.0025 40 - 0.3235
0.0032 50 0.3447 0.3225
0.0038 60 - 0.3213
0.0044 70 - 0.3199
0.0051 80 - 0.3182
0.0057 90 - 0.3164
0.0063 100 0.3396 0.3144
0.0070 110 - 0.3122
0.0076 120 - 0.3098
0.0082 130 - 0.3074
0.0089 140 - 0.3049
0.0095 150 0.3198 0.3022
0.0101 160 - 0.2991
0.0108 170 - 0.2960
0.0114 180 - 0.2928
0.0120 190 - 0.2894
0.0126 200 0.3344 0.2860
0.0133 210 - 0.2826
0.0139 220 - 0.2797
0.0145 230 - 0.2767
0.0152 240 - 0.2738
0.0158 250 0.2961 0.2712
0.0164 260 - 0.2696
0.0171 270 - 0.2679
0.0177 280 - 0.2661
0.0183 290 - 0.2642
0.0190 300 0.2741 0.2625
0.0196 310 - 0.2609
0.0202 320 - 0.2598
0.0209 330 - 0.2592
0.0215 340 - 0.2587
0.0221 350 0.2744 0.2584
0.0228 360 - 0.2582
0.0234 370 - 0.2582
0.0240 380 - 0.2584
0.0247 390 - 0.2583
0.0253 400 0.2679 0.2583
0.0259 410 - 0.2584
0.0266 420 - 0.2584

Framework Versions

  • Python: 3.11.12
  • SetFit: 1.1.2
  • Sentence Transformers: 4.1.0
  • spaCy: 3.7.5
  • Transformers: 4.51.3
  • PyTorch: 2.6.0+cu124
  • Datasets: 3.6.0
  • Tokenizers: 0.21.1

Citation

BibTeX

@article{https://doi.org/10.48550/arxiv.2209.11055,
    doi = {10.48550/ARXIV.2209.11055},
    url = {https://arxiv.org/abs/2209.11055},
    author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
    keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
    title = {Efficient Few-Shot Learning Without Prompts},
    publisher = {arXiv},
    year = {2022},
    copyright = {Creative Commons Attribution 4.0 International}
}
Downloads last month
622
Safetensors
Model size
22.7M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for najwaa/absa-combined-p2-aspect

Finetuned
(439)
this model