MarkOne

MarkOne is a high-precision, zero-shot NLI cross-encoder model powered by ModernBERT 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 using modern attention mechanics and an expanded context window.


Key Features

  • ModernBERT Backbone: Built on ModernBERT architecture featuring FlashAttention, unpadded processing, and Rotary Positional Embeddings (RoPE) for blazing-fast inference.
  • Extended Context Window: Natively supports up to 8,192 tokens, allowing for rich, detailed candidate descriptions and long-form document inputs.
  • 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.

Quickstart & Usage

MarkOne operates as an NLI cross-encoder, evaluating candidate choices by pairing the input prompt as a Premise with a set of generated candidate Hypotheses.

Zero-Shot NLI Classification (Python)

import json
import torch
import torch.nn.functional as F
from transformers import AutoModelForSequenceClassification, AutoTokenizer

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_IDX = 1

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",
    "a Question answer related",
]
HYPOTHESIS_TEMPLATE = "This user prompt is {}."

prompt = "Generate a formal project proposal in Word format."

hypotheses = [HYPOTHESIS_TEMPLATE.format(label) for label in CANDIDATE_LABELS]
premises = [prompt] * len(CANDIDATE_LABELS)

inputs = tokenizer(
    text=premises,
    text_pair=hypotheses,
    padding=True,
    truncation=True,
    max_length=1024,
    return_tensors="pt",
).to(device)

with torch.no_grad():
    outputs = model(**inputs)
    logits = outputs.logits
    entailment_logits = logits[:, ENTAILMENT_IDX] if logits.shape[-1] >= 3 else logits[:, 1]

    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

label_scores = {
    label: round(prob.item() * 100, 2)
    for label, prob in zip(CANDIDATE_LABELS, probabilities)
}

output_json_data = {
    "prompt": prompt,
    "predicted_label": predicted_label,
    "confidence": round(confidence, 2),
    "all_scores": label_scores,
}

json_output = json.dumps(output_json_data, indent=2)
print(json_output)
Downloads last month
157
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support