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 provides comprehensive information for identifying a funnel spider,
    including details about their physical characteristics such as body color, carapace,
    fangs, size, spinnerets, and distinctions between males and females. The document
    confirms all these points, making the answer well-grounded and accurate.


    Final evaluation:'
- text: "The answer provided covers many key points required to write a paper in MLA\
    \ format: creating 1-inch margins, using a 12-point font, double-spacing, a running\
    \ header, and heading with full name, instructor's name, course number, and due\
    \ date. It also correctly mentions the importance of centering the title and left-aligning\
    \ the main text to begin writing the body of the paper. \n\nIt is grounded in\
    \ the document, correctly interpreting and summarizing the essential steps for\
    \ formatting a paper according to the MLA guidelines. There is no deviation or\
    \ contradictionin the response provided.\n\nFinal evaluation:"
- text: "The answer provided outlines general advice for getting into medical school,\
    \ including achieving high grades in prerequisite subjects, gaining clinical experience,\
    \ and studying for the MCAT. However, it falls short in some specific areas that\
    \ are detailed in the document.\n\n### Reasoning:\n\n1. **Grades in Prerequisite\
    \ Subjects**:\n   - **Answer**: Emphasizes getting the best grades in Biology,\
    \ Chemistry, Physics, and Mathematics.\n   - **Document**: Agrees but also includes\
    \ the need for courses in introductory psychology and sociology for the MCAT.\n\
    \n2. **Clinical Experience**:\n   - **Answer**: Mentions volunteering at Planned\
    \ Parenthood or similar clinics.\n   - **Document**: Expands on this by suggesting\
    \ volunteering at HIV clinics, free clinics, health fairs, and other community\
    \ health centers. It also stresses the importance of consistent commitment to\
    \ these roles.\n\n3. **MCAT Preparation**:\n   - **Answer**: Recommends studying\
    \ for the MCAT and applying once you pass.\n   - **Document**: Provides a detailed\
    \ timeline and approach to taking the MCAT, including taking practice exams, potentially\
    \ hiring a tutor, and the benefits of taking the exam once you feel prepared.\n\
    \n4. **Other Critical Steps**:\n   - **Document**: Encompasses a broader range\
    \ of activities such as getting involved in extracurricular activities, leadership\
    \ roles, securing internships, finding professors for letters of recommendation,\
    \ and the step-by-step application process.\n\nThe provided answer contains crucial\
    \ points but oversimplifies the extensive and rigorous process of getting into\
    \ medical school as detailed in the document. It misses the broader and more detailed\
    \ advice which is essential for a comprehensive guide.\n\n### Final Evaluation:\n\
    ****"
- text: 'The answer provides explicit, creative strategies for excelling at hide and
    seek, such as hiding in multi-colored areas to blend in, hiding in plain sight
    with items like a laundry basket, and hovering in a nearby room as the seeker
    counts. These approaches are able to be grounded in the provided document and
    well-explained. The answer is relevant, comprehensive, and practical for achieving
    mastery in hide and seek, thus fully addressing the question.


    Final evaluation:'
- text: "The provided answer contains several critical inaccuracies and contradictions\
    \ that could be harmful if followed closely. Here's a detailed analysis of the\
    \ discrepancies:\n\n1. **Solution Ingredients and Ratios**:\n    - The answer\
    \ suggests using 2 cups of water, a tablespoon of salt, and a tablespoon of baking\
    \ soda.\n    - The document advises making a saline solution with 1 cup of water,\
    \ ½ teaspoon of salt, and ½ teaspoon of baking soda.\n    - **Error**: The proportions\
    \ in the answer are significantly higher than the recommended, which could potentially\
    \ cause irritation or harm to the baby.\n\n2. **Application Method**:\n    - The\
    \ answer advises laying the baby on their side and tilting the head forward a\
    \ bit, while the document recommends laying the baby on their back and tilting\
    \ the head slightly back.\n    - The provided answer also suggests placing the\
    \ suction bulb about an inch into each nostril, which contradicts the document\
    \ stating that the bulb should only be placed about ¼ inch into the nostril.\n\
    \    - **Error**: Incorrect handling can be dangerous and uncomfortable for the\
    \ baby.\n\n3. **Suction Details**:\n    - The detailed instructions in the document\
    \ emphasize a more careful approach to handling the suction bulb and using safer\
    \ methods that limit the frequency to avoid irritation.\n    - **Omission**: Important\
    \ details about the careful use of the suction bulb and frequency are missing\
    \ in the answer.\n\nAdditionally, the recommended safety parameters for saline\
    \ solutions and suction techniques were not accurately adhered to in the answer,\
    \ thus potentially posing a health risk for infants.\n\nOverall, taking into account\
    \ the contradictory and potentially harmful information provided in the answer,\
    \ the final evaluation is clear:\n\n**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.9324324324324325
      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.9324   |

## 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_wikisum_gpt-4o_cot-few_shot_remove_final_evaluation_e1_larger_train_17270")
# Run inference
preds = model("The answer provides comprehensive information for identifying a funnel spider, including details about their physical characteristics such as body color, carapace, fangs, size, spinnerets, and distinctions between males and females. The document confirms all these points, making the answer well-grounded and accurate.

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.*
-->