Downloads · 30 days
45
57% of all-time downloads
querypieai/dlp-tier2-en-electra-auto-f2
dlp-tier2-en-electra-auto-f2 is a text classification model from querypieai. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
This model is an English sequence classifier for the second stage of a DLP pipeline. It is fine-tuned from google/electra-small-discriminator on the EN2 hard-negative merged dataset.
Downloads · 30 days
45
57% of all-time downloads
All-time downloads
79
Public
Parameters
13.5M
54.2 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors54.2 MB · 99%
From the Hugging Face model README
This model is an English sequence classifier for the second stage of a DLP pipeline. It is fine-tuned from google/electra-small-discriminator on the EN2 hard-negative merged dataset.
Here, "Tier 2" refers to the second stage of a DLP detection pipeline, not a model architecture or version.
| Stage | Role | Method |
|---|---|---|
| Tier 1 | Initial candidate detection | Fast rule-based filtering such as security rules, regular expressions, and keyword or string matching |
| Tier 2 | Re-review of initial candidates | Context classification models such as this model to re-classify leakage risk |
This model is designed for text that Tier 1 has already flagged as a candidate or that policy requires for secondary review. It is not intended as a direct classifier for every arbitrary document; use it as the precision re-review stage after a rule-based first-stage filter.
| Label ID | Meaning |
|---|---|
| 0 | benign |
| 1 | leakage_risk |
The label names are descriptive metadata for the classification task. The training and inference code use integer labels.
Use this model to re-review text that a first-stage DLP filter flags or moves to a secondary review stage. It is designed for sentence- or paragraph-level risk classification, not for character-span extraction. Production use should combine the model with the pipeline's chunking, threshold, and policy logic.
128-character chunks with 32 characters of overlap, then evaluates each chunk independently.truncation=True, padding=True, and max_length=256.The model returns class logits for each input chunk:
logits[0]: score for class benign (label ID 0)logits[1]: score for class leakage_risk (label ID 1)Apply softmax to obtain class probabilities. The recommended positive-class probability is probabilities[1]. If it is greater than or equal to the decision threshold, classify the chunk as leakage_risk; otherwise classify it as benign.
For a multi-chunk document, the project pipeline reports the maximum chunk score as the document risk score and then applies the same threshold. The model itself does not aggregate multiple chunks.
transformers and torch.AutoTokenizer and AutoModelForSequenceClassification interfaces; no trust_remote_code or custom Python code is required.model.eval() before inference and disable gradient calculation for production CPU/GPU inference.truncation=True, padding=True, and max_length=256.querypieai/dlp-tier2-en-electra-auto-f2 repository ID. For offline loading, use the local directory path containing this model card.0.42 for the positive-class probability25612832The threshold was selected on validation data using the F2 objective with recall_min=0.9 and false_positive_rate_max=0.2. The threshold is not a model calibration parameter; it is a policy decision applied after probability calculation.
google/electra-small-discriminator25,553 / 3,708 / 3,751 recordsleakage_risk) ratio by split: train 7.06%, validation 10.17%, test 10.02%03.317508234735466e-05852560.030.0Test metrics at threshold 0.42:
| Metric | Value |
|---|---|
| Accuracy | 0.9797 |
| Precision | 0.8713 |
| Recall | 0.9362 |
| F1 | 0.9026 |
| F2 | 0.9224 |
| False positive rate | 0.0154 |
| False negative rate | 0.0638 |
Validation metrics at the selected threshold and final configuration:
| Metric | Value |
|---|---|
| Accuracy | 0.9984 |
| Precision | 1.0000 |
| Recall | 0.9841 |
| F1 | 0.9920 |
| F2 | 0.9872 |
| False positive rate | 0.0000 |
| False negative rate | 0.0159 |
The validation and test F1 values differ notably. Review split-level writing-style variation and group construction before using this checkpoint as a production gate.
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
model_id = "querypieai/dlp-tier2-en-electra-auto-f2"
threshold = 0.42
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
model.eval()
text = "Enter the text to review here."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=256, padding=True)
with torch.no_grad():
logits = model(**inputs).logits
positive_probability = torch.softmax(logits, dim=-1)[0, 1].item()
prediction = "leakage_risk" if positive_probability >= threshold else "benign"
print({"score": positive_probability, "prediction": prediction})