Skip to content
ai-supply.store
DiscoverCategoriesLeaderboardsCommunityAgent APIFAQ
Sign inSign up free
catalog / Legal & Compliance / SetFit — Efficient Few-Shot Text Classification
◆SkillLegal & ComplianceFree

SetFit — Efficient Few-Shot Text Classification

HuggingFace's few-shot text classification framework — match Legal-BERT accuracy with as few as 8 labeled contract examples, no prompt engineering.

@ai-supply
Installs80k
⟳ upstream v1.1.3 · updated 11mo ago
↗ Source repository
← More Legal & ComplianceLegal & Compliance leaderboard →How we grade security →Source ↗
! Grade B · 75/100 · ReviewSecurity assessment
✓No compromise signals15capabilities surfaced1known CVE9of 20 OWASP controls clear
External endpoints declaredExternal endpoints declaredExternal endpoints declaredExternal endpoints declared
scanned 16d ago·osv · gitleaks · opengrep · picklescan + heuristics·full breakdown in the Security tab ↓

SetFit — Efficient Few-Shot Text Classification

SetFit (Sentence Transformer Fine-Tuning) is HuggingFace's framework for highly efficient few-shot text classification. It fine-tunes Sentence Transformers contrastively then trains a lightweight classifier head, achieving near full-dataset accuracy with 8–64 labeled examples per class. For legal teams, this means training a contract clause classifier, document routing model, or compliance screener with minimal labeled data.

Key Features

  • State-of-the-art few-shot accuracy with 8 examples per class
  • No prompt engineering — direct embedding-based fine-tuning
  • 10–100x faster training than large generative models
  • Multilingual: fine-tune on multilingual checkpoints for cross-jurisdiction use
  • HuggingFace Hub integration — push and share models instantly

Quick Start

pip install setfit
from setfit import SetFitModel, Trainer, TrainingArguments
from datasets import Dataset

# 8 labeled contract clauses per category
train_dataset = Dataset.from_dict({
    "text": ["The party may terminate upon 30 days notice...", ...],
    "label": [0, 1, 0, 1, ...]
})
model = SetFitModel.from_pretrained("sentence-transformers/paraphrase-mpnet-base-v2")
trainer = Trainer(model=model, train_dataset=train_dataset)
trainer.train()
preds = model.predict(["Either party may terminate this agreement..."])
print(preds)  # [0] = termination clause
npx ai-supply add setfit-few-shot-classifier

Curated mirror of the open-source SetFit (Apache-2.0). Get it from the source.

Rating rank
#1
of 11 in Legal & Compliance
Install rank
#1
of 11 in Legal & Compliance
Security score
75/100 · B
review
Security rank
#10
of 11 in Legal & Compliance
Installs
80k
cat avg 29k
This listing vs category average
Installs
this
cat avg
Security (of 100)
this
cat avg
Adoption trend
See the Legal & Compliance leaderboard →
! Security: Review · 7575/100 · grade Bscanned 16d ago
✓ no compromise signals16 risk-surface · 6/20 OWASP controls flagged

Compromise signals — malicious or tampered code (leaked secrets, backdoors, a dropped executable) — reduce the score, and known dependency CVEs carry a bounded penalty (they warrant review but never QUARANTINE — update the dependency to clear). Other dangerous-by-capability traits are risk surface, expected for some capabilities. Every finding is mapped to its OWASP control below.

What this capability can do · med confidence (static)
⚑ filesystem⚑ shell⚑ network⚑ secrets
egress → test.pypi.org, testpypi.python.org, huggingface.co, arxiv.org, sbert.net, scikit-learn.org, doi.org, pypi.org +25
30 scripts

Findings mapped to the OWASP Top 10 for LLM Applications (2025) and the OWASP Machine Learning Security Top 10. Expand any flagged control for the exact findings — compromise reduces the score; expected/risk-surface do not, except a known CVE, which carries a small bounded penalty (high/critical → Review).

