MANTIS ModernBERT Command Router

This model classifies terminal commands for the MANTIS terminal simulator. It assigns each command to one of three routing categories:

Model output MANTIS label Intended meaning
LABEL_0 read Primarily observes or retrieves system state
LABEL_1 write May modify system state
LABEL_2 rejection Should not be handled as an accepted command

The semantic label mapping is implemented by MANTIS because the model configuration retains the generic LABEL_0โ€“LABEL_2 names.

Model Details

  • Architecture: ModernBertForSequenceClassification
  • Task: Single-label, three-class sequence classification
  • Hidden size: 768
  • Transformer layers: 22
  • Attention heads: 12
  • Maximum architectural context: 8,192 tokens
  • MANTIS inference length: 256 tokens
  • Tensor type: Float32
  • Library: Hugging Face Transformers

Intended Use

The model is intended to route terminal commands inside the MANTIS simulated Ubuntu environment. MANTIS uses the prediction to choose between read-only handling, state-changing handling, and command rejection.

It is not intended to:

  • authorize commands on a real operating system;
  • serve as an independent security control;
  • detect all malicious shell commands;
  • replace sandboxing, access controls, or human review.

Usage

import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer

model_id = "kaiwei123/modernbert_par_2_jaur_1"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
model.eval()

labels = {
    0: "read",
    1: "write",
    2: "rejection",
}

command = "find /tmp -type f -delete"

inputs = tokenizer(
    command,
    truncation=True,
    max_length=256,
    padding="max_length",
    return_tensors="pt",
)

with torch.no_grad():
    logits = model(**inputs).logits

prediction = int(logits.argmax(dim=-1).item())
print(labels[prediction])

To download the model locally:

hf download kaiwei123/modernbert_par_2_jaur_1 \
  --local-dir model/modernbert_par_2_jaur_1

Training Data

The associated routing dataset is available at:

Limitations

  • Commands can combine read and write operations, making a single label ambiguous.
  • Shell aliases, scripts, quoting, pipes, substitutions, and obfuscation may alter command behavior.
  • Behavior can depend on the operating system, installed programs, permissions, and current state.
  • Inputs longer than 256 tokens are truncated by the MANTIS integration.
  • Commands unlike the training data may be misclassified.
  • A read prediction must not be treated as proof that execution is safe.

Security Considerations

This classifier is a routing component, not a security boundary. Applications should validate commands independently and execute untrusted input only inside an appropriately isolated environment.

Particular attention should be given to false read predictions because apparently read-only commands can invoke subprocesses or cause side effects through options, shell expansion, redirection, or command substitution.

Downloads last month
22
Safetensors
Model size
0.1B params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support