setfit safetensors bert sentence-transformers text-classification generated_from_setfit_trainer arxiv:2209.11055 base_model:BAAI/bge-base-en-v1.5 base_model:finetune:BAAI/bge-base-en-v1.5 model-index region:us
---
base_model: BAAI/bge-base-en-v1.5
library_name: setfit
metrics:
- accuracy
pipeline_tag: text-classification
tags:
- setfit
- sentence-transformers
- text-classification
- generated_from_setfit_trainer
widget:
- text: 'The answer provided accurately reflects the changes Haribabu Kommi is making
    to the storage AM, as detailed in his email. It covers various points, including
    the support for storage method creation, storage AM API hooks, updates to the
    relation structure, tuple visibility functions, slot hooks, write support functionality,
    and scan functions. The summary is comprehensive and aligns well with the original
    document provided.


    Final evaluation:'
- text: 'The answer correctly identifies the winner of the men''s 1,500m final at
    the speed skating World Cup as Ning Zhongyan from China. This aligns with the
    information provided in the document, which states:


    "NORWAY: China''s Ning Zhongyan stepped up preparations for the Winter Olympics
    that will be on home ice in February after winning the men''s 1,500m final at
    the speed skating World Cup leg in Stavanger, Norway on Sunday (Nov 21). Ning
    won gold in 1:45.16..."


    Therefore, the answer is accurate and directly based on the information from the
    document.


    Final evaluation:'
- text: 'The answer accurately lists the available sizes for both the individual and
    combined portraits of David Bowie as stated in the document. The individual portraits
    are stated to be available in 30 x 28.5 inch and 40 x 38.5 inch, while the combined
    portraits are available in 60 inch x 30 inch and 80 inch x 40 inch.


    Final evaluation:'
- text: 'The provided answer is accurate as it outlines the components of the British
    Medieval Student Guide in the Lightning Literature & Composition course. The answer
    mentions the inclusion of comprehension questions, writing exercises, discussion
    questions, additional reading list, semester and full-year schedules, and a bibliography.
    Moreover, it correctly states that the guide is organized into 4 units with 2
    lessons each and includes an appendix section with additional reading selections,
    schedules, and discussion questions.


    The content in the answer aligns well with the information given in the document,
    and no irrelevant or hallucinated details are present.


    Final evaluation:'
- text: 'The provided answer names Rep. Andy Harris, and Reps. Kyle Evans and Jessica
    Smith as the first three Members of Congress to call for an end to the blockade
    of Gaza. However, the document clearly lists Rep. Danny Davis as the third Member
    of Congress, joining Reps. Keith Ellison and Barbara Lee. The given answer is
    therefore incorrect and introduces names notsupported by the document.


    Final evaluation:'
inference: true
model-index:
- name: SetFit with BAAI/bge-base-en-v1.5
  results:
  - task:
      type: text-classification
      name: Text Classification
    dataset:
      name: Unknown
      type: unknown
      split: test
    metrics:
    - type: accuracy
      value: 0.92
      name: Accuracy
---

# SetFit with BAAI/bge-base-en-v1.5