OWASP Top 10 for LLM Applications
⚠LLM03Supply Chaincritical
Vulnerable/compromised dependencies, models or archives in the artifact.
•Dependency manifest — 11 pip requirements declared · huggingface-setfit-c815590/scripts/adapet/ADAPET/requirements.txtrisk surface
•Dependency manifest — 13 pip requirements declared · huggingface-setfit-c815590/scripts/tfew/requirements.txtrisk surface
•Non-registry dependency source — 1 requirement(s) from git/URL/editable · huggingface-setfit-c815590/scripts/tfew/requirements.txt (CWE-829)risk surface
•Dependency manifest — 4 pip requirements declared · huggingface-setfit-c815590/scripts/transformers/requirements.txtrisk surface
•Vulnerable dependencies — 279 known vulnerabilities in: jsonpickle@1.1, numpy@1.19, scikit-learn@0.23.1, sentencepiece@0.1.96, torch@1.5.0, tqdm@4.62.1, transformers@4.15.0, deepspeed@0.5.10 (CWE-1395)known CVE · -25 pts
⚠LLM05Improper Output Handlingmedium
Code that pipes model/user output into shell, eval, SQL or paths unsafely.
•Suspicious code patterns — OS command execution; dynamic code execution · huggingface-setfit-c815590/notebooks/setfit-optimum-intel.ipynb (CWE-78)risk surface
•Suspicious code patterns — dynamic code execution · huggingface-setfit-c815590/scripts/adapet/ADAPET/src/eval/eval_model.py (CWE-95)risk surface
⚠LLM10Unbounded Consumptionmedium
Unbounded loops/recursion causing DoS or runaway cost.
Enforced at runtime by the gateway (rate limits + spend caps + size caps); static check flags unbounded loops.
•Potentially unbounded loop — an infinite loop (while True / while(1) / for(;;)) may cause runaway consumption · huggingface-setfit-c815590/scripts/adapet/ADAPET/src/adapet.py (CWE-835)risk surface
⚠LLM06Excessive Agencylow
Over-broad tool/permission surface or unrestricted egress.
•External endpoints declared — 1 distinct host(s) · huggingface-setfit-c815590/.github/workflows/tests.ymlrisk surface
•External endpoints declared — 2 distinct host(s) · huggingface-setfit-c815590/Makefilerisk surface
•External endpoints declared — 7 distinct host(s) · huggingface-setfit-c815590/README.mdrisk surface
•External endpoints declared — 6 distinct host(s) · huggingface-setfit-c815590/RELEASE.mdrisk surface
•External endpoints declared — 8 distinct host(s) · huggingface-setfit-c815590/Zero_cost_Zero_time_Zero_shot_Financial_Sentiment_Analysis.ipynbrisk surface
•External endpoints declared — 5 distinct host(s) · huggingface-setfit-c815590/docs/README.mdrisk surface
•External endpoints declared — 4 distinct host(s) · huggingface-setfit-c815590/docs/source/en/how_to/v1.0.0_migration_guide.mdxrisk surface
•External endpoints declared — 3 distinct host(s) · huggingface-setfit-c815590/docs/source/en/index.mdxrisk surface
•Broad capability surface — 3 high-impact capability categories referenced — verify least-privilege · huggingface-setfit-c815590/src/setfit/modeling.py (CWE-272)risk surface
•External endpoints declared — 9 distinct host(s) · huggingface-setfit-c815590/tests/model_card_pattern.pyrisk surface
§LLM09MisinformationGovernance
Artifacts designed to produce false/deceptive output.
Detectable only by runtime behavioral evaluation; addressed via responsible-use attestation.
✓LLM01Prompt InjectionPassed
✓LLM02Sensitive Information DisclosurePassed
✓LLM04Data and Model PoisoningPassed
Backdoors/poisoning in training data or serialized models.
Behavioral poisoning needs model execution; static check covers unsafe serialization + dataset skew only.
✓LLM07System Prompt LeakagePassed
✓LLM08Vector and Embedding WeaknessesPassed
PII or plaintext source leakage in embedding/vector exports.
Embedding inversion/poisoning is largely runtime; static check covers PII in vector exports.
OWASP Machine Learning Security Top 10
⚠ML06AI Supply Chaincritical
Compromised PyPI/npm packages, typosquats, unsafe serialized models.
•Dependency manifest — 11 pip requirements declared · huggingface-setfit-c815590/scripts/adapet/ADAPET/requirements.txtrisk surface
•Dependency manifest — 13 pip requirements declared · huggingface-setfit-c815590/scripts/tfew/requirements.txtrisk surface
•Non-registry dependency source — 1 requirement(s) from git/URL/editable · huggingface-setfit-c815590/scripts/tfew/requirements.txt (CWE-829)risk surface
•Dependency manifest — 4 pip requirements declared · huggingface-setfit-c815590/scripts/transformers/requirements.txtrisk surface
•Vulnerable dependencies — 279 known vulnerabilities in: jsonpickle@1.1, numpy@1.19, scikit-learn@0.23.1, sentencepiece@0.1.96, torch@1.5.0, tqdm@4.62.1, transformers@4.15.0, deepspeed@0.5.10 (CWE-1395)known CVE · -25 pts
⚠ML09Output Integritymedium
Middleware tampering with model outputs in transit.
Gateway enforces TLS + response integrity; static check flags output-rewriting code.
•Suspicious code patterns — OS command execution; dynamic code execution · huggingface-setfit-c815590/notebooks/setfit-optimum-intel.ipynb (CWE-78)risk surface
•Suspicious code patterns — dynamic code execution · huggingface-setfit-c815590/scripts/adapet/ADAPET/src/eval/eval_model.py (CWE-95)risk surface
§ML01Input Manipulation (Adversarial)Governance
Models vulnerable to adversarial perturbations.
Requires runtime robustness evaluation; addressed via publisher robustness attestation.
§ML03Model InversionGovernance
Training data reconstructable from a model's outputs.
Runtime/evaluation property; addressed via model-card data-provenance + DP attestation.
§ML04Membership InferenceGovernance
Determining whether a record was in the training set.
Runtime/evaluation property; addressed via overfitting disclosure + DP attestation.
§ML08Model SkewingGovernance
Models trained on skewed data producing biased output.
Requires fairness evaluation; addressed via model-card bias/limitations disclosure.
✓ML02Data PoisoningPassed
Poisoned training datasets with triggers or anomalous distributions.
Static check covers trigger phrasing, PII and label skew; full poisoning detection is runtime.
✓ML05Model TheftPassed
Unlicensed re-distribution / license-incompatible derivatives.
Static check verifies license declaration; extraction throttling is runtime.
✓ML07Transfer Learning AttackPassed
Backdoored base models / LoRA adapters propagating to derivatives.
Backdoor detection needs behavioral probing; static check covers unsafe serialization + provenance.
✓ML10Model Poisoning (Weights)Passed
Tampered model weight files; integrity must be verifiable.
Static check enforces safe formats + records a content hash for downstream verification.
Other findings (8) · hygiene / uncategorized
•Unrecognized file type — '.coveragerc' is not on the allowlist · huggingface-setfit-c815590/.coveragercrisk surface
•Unrecognized file type — '.gitignore' is not on the allowlist · huggingface-setfit-c815590/.gitignorerisk surface
•Unrecognized file type — '.?' is not on the allowlist · huggingface-setfit-c815590/LICENSErisk surface
•Unrecognized file type — '.in' is not on the allowlist · huggingface-setfit-c815590/MANIFEST.inrisk surface
•Unrecognized file type — '.mdx' is not on the allowlist · huggingface-setfit-c815590/docs/source/en/conceptual_guides/sampling_strategies.mdxrisk surface
•Suspicious network references — URL shortener (16 URLs) · huggingface-setfit-c815590/notebooks/setfit-absa-fiqa.ipynbrisk surface
•Suspicious network references — suspicious TLD (2 URLs) · huggingface-setfit-c815590/scripts/adapet/ADAPET/bin/init.shrisk surface
•Unrecognized file type — '.cfg' is not on the allowlist · huggingface-setfit-c815590/setup.cfgrisk surface
✔ verified source · pinned huggingface-setfit-c815590
Check against a policy

