--- tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer widget: - text: Isolated 500kHz 1mΩ current sensor ICs. Allegro MicroSystems is exploiting tunnel magnetoresistance to measure current with 500kHz bandwidth, and less noise that Hall effect isolated current - text: Cruz Azul vs Club Leon Prediction and Betting Tips. Mexican Liga MX returns with a fresh set of fixtures as Cruz Azul and Club Leon square off at the Estadio Olímpico Universitario on Saturday. - text: Bavarian PM calls to stop refugee payments for Ukrainians Ambassador responds. Read more - text: HDFC Bank Bonus Issue One Share For Every One Held Board Approves Plan. The record date for determining the eligible shareholders to receive HDFC Bank bonus equity shares is Wednesday, Aug. 27, 2025. - text: Finding Truth In Other Religions A Call For Openness. Christians do not have to believe other religions are absolutely false, indeed, they can believe they were inspired and lead to Christ. metrics: - accuracy pipeline_tag: text-classification library_name: setfit inference: true base_model: intfloat/multilingual-e5-base model-index: - name: SetFit with intfloat/multilingual-e5-base results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.8222222222222222 name: Accuracy --- # SetFit with intfloat/multilingual-e5-base This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [intfloat/multilingual-e5-base](https://huggingface.co/intfloat/multilingual-e5-base) as the Sentence Transformer embedding model. A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification. The model has been trained using an efficient few-shot learning technique that involves: 1. Fine-tuning a [Sentence Transformer](https://www.sbert.net) with contrastive learning. 2. Training a classification head with features from the fine-tuned Sentence Transformer. ## Model Details ### Model Description - **Model Type:** SetFit - **Sentence Transformer body:** [intfloat/multilingual-e5-base](https://huggingface.co/intfloat/multilingual-e5-base) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 512 tokens - **Number of Classes:** 12 classes ### Model Sources - **Repository:** [SetFit on GitHub](https://github.com/huggingface/setfit) - **Paper:** [Efficient Few-Shot Learning Without Prompts](https://arxiv.org/abs/2209.11055) - **Blogpost:** [SetFit: Efficient Few-Shot Learning Without Prompts](https://huggingface.co/blog/setfit) ### Model Labels | Label | Examples | |:--------------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Business | | | Politics | | | Entertainment | | | Crime | | | Science | | | Lifestyle | | | Education | | | Sports | | | Health | | | General News | | | Technology | | | Religion | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.8222 | ## Uses ### Direct Use for Inference First install the SetFit library: ```bash pip install setfit ``` Then you can load this model and run inference. ```python from setfit import SetFitModel # Download from the 🤗 Hub model = SetFitModel.from_pretrained("setfit_model_id") # Run inference preds = model("Bavarian PM calls to stop refugee payments for Ukrainians Ambassador responds. Read more") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 2 | 42.6906 | 454 | | Label | Training Sample Count | |:--------------|:----------------------| | Business | 346 | | Sports | 244 | | Politics | 210 | | Lifestyle | 186 | | General News | 186 | | Entertainment | 150 | | Crime | 98 | | Technology | 71 | | Health | 70 | | Science | 30 | | Religion | 13 | | Education | 12 | ### Training Hyperparameters - batch_size: (16, 16) - num_epochs: (5, 5) - max_steps: -1 - sampling_strategy: oversampling - num_iterations: 10 - 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: False - warmup_proportion: 0.1 - l2_weight: 0.01 - seed: 42 - eval_max_steps: -1 - load_best_model_at_end: False ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:------:|:-----:|:-------------:|:---------------:| | 0.0005 | 1 | 0.1861 | - | | 0.0248 | 50 | 0.3204 | - | | 0.0495 | 100 | 0.2765 | - | | 0.0743 | 150 | 0.2462 | - | | 0.0990 | 200 | 0.2192 | - | | 0.1238 | 250 | 0.1755 | - | | 0.1485 | 300 | 0.135 | - | | 0.1733 | 350 | 0.1135 | - | | 0.1980 | 400 | 0.092 | - | | 0.2228 | 450 | 0.0885 | - | | 0.2475 | 500 | 0.0739 | - | | 0.2723 | 550 | 0.0762 | - | | 0.2970 | 600 | 0.0688 | - | | 0.3218 | 650 | 0.0633 | - | | 0.3465 | 700 | 0.0535 | - | | 0.3713 | 750 | 0.0363 | - | | 0.3960 | 800 | 0.0388 | - | | 0.4208 | 850 | 0.0339 | - | | 0.4455 | 900 | 0.0265 | - | | 0.4703 | 950 | 0.0344 | - | | 0.4950 | 1000 | 0.016 | - | | 0.5198 | 1050 | 0.0231 | - | | 0.5446 | 1100 | 0.0152 | - | | 0.5693 | 1150 | 0.0118 | - | | 0.5941 | 1200 | 0.0102 | - | | 0.6188 | 1250 | 0.0089 | - | | 0.6436 | 1300 | 0.0125 | - | | 0.6683 | 1350 | 0.0082 | - | | 0.6931 | 1400 | 0.004 | - | | 0.7178 | 1450 | 0.004 | - | | 0.7426 | 1500 | 0.0062 | - | | 0.7673 | 1550 | 0.004 | - | | 0.7921 | 1600 | 0.0039 | - | | 0.8168 | 1650 | 0.0111 | - | | 0.8416 | 1700 | 0.0024 | - | | 0.8663 | 1750 | 0.0047 | - | | 0.8911 | 1800 | 0.0013 | - | | 0.9158 | 1850 | 0.0023 | - | | 0.9406 | 1900 | 0.0039 | - | | 0.9653 | 1950 | 0.0036 | - | | 0.9901 | 2000 | 0.004 | - | | 1.0149 | 2050 | 0.0007 | - | | 1.0396 | 2100 | 0.001 | - | | 1.0644 | 2150 | 0.0029 | - | | 1.0891 | 2200 | 0.0005 | - | | 1.1139 | 2250 | 0.0005 | - | | 1.1386 | 2300 | 0.0006 | - | | 1.1634 | 2350 | 0.0003 | - | | 1.1881 | 2400 | 0.0002 | - | | 1.2129 | 2450 | 0.0018 | - | | 1.2376 | 2500 | 0.0013 | - | | 1.2624 | 2550 | 0.0039 | - | | 1.2871 | 2600 | 0.0025 | - | | 1.3119 | 2650 | 0.0025 | - | | 1.3366 | 2700 | 0.0013 | - | | 1.3614 | 2750 | 0.0017 | - | | 1.3861 | 2800 | 0.0005 | - | | 1.4109 | 2850 | 0.0012 | - | | 1.4356 | 2900 | 0.0002 | - | | 1.4604 | 2950 | 0.0006 | - | | 1.4851 | 3000 | 0.0017 | - | | 1.5099 | 3050 | 0.0004 | - | | 1.5347 | 3100 | 0.0002 | - | | 1.5594 | 3150 | 0.0015 | - | | 1.5842 | 3200 | 0.0002 | - | | 1.6089 | 3250 | 0.0002 | - | | 1.6337 | 3300 | 0.0023 | - | | 1.6584 | 3350 | 0.0025 | - | | 1.6832 | 3400 | 0.0002 | - | | 1.7079 | 3450 | 0.0006 | - | | 1.7327 | 3500 | 0.0006 | - | | 1.7574 | 3550 | 0.0014 | - | | 1.7822 | 3600 | 0.0003 | - | | 1.8069 | 3650 | 0.0024 | - | | 1.8317 | 3700 | 0.0003 | - | | 1.8564 | 3750 | 0.001 | - | | 1.8812 | 3800 | 0.0005 | - | | 1.9059 | 3850 | 0.0014 | - | | 1.9307 | 3900 | 0.0007 | - | | 1.9554 | 3950 | 0.0016 | - | | 1.9802 | 4000 | 0.0013 | - | | 2.0050 | 4050 | 0.0007 | - | | 2.0297 | 4100 | 0.001 | - | | 2.0545 | 4150 | 0.0005 | - | | 2.0792 | 4200 | 0.0002 | - | | 2.1040 | 4250 | 0.0001 | - | | 2.1287 | 4300 | 0.0003 | - | | 2.1535 | 4350 | 0.0001 | - | | 2.1782 | 4400 | 0.0009 | - | | 2.2030 | 4450 | 0.0002 | - | | 2.2277 | 4500 | 0.0004 | - | | 2.2525 | 4550 | 0.0003 | - | | 2.2772 | 4600 | 0.0001 | - | | 2.3020 | 4650 | 0.0001 | - | | 2.3267 | 4700 | 0.0011 | - | | 2.3515 | 4750 | 0.0016 | - | | 2.3762 | 4800 | 0.0004 | - | | 2.4010 | 4850 | 0.0002 | - | | 2.4257 | 4900 | 0.0001 | - | | 2.4505 | 4950 | 0.0004 | - | | 2.4752 | 5000 | 0.0001 | - | | 2.5 | 5050 | 0.0002 | - | | 2.5248 | 5100 | 0.0017 | - | | 2.5495 | 5150 | 0.0002 | - | | 2.5743 | 5200 | 0.0001 | - | | 2.5990 | 5250 | 0.0013 | - | | 2.6238 | 5300 | 0.0014 | - | | 2.6485 | 5350 | 0.0001 | - | | 2.6733 | 5400 | 0.0001 | - | | 2.6980 | 5450 | 0.0001 | - | | 2.7228 | 5500 | 0.0001 | - | | 2.7475 | 5550 | 0.0001 | - | | 2.7723 | 5600 | 0.0001 | - | | 2.7970 | 5650 | 0.0001 | - | | 2.8218 | 5700 | 0.0 | - | | 2.8465 | 5750 | 0.0 | - | | 2.8713 | 5800 | 0.0012 | - | | 2.8960 | 5850 | 0.0001 | - | | 2.9208 | 5900 | 0.0001 | - | | 2.9455 | 5950 | 0.0003 | - | | 2.9703 | 6000 | 0.0001 | - | | 2.9950 | 6050 | 0.0001 | - | | 3.0198 | 6100 | 0.0 | - | | 3.0446 | 6150 | 0.0 | - | | 3.0693 | 6200 | 0.0 | - | | 3.0941 | 6250 | 0.0 | - | | 3.1188 | 6300 | 0.0 | - | | 3.1436 | 6350 | 0.0 | - | | 3.1683 | 6400 | 0.0 | - | | 3.1931 | 6450 | 0.0001 | - | | 3.2178 | 6500 | 0.0001 | - | | 3.2426 | 6550 | 0.0001 | - | | 3.2673 | 6600 | 0.0 | - | | 3.2921 | 6650 | 0.0 | - | | 3.3168 | 6700 | 0.0 | - | | 3.3416 | 6750 | 0.0 | - | | 3.3663 | 6800 | 0.0 | - | | 3.3911 | 6850 | 0.0012 | - | | 3.4158 | 6900 | 0.0013 | - | | 3.4406 | 6950 | 0.0001 | - | | 3.4653 | 7000 | 0.001 | - | | 3.4901 | 7050 | 0.0001 | - | | 3.5149 | 7100 | 0.0002 | - | | 3.5396 | 7150 | 0.0002 | - | | 3.5644 | 7200 | 0.0001 | - | | 3.5891 | 7250 | 0.0001 | - | | 3.6139 | 7300 | 0.0002 | - | | 3.6386 | 7350 | 0.0001 | - | | 3.6634 | 7400 | 0.0001 | - | | 3.6881 | 7450 | 0.0013 | - | | 3.7129 | 7500 | 0.0001 | - | | 3.7376 | 7550 | 0.0 | - | | 3.7624 | 7600 | 0.0 | - | | 3.7871 | 7650 | 0.0 | - | | 3.8119 | 7700 | 0.0 | - | | 3.8366 | 7750 | 0.0 | - | | 3.8614 | 7800 | 0.0 | - | | 3.8861 | 7850 | 0.0 | - | | 3.9109 | 7900 | 0.0 | - | | 3.9356 | 7950 | 0.0 | - | | 3.9604 | 8000 | 0.0 | - | | 3.9851 | 8050 | 0.0 | - | | 4.0099 | 8100 | 0.0001 | - | | 4.0347 | 8150 | 0.0 | - | | 4.0594 | 8200 | 0.0 | - | | 4.0842 | 8250 | 0.0 | - | | 4.1089 | 8300 | 0.0 | - | | 4.1337 | 8350 | 0.0 | - | | 4.1584 | 8400 | 0.0 | - | | 4.1832 | 8450 | 0.0 | - | | 4.2079 | 8500 | 0.0 | - | | 4.2327 | 8550 | 0.0 | - | | 4.2574 | 8600 | 0.0 | - | | 4.2822 | 8650 | 0.0 | - | | 4.3069 | 8700 | 0.0 | - | | 4.3317 | 8750 | 0.0 | - | | 4.3564 | 8800 | 0.0 | - | | 4.3812 | 8850 | 0.0 | - | | 4.4059 | 8900 | 0.0 | - | | 4.4307 | 8950 | 0.0 | - | | 4.4554 | 9000 | 0.0 | - | | 4.4802 | 9050 | 0.0 | - | | 4.5050 | 9100 | 0.0 | - | | 4.5297 | 9150 | 0.0 | - | | 4.5545 | 9200 | 0.0 | - | | 4.5792 | 9250 | 0.0008 | - | | 4.6040 | 9300 | 0.0001 | - | | 4.6287 | 9350 | 0.0 | - | | 4.6535 | 9400 | 0.0 | - | | 4.6782 | 9450 | 0.0 | - | | 4.7030 | 9500 | 0.0 | - | | 4.7277 | 9550 | 0.0013 | - | | 4.7525 | 9600 | 0.0001 | - | | 4.7772 | 9650 | 0.0 | - | | 4.8020 | 9700 | 0.0001 | - | | 4.8267 | 9750 | 0.0 | - | | 4.8515 | 9800 | 0.0 | - | | 4.8762 | 9850 | 0.0 | - | | 4.9010 | 9900 | 0.0 | - | | 4.9257 | 9950 | 0.0001 | - | | 4.9505 | 10000 | 0.0 | - | | 4.9752 | 10050 | 0.0 | - | | 5.0 | 10100 | 0.0001 | - | ### Framework Versions - Python: 3.10.12 - SetFit: 1.1.3 - Sentence Transformers: 5.1.0 - Transformers: 4.55.2 - PyTorch: 2.7.1+cu118 - Datasets: 4.0.0 - Tokenizers: 0.21.4 ## Citation ### BibTeX ```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} } ```