CoolFace
Modelpublic

aryasuneesh-quilr/intent-crossencoder-minilm-L12-v2

sourceHugging Faceapache-2.0updated 7mo agoView on Hugging Face
0likes62downloads
Model Card

intent-crossencoder-minilm-L12-v2

Cross-encoder reranker for enterprise intent detection (DLP / security). Fine-tuned from cross-encoder/ms-marco-MiniLM-L12-v2 on a synthetic intent-detection dataset.

Intended use

Binary classification: given a (user_input, intent_description) pair, predict whether the user input matches the intent. Designed as Stage-2 in a cascading firewall: Stage-1 (fast heuristic) → this model (reranker) → Stage-2 LLM (Qwen).

Input format

user_input [SEP] intent_description

Performance (held-out test set, threshold=0.3)

MetricValue
Recall0.9966
Precision0.9758
F10.9861
AUC-ROC0.9949
PR-AUC0.9899
Best threshold (F1-optimal)0.9655 → F1=0.9888

Training config

ParameterValue
Base modelcross-encoder/ms-marco-MiniLM-L12-v2
Batch size64
Grad accum steps1
Effective batch64
Learning rate2e-05
Label smoothing0.05
Warmup ratio0.06
Max sequence length256
Early stoppingrecall@0.3 (patience=3)
Epochs trained7
Training time3.8 min

Inference snippet

python
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

model_id  = "aryasuneesh-quilr/intent-crossencoder-minilm-L12-v2"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model     = AutoModelForSequenceClassification.from_pretrained(model_id)
model.eval()

def score(user_input: str, intent_description: str) -> float:
    pair = f"{user_input} [SEP] {intent_description}"
    enc  = tokenizer(pair, return_tensors="pt", truncation=True, max_length=256)
    with torch.no_grad():
        logits = model(**enc).logits
    return torch.softmax(logits, dim=1)[0, 1].item()   # P(match)

# Example
s = score(
    "Our AWS_SECRET_ACCESS_KEY was found in a public repo",
    "Identify exposure of authentication credentials or API keys"
)
print(f"Match probability: {s:.4f}")   # use threshold 0.9655 for best F1

Files in this repo

FileDescription
model.safetensorsHF-native weights
best_model.ptRaw PyTorch state_dict (for resuming training)
training_config.jsonFull hyperparameter record
metrics/Per-epoch + test-set evaluation CSVs

Generated 2026-02-23 08:36 UTC by ablation_reranker_training.py