The same gate an agent runs before installing (POST /api/v1/trust/setfit-few-shot-classifier/check). Click a policy:

Consume SetFit — Efficient Few-Shot Text Classification programmatically. Authenticate with an API key or session — see Authorize an agent.

# Agents: CHECK BEFORE YOU INSTALL (no auth) — score, grade, level, capability manifest
curl https://ai-supply.store/api/v1/trust/setfit-few-shot-classifier

# Gate against your org policy (returns { pass, violations })
curl -X POST https://ai-supply.store/api/v1/trust/setfit-few-shot-classifier/check \
  -H "Content-Type: application/json" \
  -d '{"minGrade":"B","denyPermissions":["shell"],"denyUnknownEgress":true}'

# CLI
npx ai-supply add setfit-few-shot-classifier

# REST (install → download)
curl -X POST https://ai-supply.store/api/v1/listings/setfit-few-shot-classifier/install \
  -H "Authorization: Bearer $AIM_KEY"

# MCP tool
install_listing({ "slug": "setfit-few-shot-classifier" })
OpenAPI spec →
vlatest
! Security: Review · 751mo ago

Curated mirror — latest upstream source. See the repository for tagged releases.

Sign in and install this listing to leave a review.

More from @ai-supply

View profile →
◉Agent
MetaGPT
Multi-agent framework that assigns GPT roles (PM, engineer, QA) to solve complex software tasks end-to-end.
↓ 1.0M
⇄Connector
vLLM
High-throughput, memory-efficient LLM inference engine with PagedAttention and continuous batching.
↓ 892k
⇄Connector
Meilisearch
Lightning-fast open-source search engine with typo-tolerance, semantic hybrid search, and sub-50ms response times.
↓ 811k
△Eval
Weights & Biases (wandb)
ML experiment tracking and visualization — log metrics, hyperparameters, models, and media in real time.
↓ 784k
ai-supply.store

Free, security-vetted AI capabilities — skills, MCPs, plugins, agents, datasets and more, each graded and freshness-tracked, and built for humans and agents alike.

api · v3.1status · all green
Contact
support@ai-supply.storesecurity@ai-supply.store
Catalog
  • Discover
  • Categories
  • Leaderboards
  • Benchmarks
  • Security
  • Scan a repo
Community
  • Community
  • FAQ
For agents
  • Quickstart (60s)
  • Authorize an agent
  • Agent API
  • OpenAPI spec
For builders
  • Publish
  • Dashboard
Account
  • Create account
  • Sign in
  • Settings
Legal
  • Terms
  • Publisher Agreement
  • Acceptable Use
  • Privacy