Five-class response sufficiency classifier using DeBERTa-v3 as a cross-encoder.
Takes (objective, response) pairs as separate inputs with direct cross-attention
between the two texts.
1 misclassification out of 374 Triage test samples.
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_id = "KingTechnician/osmosis-crossencoder-joint-v2"
5model = AutoModelForSequenceClassification.from_pretrained(model_id)
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7
8labels = ["ADDR_DIRECT", "ADDR_PARTIAL", "NOADDR_ON", "NOADDR_TANGENTIAL", "NOADDR_OFF"]
9
10objective = "What causes rain?"
11response = "Rain forms when water vapor in the atmosphere condenses into droplets."
12
13inputs = tokenizer(objective, response, return_tensors="pt", truncation=True, max_length=512)
14with torch.no_grad():
15 logits = model(**inputs).logits
16 prediction = logits.argmax(dim=-1).item()
17
18print(f"Prediction: {labels[prediction]}")
Cross-encoder. The model processes [CLS] objective [SEP] response [SEP] as a
single input, allowing full self-attention between objective and response
tokens. This is essential for response sufficiency classification because the
judgment depends on token-level alignment between what was asked and what was
answered.