This is a [SetFit](https://github.com/huggingface/setfit) model that can be used for Text Classification. This SetFit model uses [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5) 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:** [BAAI/bge-base-en-v1.5](https://huggingface.co/BAAI/bge-base-en-v1.5)
- **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:** 2 classes
<!-- - **Training Dataset:** [Unknown](https://huggingface.co/datasets/unknown) -->
<!-- - **Language:** Unknown -->
<!-- - **License:** Unknown -->

### 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|:------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1     | <ul><li>'The answer provided is clearly derived from the document and effectively summarizes Patricia Wallace’s roles and responsibilities at Oak View Elementary. It includes her tasks as the school’s social worker, coordinator of the Intervention Support Team, and attendance team leader, accurately reflecting her involvement in managing the clothing closet, food pantry, and backpack program. \n\nTherefore, the response adequately addresses the question without any extraneous or misleading information.\n\nThe final evaluation:'</li><li>'The answer is mostly accurate and covers essential steps, but it slightly misrepresents the document. It suggests making a saline solution and using it with a suction bulb, accurately detailing the saline preparation and administration. However, it could have expanded on additional tips like considering a nasal spray, maintaining humidity, and reducing dairy products, which are all present in the document.\n\nThe answer follows these steps appropriately:\n1. Make a saline solution.\n2. Administer the saline solution.\n3. Suction out the mucus.\n\nThis reflects the core advice from the document. However, the answer could be improved by mentioning more specific care instructions like keeping the air humid or how to treat any accompanying fevers.\n\nFinal evaluation:'</li><li>'The answer accurately addresses the question of identifying Toxic Shock Syndrome (TSS) and aligns with the information presented in the provided document. The key elements discussed, such as flu-like symptoms, possible associations with tampon use, the critical nature of seeking medical help, and the list of symptoms (e.g., rashes, dizziness, and disorientation), are correctlygrounded in the document.\n\nFinal evaluation:'</li></ul> |
| 0     | <ul><li>'Evaluation:\nThe provided answer incorrectly states that Fr. Zahm oversaw the creation of a literature hall, not a science hall. The document indicates that Fr. Zahm oversaw the creation of a science hall in 1883. Therefore, the answer is wrong.\n\nThe final evaluation:'</li><li>"The answer accurately identifies Gregory Johnson as the CEO of Franklin Templeton Investments. It also mentions that Gregory Johnson inherited the position from his father, Rupert H. Johnson, Sr., although this latter part is not supported by the provided document. The document affirms Gregory Johnson is the current CEO but does not mention the inheritance information.\n\nThe additional detail about inheritance may be inferred from external knowledge, but strictly speaking from the provided content, the document does not validate it. However, since the question asks only for the CEO's name and the name provided is correct, the evaluation should consider the essential correctness.\n\nFinal evaluation:"</li><li>'The provided answer partially addresses the question but includes information not supported by the document. The document states that retired priests and brothers reside in Fatima House, but it does not mention that Fatima House is home to a collection of ancient religious manuscripts. Therefore, the answer introduces details not found in the document, which affects its accuracy.\n\nFinal evaluation:'</li></ul>                                                                                                                                                                                                                                                                                                                                                     |

## Evaluation

### Metrics
| Label   | Accuracy |
|:--------|:---------|
| **all** | 0.92     |

## 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("Netta1994/setfit_baai_rag_ds_gpt-4o_cot-few_shot_remove_final_evaluation_e1_larger_train_172701")
# Run inference
preds = model("The answer accurately lists the available sizes for both the individual and combined portraits of David Bowie as stated in the document. The individual portraits are stated to be available in 30 x 28.5 inch and 40 x 38.5 inch, while the combined portraits are available in 60 inch x 30 inch and 80 inch x 40 inch.

Final evaluation:")
```

<!--
### Downstream Use

*List how someone could finetune this model on their own dataset.*
-->

<!--
### Out-of-Scope Use

*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->

<!--
## Bias, Risks and Limitations

*What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
-->

<!--
### Recommendations

*What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
-->

## Training Details

### Training Set Metrics
| Training set | Min | Median  | Max |
|:-------------|:----|:--------|:----|
| Word count   | 16  | 74.1616 | 301 |

| Label | Training Sample Count |
|:------|:----------------------|
| 0     | 94                    |
| 1     | 104                   |

### Training Hyperparameters
- batch_size: (16, 16)
- num_epochs: (1, 1)
- max_steps: -1
- sampling_strategy: oversampling
- num_iterations: 20
- body_learning_rate: (2e-05, 2e-05)
- head_learning_rate: 2e-05
- 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.0020 | 1    | 0.2327        | -               |
| 0.1010 | 50   | 0.2358        | -               |
| 0.2020 | 100  | 0.0911        | -               |
| 0.3030 | 150  | 0.0324        | -               |
| 0.4040 | 200  | 0.0183        | -               |
| 0.5051 | 250  | 0.0226        | -               |
| 0.6061 | 300  | 0.0223        | -               |
| 0.7071 | 350  | 0.0098        | -               |
| 0.8081 | 400  | 0.0067        | -               |
| 0.9091 | 450  | 0.0057        | -               |

### Framework Versions
- Python: 3.10.14
- SetFit: 1.1.0
- Sentence Transformers: 3.1.1
- Transformers: 4.44.0
- PyTorch: 2.4.0+cu121
- Datasets: 3.0.0
- Tokenizers: 0.19.1

## 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}
}
```

<!--
## Glossary

*Clearly define terms in order to be accessible across audiences.*
-->

<!--
## Model Card Authors

*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->

<!--
## Model Card Contact

*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->