--- base_model: sentence-transformers/all-MiniLM-L6-v2 library_name: setfit metrics: - accuracy pipeline_tag: text-classification tags: - setfit - sentence-transformers - text-classification - generated_from_setfit_trainer widget: - text: How does technology impact our daily lives and what benefits can it bring to various activities? - text: How do organizations effectively deploy and manage machine learning algorithms to drive business value? - text: What are the key considerations for organizing and managing computer lab resources and tracking their status? - text: How can batch processing improve the efficiency of data lake operations? - text: What is the purpose of setting up a CUPS on a server? inference: true model-index: - name: SetFit with sentence-transformers/all-MiniLM-L6-v2 results: - task: type: text-classification name: Text Classification dataset: name: Unknown type: unknown split: test metrics: - type: accuracy value: 0.8947368421052632 name: Accuracy --- # SetFit with sentence-transformers/all-MiniLM-L6-v2 This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co./sentence-transformers/all-MiniLM-L6-v2) 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:** [sentence-transformers/all-MiniLM-L6-v2](https://huggingface.co./sentence-transformers/all-MiniLM-L6-v2) - **Classification head:** a [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance - **Maximum Sequence Length:** 256 tokens - **Number of Classes:** 2 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 | |:---------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | lexical | | | semantic | | ## Evaluation ### Metrics | Label | Accuracy | |:--------|:---------| | **all** | 0.8947 | ## 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("yaniseuranova/setfit-rag-hybrid-search-query-router-test") # Run inference preds = model("What is the purpose of setting up a CUPS on a server?") ``` ## Training Details ### Training Set Metrics | Training set | Min | Median | Max | |:-------------|:----|:--------|:----| | Word count | 4 | 13.7407 | 28 | | Label | Training Sample Count | |:---------|:----------------------| | lexical | 44 | | semantic | 118 | ### Training Hyperparameters - batch_size: (1, 1) - num_epochs: (1, 1) - 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: False - warmup_proportion: 0.1 - seed: 42 - eval_max_steps: -1 - load_best_model_at_end: True ### Training Results | Epoch | Step | Training Loss | Validation Loss | |:-------:|:---------:|:-------------:|:---------------:| | 0.0001 | 1 | 0.919 | - | | 0.0031 | 50 | 0.0006 | - | | 0.0062 | 100 | 0.0208 | - | | 0.0094 | 150 | 0.0001 | - | | 0.0125 | 200 | 0.0163 | - | | 0.0156 | 250 | 0.0043 | - | | 0.0187 | 300 | 0.0082 | - | | 0.0218 | 350 | 0.0217 | - | | 0.0250 | 400 | 0.008 | - | | 0.0281 | 450 | 0.0451 | - | | 0.0312 | 500 | 0.0179 | - | | 0.0343 | 550 | 0.0801 | - | | 0.0374 | 600 | 0.0898 | - | | 0.0406 | 650 | 0.1121 | - | | 0.0437 | 700 | 0.0165 | - | | 0.0468 | 750 | 0.0402 | - | | 0.0499 | 800 | 0.1585 | - | | 0.0531 | 850 | 0.0028 | - | | 0.0562 | 900 | 0.0033 | - | | 0.0593 | 950 | 0.0001 | - | | 0.0624 | 1000 | 0.002 | - | | 0.0655 | 1050 | 0.0001 | - | | 0.0687 | 1100 | 0.0158 | - | | 0.0718 | 1150 | 0.0 | - | | 0.0749 | 1200 | 0.0001 | - | | 0.0780 | 1250 | 0.0044 | - | | 0.0811 | 1300 | 0.002 | - | | 0.0843 | 1350 | 0.0016 | - | | 0.0874 | 1400 | 0.0003 | - | | 0.0905 | 1450 | 0.0005 | - | | 0.0936 | 1500 | 0.001 | - | | 0.0967 | 1550 | 0.0 | - | | 0.0999 | 1600 | 0.0 | - | | 0.1030 | 1650 | 0.0001 | - | | 0.1061 | 1700 | 0.0 | - | | 0.1092 | 1750 | 0.0001 | - | | 0.1123 | 1800 | 0.0 | - | | 0.1155 | 1850 | 0.0002 | - | | 0.1186 | 1900 | 0.0004 | - | | 0.1217 | 1950 | 0.0006 | - | | 0.1248 | 2000 | 0.0001 | - | | 0.1279 | 2050 | 0.0 | - | | 0.1311 | 2100 | 0.0001 | - | | 0.1342 | 2150 | 0.0009 | - | | 0.1373 | 2200 | 0.0 | - | | 0.1404 | 2250 | 0.0001 | - | | 0.1436 | 2300 | 0.0001 | - | | 0.1467 | 2350 | 0.0 | - | | 0.1498 | 2400 | 0.0001 | - | | 0.1529 | 2450 | 0.0 | - | | 0.1560 | 2500 | 0.0 | - | | 0.1592 | 2550 | 0.0001 | - | | 0.1623 | 2600 | 0.0 | - | | 0.1654 | 2650 | 0.0003 | - | | 0.1685 | 2700 | 0.0 | - | | 0.1716 | 2750 | 0.0001 | - | | 0.1748 | 2800 | 0.0 | - | | 0.1779 | 2850 | 0.0 | - | | 0.1810 | 2900 | 0.0 | - | | 0.1841 | 2950 | 0.0 | - | | 0.1872 | 3000 | 0.0 | - | | 0.1904 | 3050 | 0.0 | - | | 0.1935 | 3100 | 0.0001 | - | | 0.1966 | 3150 | 0.0 | - | | 0.1997 | 3200 | 0.0 | - | | 0.2028 | 3250 | 0.0 | - | | 0.2060 | 3300 | 0.0 | - | | 0.2091 | 3350 | 0.0 | - | | 0.2122 | 3400 | 0.0 | - | | 0.2153 | 3450 | 0.0 | - | | 0.2184 | 3500 | 0.0005 | - | | 0.2216 | 3550 | 0.0 | - | | 0.2247 | 3600 | 0.0 | - | | 0.2278 | 3650 | 0.0 | - | | 0.2309 | 3700 | 0.0 | - | | 0.2341 | 3750 | 0.0005 | - | | 0.2372 | 3800 | 0.0 | - | | 0.2403 | 3850 | 0.0 | - | | 0.2434 | 3900 | 0.0 | - | | 0.2465 | 3950 | 0.0 | - | | 0.2497 | 4000 | 0.0001 | - | | 0.2528 | 4050 | 0.0 | - | | 0.2559 | 4100 | 0.0 | - | | 0.2590 | 4150 | 0.0001 | - | | 0.2621 | 4200 | 0.0001 | - | | 0.2653 | 4250 | 0.0 | - | | 0.2684 | 4300 | 0.0001 | - | | 0.2715 | 4350 | 0.0 | - | | 0.2746 | 4400 | 0.0 | - | | 0.2777 | 4450 | 0.0 | - | | 0.2809 | 4500 | 0.0 | - | | 0.2840 | 4550 | 0.0002 | - | | 0.2871 | 4600 | 0.0 | - | | 0.2902 | 4650 | 0.0002 | - | | 0.2933 | 4700 | 0.0 | - | | 0.2965 | 4750 | 0.0 | - | | 0.2996 | 4800 | 0.0 | - | | 0.3027 | 4850 | 0.0002 | - | | 0.3058 | 4900 | 0.0 | - | | 0.3090 | 4950 | 0.0 | - | | 0.3121 | 5000 | 0.0 | - | | 0.3152 | 5050 | 0.0 | - | | 0.3183 | 5100 | 0.0001 | - | | 0.3214 | 5150 | 0.0 | - | | 0.3246 | 5200 | 0.0001 | - | | 0.3277 | 5250 | 0.0 | - | | 0.3308 | 5300 | 0.0 | - | | 0.3339 | 5350 | 0.0001 | - | | 0.3370 | 5400 | 0.0 | - | | 0.3402 | 5450 | 0.0 | - | | 0.3433 | 5500 | 0.0001 | - | | 0.3464 | 5550 | 0.0 | - | | 0.3495 | 5600 | 0.0003 | - | | 0.3526 | 5650 | 0.0 | - | | 0.3558 | 5700 | 0.0001 | - | | 0.3589 | 5750 | 0.0 | - | | 0.3620 | 5800 | 0.0 | - | | 0.3651 | 5850 | 0.0 | - | | 0.3682 | 5900 | 0.0 | - | | 0.3714 | 5950 | 0.0 | - | | 0.3745 | 6000 | 0.0 | - | | 0.3776 | 6050 | 0.0001 | - | | 0.3807 | 6100 | 0.0 | - | | 0.3838 | 6150 | 0.0 | - | | 0.3870 | 6200 | 0.0 | - | | 0.3901 | 6250 | 0.0001 | - | | 0.3932 | 6300 | 0.0001 | - | | 0.3963 | 6350 | 0.0002 | - | | 0.3995 | 6400 | 0.0003 | - | | 0.4026 | 6450 | 0.0001 | - | | 0.4057 | 6500 | 0.0002 | - | | 0.4088 | 6550 | 0.0001 | - | | 0.4119 | 6600 | 0.0 | - | | 0.4151 | 6650 | 0.0 | - | | 0.4182 | 6700 | 0.0001 | - | | 0.4213 | 6750 | 0.0004 | - | | 0.4244 | 6800 | 0.0 | - | | 0.4275 | 6850 | 0.0001 | - | | 0.4307 | 6900 | 0.0 | - | | 0.4338 | 6950 | 0.0 | - | | 0.4369 | 7000 | 0.0001 | - | | 0.4400 | 7050 | 0.0001 | - | | 0.4431 | 7100 | 0.0001 | - | | 0.4463 | 7150 | 0.0 | - | | 0.4494 | 7200 | 0.0001 | - | | 0.4525 | 7250 | 0.0 | - | | 0.4556 | 7300 | 0.0001 | - | | 0.4587 | 7350 | 0.0 | - | | 0.4619 | 7400 | 0.0 | - | | 0.4650 | 7450 | 0.0 | - | | 0.4681 | 7500 | 0.0 | - | | 0.4712 | 7550 | 0.0001 | - | | 0.4743 | 7600 | 0.0001 | - | | 0.4775 | 7650 | 0.0 | - | | 0.4806 | 7700 | 0.0 | - | | 0.4837 | 7750 | 0.0001 | - | | 0.4868 | 7800 | 0.0001 | - | | 0.4900 | 7850 | 0.0 | - | | 0.4931 | 7900 | 0.0 | - | | 0.4962 | 7950 | 0.0 | - | | 0.4993 | 8000 | 0.0 | - | | 0.5024 | 8050 | 0.0 | - | | 0.5056 | 8100 | 0.0001 | - | | 0.5087 | 8150 | 0.0 | - | | 0.5118 | 8200 | 0.0 | - | | 0.5149 | 8250 | 0.0 | - | | 0.5180 | 8300 | 0.0001 | - | | 0.5212 | 8350 | 0.0001 | - | | 0.5243 | 8400 | 0.0 | - | | 0.5274 | 8450 | 0.0 | - | | 0.5305 | 8500 | 0.0 | - | | 0.5336 | 8550 | 0.0 | - | | 0.5368 | 8600 | 0.0001 | - | | 0.5399 | 8650 | 0.0 | - | | 0.5430 | 8700 | 0.0 | - | | 0.5461 | 8750 | 0.0 | - | | 0.5492 | 8800 | 0.0 | - | | 0.5524 | 8850 | 0.0 | - | | 0.5555 | 8900 | 0.0 | - | | 0.5586 | 8950 | 0.0 | - | | 0.5617 | 9000 | 0.0 | - | | 0.5648 | 9050 | 0.0 | - | | 0.5680 | 9100 | 0.0001 | - | | 0.5711 | 9150 | 0.0 | - | | 0.5742 | 9200 | 0.0 | - | | 0.5773 | 9250 | 0.0004 | - | | 0.5805 | 9300 | 0.0 | - | | 0.5836 | 9350 | 0.0 | - | | 0.5867 | 9400 | 0.0 | - | | 0.5898 | 9450 | 0.0 | - | | 0.5929 | 9500 | 0.0 | - | | 0.5961 | 9550 | 0.0 | - | | 0.5992 | 9600 | 0.0 | - | | 0.6023 | 9650 | 0.0001 | - | | 0.6054 | 9700 | 0.0 | - | | 0.6085 | 9750 | 0.0 | - | | 0.6117 | 9800 | 0.0 | - | | 0.6148 | 9850 | 0.0 | - | | 0.6179 | 9900 | 0.0 | - | | 0.6210 | 9950 | 0.0 | - | | 0.6241 | 10000 | 0.0 | - | | 0.6273 | 10050 | 0.0 | - | | 0.6304 | 10100 | 0.0 | - | | 0.6335 | 10150 | 0.0 | - | | 0.6366 | 10200 | 0.0 | - | | 0.6397 | 10250 | 0.0 | - | | 0.6429 | 10300 | 0.0 | - | | 0.6460 | 10350 | 0.0001 | - | | 0.6491 | 10400 | 0.0 | - | | 0.6522 | 10450 | 0.0002 | - | | 0.6553 | 10500 | 0.0 | - | | 0.6585 | 10550 | 0.0 | - | | 0.6616 | 10600 | 0.0 | - | | 0.6647 | 10650 | 0.0 | - | | 0.6678 | 10700 | 0.0 | - | | 0.6710 | 10750 | 0.0 | - | | 0.6741 | 10800 | 0.0 | - | | 0.6772 | 10850 | 0.0 | - | | 0.6803 | 10900 | 0.0 | - | | 0.6834 | 10950 | 0.0 | - | | 0.6866 | 11000 | 0.0001 | - | | 0.6897 | 11050 | 0.0 | - | | 0.6928 | 11100 | 0.0 | - | | 0.6959 | 11150 | 0.0 | - | | 0.6990 | 11200 | 0.0 | - | | 0.7022 | 11250 | 0.0001 | - | | 0.7053 | 11300 | 0.0 | - | | 0.7084 | 11350 | 0.0 | - | | 0.7115 | 11400 | 0.0001 | - | | 0.7146 | 11450 | 0.0 | - | | 0.7178 | 11500 | 0.0 | - | | 0.7209 | 11550 | 0.0 | - | | 0.7240 | 11600 | 0.0 | - | | 0.7271 | 11650 | 0.0 | - | | 0.7302 | 11700 | 0.0001 | - | | 0.7334 | 11750 | 0.0 | - | | 0.7365 | 11800 | 0.0 | - | | 0.7396 | 11850 | 0.0 | - | | 0.7427 | 11900 | 0.0 | - | | 0.7458 | 11950 | 0.0 | - | | 0.7490 | 12000 | 0.0001 | - | | 0.7521 | 12050 | 0.0 | - | | 0.7552 | 12100 | 0.0 | - | | 0.7583 | 12150 | 0.0 | - | | 0.7615 | 12200 | 0.0001 | - | | 0.7646 | 12250 | 0.0 | - | | 0.7677 | 12300 | 0.0 | - | | 0.7708 | 12350 | 0.0 | - | | 0.7739 | 12400 | 0.0 | - | | 0.7771 | 12450 | 0.0 | - | | 0.7802 | 12500 | 0.0 | - | | 0.7833 | 12550 | 0.0 | - | | 0.7864 | 12600 | 0.0 | - | | 0.7895 | 12650 | 0.0 | - | | 0.7927 | 12700 | 0.0 | - | | 0.7958 | 12750 | 0.0 | - | | 0.7989 | 12800 | 0.0 | - | | 0.8020 | 12850 | 0.0 | - | | 0.8051 | 12900 | 0.0 | - | | 0.8083 | 12950 | 0.0 | - | | 0.8114 | 13000 | 0.0 | - | | 0.8145 | 13050 | 0.0 | - | | 0.8176 | 13100 | 0.0 | - | | 0.8207 | 13150 | 0.0 | - | | 0.8239 | 13200 | 0.0 | - | | 0.8270 | 13250 | 0.0 | - | | 0.8301 | 13300 | 0.0 | - | | 0.8332 | 13350 | 0.0 | - | | 0.8364 | 13400 | 0.0 | - | | 0.8395 | 13450 | 0.0 | - | | 0.8426 | 13500 | 0.0 | - | | 0.8457 | 13550 | 0.0 | - | | 0.8488 | 13600 | 0.0 | - | | 0.8520 | 13650 | 0.0 | - | | 0.8551 | 13700 | 0.0 | - | | 0.8582 | 13750 | 0.0 | - | | 0.8613 | 13800 | 0.0 | - | | 0.8644 | 13850 | 0.0 | - | | 0.8676 | 13900 | 0.0 | - | | 0.8707 | 13950 | 0.0 | - | | 0.8738 | 14000 | 0.0 | - | | 0.8769 | 14050 | 0.0 | - | | 0.8800 | 14100 | 0.0 | - | | 0.8832 | 14150 | 0.0 | - | | 0.8863 | 14200 | 0.0 | - | | 0.8894 | 14250 | 0.0 | - | | 0.8925 | 14300 | 0.0 | - | | 0.8956 | 14350 | 0.0 | - | | 0.8988 | 14400 | 0.0 | - | | 0.9019 | 14450 | 0.0 | - | | 0.9050 | 14500 | 0.0 | - | | 0.9081 | 14550 | 0.0 | - | | 0.9112 | 14600 | 0.0 | - | | 0.9144 | 14650 | 0.0 | - | | 0.9175 | 14700 | 0.0 | - | | 0.9206 | 14750 | 0.0 | - | | 0.9237 | 14800 | 0.0 | - | | 0.9269 | 14850 | 0.0 | - | | 0.9300 | 14900 | 0.0 | - | | 0.9331 | 14950 | 0.0 | - | | 0.9362 | 15000 | 0.0 | - | | 0.9393 | 15050 | 0.0 | - | | 0.9425 | 15100 | 0.0 | - | | 0.9456 | 15150 | 0.0 | - | | 0.9487 | 15200 | 0.0001 | - | | 0.9518 | 15250 | 0.0 | - | | 0.9549 | 15300 | 0.0 | - | | 0.9581 | 15350 | 0.0 | - | | 0.9612 | 15400 | 0.0 | - | | 0.9643 | 15450 | 0.0 | - | | 0.9674 | 15500 | 0.0 | - | | 0.9705 | 15550 | 0.0 | - | | 0.9737 | 15600 | 0.0 | - | | 0.9768 | 15650 | 0.0 | - | | 0.9799 | 15700 | 0.0 | - | | 0.9830 | 15750 | 0.0 | - | | 0.9861 | 15800 | 0.0 | - | | 0.9893 | 15850 | 0.0 | - | | 0.9924 | 15900 | 0.0 | - | | 0.9955 | 15950 | 0.0 | - | | 0.9986 | 16000 | 0.0 | - | | **1.0** | **16022** | **-** | **0.1745** | * The bold row denotes the saved checkpoint. ### Framework Versions - Python: 3.10.12 - SetFit: 1.0.3 - Sentence Transformers: 2.6.1 - Transformers: 4.39.0 - PyTorch: 2.3.1+cu121 - Datasets: 2.18.0 - Tokenizers: 0.15.2 ## 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} } ```