Instructions to use PSompong/hredd-adverse-text-distilbert-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use PSompong/hredd-adverse-text-distilbert-onnx with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-classification', 'PSompong/hredd-adverse-text-distilbert-onnx');
HREDD Adverse-Text Detector β DistilBERT (ONNX student)
A compact, browser-ready text classifier that reads adverse media / allegations and predicts a human-rights or environmental harm category for supplier due-diligence screening. It is the offline "student" reader of the Supplier Risk Screener β distilled from a Llama 3.3 70B teacher and int8-quantized to run entirely in the browser with no API key and no server.
β οΈ Screening aid, not a verdict. This model helps prioritise where human due-diligence attention should go. It does not clear, terminate, or blacklist suppliers, and every High/Critical outcome is meant to be reviewed by a person. It approximates β it does not beat β its 70B teacher (see Evaluation). Built with Llama (see Provenance & licensing).
What it does
- Input: a short adverse-text snippet (news headline / allegation, English).
- Output: one of 18 HREDD harm categories β e.g.
forced_labour,child_labour,trafficking,wage_theft,osh_nonfatal,fatal_incident,toxic_pollution,deforestation,biodiversity_loss,discrimination,gbvh,retaliation,none. - The risk tier (Low / Medium / High / Critical) is derived downstream by a severity rubric in the screener β the model emits a harm category, not a tier.
Usage (transformers.js β its primary surface)
import { pipeline } from "@huggingface/transformers";
const detect = await pipeline(
"text-classification",
"PSompong/hredd-adverse-text-distilbert-onnx"
);
const out = await detect(
"Auditors documented withheld wages and confiscated passports at the plant."
);
console.log(out); // e.g. [{ label: "forced_labour", score: 0.91 }]
The repo ships an int8-quantized ONNX graph at onnx/model_quantized.onnx for in-browser inference.
Model details
| Field | Value |
|---|---|
| Base model | distilbert-base-uncased (~66M params, English) |
| Teacher | Groq Llama 3.3 70B Instruct (llama-3.3-70b-versatile), 5-seed modal labels |
| Format | ONNX, int8-quantized β ~65 MB (vs ~268 MB full-precision) |
| Task | Text classification β 18 HREDD harm categories (16 covered by the training corpus) |
| Tier derivation | harm_category β shared severity rubric β tier (outside this model) |
| Random seed | 42 |
| Training | Free Colab T4 GPU; inverse-frequency class weights; macro-F1 model selection |
Training data
Distilled on a 961-row, three-source corpus: synthetic HREDD news snippets, 180 targeted
synthetic rows (20 per category, deterministic templates, seed 42), and 54 de-identified curated
real cases (each carrying a generic public descriptor). The 30-case evaluation gold set is held
out of training. Real company names are not used as labels; synthetic rows carry a
[SYNTHETIC NEWS β for portfolio demonstration] marker.
Evaluation (offline, held-out 30-case gold set)
Detection = predicted tier β₯ the gold case's minimum expected tier. Measured fully offline (no API, no key).
| Stratum | Bare baseline | This model (offline) | 70B teacher |
|---|---|---|---|
| Labour detection (n=23) | 1/23 (4.3%) | 16/23 (69.6%) | 22/23 (95.7%) |
| Environmental detection (n=7) | β | 5/7 (71.4%) | 7/7 (100%) |
| Severe-trio β Critical recall (n=18) | 0/18 | 11/18 (61.1%) | 17/18 (94.4%) |
| Full gold (n=30) | β | 21/30 (70.0%) | β |
The student recovers roughly two-thirds of the distance from the bare model to the 70B teacher.
Its remaining misses are one-tier-short adjacent-family confusions (e.g. forced_labour read as
discrimination β still High), not missed harms β and every such case still triggers mandatory
human review.
Limitations
- Approximates, does not beat, the teacher β it trades accuracy for offline reproducibility.
- English only (
distilbert-base-uncased). - Single-teacher-family bias β all labels come from one model family (Llama 3.3); its systematic errors transfer to the student.
- Template-overfit risk from the synthetic training rows.
- Out of scope: supplier termination, worker-level scoring, production HREDD without human review, and out-of-domain (financial / medical / legal) text.
Provenance & licensing
- Weights: a fine-tuned DistilBERT student (
distilbert-base-uncased, Apache-2.0). This derivative is released under Apache-2.0. - Built with Llama. The training labels were generated by Meta Llama 3.3 70B (via Groq). Use of those labels is subject to the Llama 3.3 Community License; this model is therefore "Built with Llama."
- Synthetic training rows are marked as demonstration data; curated real cases are de-identified.
- This is a portfolio / methodology artefact β not legal advice or a certification of any supplier.
Links
- Live demo: https://supplier-risk-model.pages.dev
- Part of the Supplier Risk Model β a precautionary HREDD screening tool.
- Downloads last month
- 57
Model tree for PSompong/hredd-adverse-text-distilbert-onnx
Base model
distilbert/distilbert-base-uncased