MarkOne
MarkOne is a high-precision, zero-shot NLI cross-encoder model designed for dynamic intent routing and query classification within modular AI architectures .
It evaluates user prompts against arbitrary numbers of candidate choice labels (N = 3, 6, 8,..) by computing sequence pair entailment probabilities without requiring dedicated single-label classification fine-tuning for every domain.
π Key Features
- Dynamic Choice Counts: Handles variable numbers of candidate labels on the fly across different routing domains.
- Cross-Encoder Accuracy: Outperforms single-text classifiers by evaluating joint attention over
(Premise, Hypothesis)pairs. - DocGeniee Native: Pre-configured for routing document generation workflows (Word, Excel, PowerPoint), PDF RAG queries, and chitchat/out-of-scope filtering.
π Quickstart & Usage
Because MarkOne operates as an NLI cross-encoder, it evaluates candidate choices by pairing the input prompt as a Premise with a set of generated candidate Hypotheses.
Zero-Shot NLI Classification (Python)
import torch
import torch.nn.functional as F
from transformers import AutoTokenizer, AutoModelForSequenceClassification
# Load model and tokenizer
MODEL_ID = "ChandruK/MarkOne"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
model = AutoModelForSequenceClassification.from_pretrained(MODEL_ID).to(device)
model.eval()
# Entailment label index (Index 2 for standard DeBERTa MNLI architecture)
ENTAILMENT_IDX = 2
# 1. Define Candidate Labels and Hypothesis Template
CANDIDATE_LABELS = [
"a Word document creation request",
"an Excel spreadsheet creation request",
"a PowerPoint presentation deck creation request",
"a PDF document analysis or extraction query",
"general chitchat or off-topic conversation"
]
HYPOTHESIS_TEMPLATE = "This user prompt is {}."
# 2. Input Prompt
prompt = "Generate a formal project proposal in Word format."
# 3. Construct Premise-Hypothesis Pairs
hypotheses = [HYPOTHESIS_TEMPLATE.format(label) for label in CANDIDATE_LABELS]
premises = [prompt] * len(CANDIDATE_LABELS)
# 4. Tokenize Pairs
inputs = tokenizer(
text=premises,
text_pair=hypotheses,
padding=True,
truncation=True,
return_tensors="pt"
).to(device)
# 5. Model Inference
with torch.no_grad():
outputs = model(**inputs)
# Extract Entailment logits vector across all dynamic candidates
entailment_logits = outputs.logits[:, ENTAILMENT_IDX]
# Softmax probability normalization
probabilities = F.softmax(entailment_logits / 0.5, dim=-1)
top_prob, top_idx = torch.max(probabilities, dim=-1)
predicted_label = CANDIDATE_LABELS[top_idx.item()]
confidence = top_prob.item() * 100
print(f"π¬ Prompt : '{prompt}'")
print(f"π·οΈ Predicted : {predicted_label} ({confidence:.2f}% confidence)")
- Downloads last month
- -