Prompt injection model
Opik Guard, our purpose-built detection model, evaluated on attacks it has never seen
Guardrails are an enterprise feature. Reach out to the Opik team at sales@comet.com to enable them for your account.
Opik Guard is the model behind Opik’s prompt injection guardrail. We trained it ourselves, from scratch, for exactly one job: catching attempts to make your LLM ignore, override, or reveal its instructions, along with other malicious inputs. It is small enough to run inline on every request and accurate enough to trust in the blocking path.
A classifier, not a guess
Opik Guard is a Small Language Model trained as a single-token classifier. It answers with exactly one token, true or false, and both training and inference use only those two class-token logits. The softmax over them is a calibrated probability that the input is an attack.
That design is what makes it dependable: you set a threshold and you know precisely what it means, instead of parsing a larger model’s free-form answer and hoping it stayed on format. A score of 0.9 means the model is 90% confident the input is an injection attempt, every time.
Trained on real attacks
The training set is real adversarial traffic, not toy data: a curated mix of genuine community jailbreaks and instruction-override attacks, pooled with real benign inputs and split into training, validation, and an in-distribution test set.
Evaluated on attacks it has never seen
This is the part we care about most. The headline number comes from an out-of-distribution test set that shares no lineage with the training data: real attacks collected from a completely different source than anything used in training, paired with held-out benign prompts.
Because those evaluation attacks come from a different origin than the training attacks, the score reflects how the model handles novel attacks in the wild, not how well it memorized its training set. Every training run reports accuracy, precision, recall, F1, and AUROC on both the in-distribution and out-of-distribution splits.
We deliberately avoided the trap that flatters most published numbers: the score we trust is the one measured against attacks of a different origin than anything the model saw in training, not one inflated by testing on data that looks just like the training set.
Built for the blocking path
At 1.5 billion parameters, Opik Guard runs on the guardrails server’s GPU with low latency, so you can validate every request without adding meaningful overhead. It sits behind the same guardrails server as the PII and Topic guardrails and is distributed as a private model, so using it only requires a token from the Opik team.
Using it
Turn Opik Guard on with the PromptInjection guard. It reads exactly like the other guards:
See the prompt injection guardrail for usage and the server configuration for the token and model settings.