Downloads · 30 days
7
23% of all-time downloads
Kaleemullah/paraphrase-mpnet-ad-classifier
paraphrase-mpnet-ad-classifier is a text classification model from Kaleemullah. Use it when you need a label for a piece of text. It is set up for sentence-transformers. The card lists the license as apache-2.0.
The model "Kaleemullah/paraphrase-mpnet-ad-classifier" adaptation of the SetFit model, a robust architecture designed for text classification tasks. The distinctive feature of this model lies in its ability to leverag…
Downloads · 30 days
7
23% of all-time downloads
All-time downloads
30
Public
Parameters
109M
438 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors438 MB · 100%
From the Hugging Face model README
The model "Kaleemullah/paraphrase-mpnet-ad-classifier" adaptation of the SetFit model, a robust architecture designed for text classification tasks. The distinctive feature of this model lies in its ability to leverage few-shot learning techniques effectively, thereby optimizing performance with limited training data. The model's architecture and training process can be delineated into two primary stages:
Fine-tuning of a Sentence Transformer: At the core of the model is a Sentence Transformer, fine-tuned using a contrastive learning approach. This step focuses on enhancing the transformer's ability to generate semantically rich and contextually nuanced sentence embeddings, a critical factor for accurate classification in downstream tasks.
Training of a Classification Head: Post fine-tuning, the model integrates a classification head. This component is trained utilizing the feature representations extracted from the fine-tuned Sentence Transformer. The classification head's primary role is to map the nuanced sentence embeddings to specific classes, thereby facilitating effective text classification.
The model's design and training methodology underscore its capability to handle a wide range of text classification scenarios, especially in contexts where data availability is limited. This approach not only maximizes the efficiency of the learning process but also ensures the model's applicability in diverse real-world applications where large-scale labeled datasets may not be readily available.

The training dataset for this text classification model is designed to differentiate between ad and non-ad texts. It comprises a balanced set of 2000 ad instances and 2000 non-ad instances, each meticulously curated to train the model effectively. The details of the dataset composition are as follows:
Open Source Datasets: The non-ads portion of the dataset encompasses a variety of text sources to provide a contrast to ad-like text structures. This includes:
The dataset maintains an equal balance between ad and non-ad texts, with 2000 instances in each category. This balance ensures that the model is not biased towards any particular class during training. Additionally, the diversity in the data sources for both ads and non-ads contributes to the robustness of the model, enabling it to effectively distinguish between the two categories in varied contexts.
To use this model for inference, first install the SetFit library:
python -m pip install setfit
You can then run inference as follows:
from setfit import SetFitModel
# Download from Hub and run inference
model = SetFitModel.from_pretrained("Kaleemullah/paraphrase-mpnet-ad-classifier")
# Run inference
preds = model(["i loved the spiderman movie!", "pineapple on pizza is the worst 🤮"])
The model's performance was rigorously evaluated on unseen data to ensure its reliability and effectiveness in real-world applications. The key metric reflecting the model's performance is outlined below:
While the model exhibits high accuracy, it is important to acknowledge its limitations and potential areas of bias:
@article{Kaleemullah2023ParaphraseMPNetAdClassifier,
author = {Kaleem Ullah Qasim},
title = {Paraphrase MPNet for Ad Classification},
year = {2023},
organization = {Southwest Jiaotong University},
model_url = {https://huggingface.co/Kaleemullah/paraphrase-mpnet-ad-classifier},
}