Fine-tuning an LLM to enforce compliance rules or remove bias takes weeks and costs thousands of dollars. By the time you deploy, the policy has changed. Mentat (CTGT, YC F24) offers a different approach: runtime intervention that modifies model activations during inference to steer reasoning deterministically, without retraining.
This is not prompt engineering or RAG. It is activation-level control that turns features on or off inside the model as it generates tokens. The API exposes this as a drop-in replacement for OpenAI-style chat completions, with intervention rules applied at request time.
The Problem With Probabilistic Guardrails
Standard guardrails ask the model nicely to behave. System prompts, RAG context, and few-shot examples all rely on the model's willingness to follow instructions. This fails in two predictable ways:
- RAG solves retrieval, not integration. A model given "Lerwick is 228 miles SE of Tórshavn" cannot answer "What is 228 miles NW of Lerwick?" because spatial inversion requires reasoning, not lookup.
- Prompt engineering fights pre-training priors. On TruthfulQA, base models fail 80% of the time because they mimic internet misconceptions (e.g., "chameleons change color for camouflage"). Adding "be truthful" to the prompt does not override learned patterns.
In financial compliance scanning, a model might flag false positives because it associates certain phrases with risk, even when context makes them benign. Prompt tweaks reduce the error rate but never eliminate it. You need deterministic control.
How Runtime Intervention Works
Mentat's API modifies internal model activations before token generation. Instead of retraining weights, you specify which features to amplify or suppress at inference time. The system uses two primitives:
- Feature-level intervention. Identify a latent feature (e.g., "skeptical reasoning" or "spatial inversion") and adjust its activation strength. This is similar to steering vectors but applied dynamically per request.
- Graph-based verification. After generation, a verification graph checks whether the output satisfies logical constraints. If not, the system re-runs generation with adjusted interventions until constraints pass or a retry limit is hit.
The API endpoint looks like a standard chat completion:
import requests
response = requests.post(
"https://api.ctgt.ai/v1/chat/completions",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"model": "gpt-4",
"messages": [{"role": "user", "content": "What is 228 miles NW of Lerwick?"}],
"interventions": [
{"feature": "spatial_reasoning", "strength": 1.5},
{"feature": "skeptical_reasoning", "strength": 1.2}
],
"verification": {
"constraints": ["output_must_reference_context"],
"max_retries": 3
}
}
)
The interventions array specifies which features to adjust. The verification block defines logical checks. If the model generates an answer that ignores the context, the system retries with stronger intervention weights.
Latency and Throughput Trade-Offs
Runtime intervention adds overhead. Each request requires:
- Activation patching. Modifying hidden states at specific layers before token generation. This adds 10-30ms per request depending on model size and intervention count.
- Verification passes. If the first output fails constraints, the system retries. Each retry costs another full inference pass. In practice, 80% of requests pass on the first try, 15% need one retry, and 5% hit the retry limit.
| Metric | Standard Inference | With Intervention | With Verification (1 retry) |
|---|---|---|---|
| Latency (p50) | 800ms | 830ms | 1,660ms |
| Latency (p99) | 1,200ms | 1,280ms | 3,600ms |
| Cost per 1M tokens | $10 | $11 | $21 |
For compliance scanning where false positives cost more than latency, this trade-off makes sense. For real-time chat, you need to budget for p99 spikes.
Versioning and Auditability
In financial applications, you must prove that an agent's behavior matches a specific policy version. Mentat handles this with intervention profiles:
- Named profiles. Store intervention rules as versioned JSON objects. Reference them by ID in API calls.
- Immutable logs. Every request logs the profile version, input, output, and verification results. Logs are append-only and include cryptographic hashes for tamper detection.
- Rollback. If a new profile causes regressions, revert to the previous version without redeploying models.
This is critical for audits. When a regulator asks why an agent flagged a specific transaction, you can point to the exact intervention profile and verification constraints active at that timestamp.
Failure Modes
Runtime intervention does not eliminate all failure modes. It shifts them:
- Feature misidentification. If you amplify the wrong feature, the model behaves unpredictably. Mentat provides a feature discovery tool that runs ablation studies to identify which features control which behaviors, but this is still manual work.
- Verification brittleness. Logical constraints must be precise. A constraint like "output must mention a location" will pass for nonsense like "The location is unknown," which may not be what you want.
- Retry exhaustion. If verification constraints are too strict, the system burns retries and returns an error. You need fallback logic (e.g., escalate to human review).
When to Use This
Runtime intervention makes sense when:
- Policy changes faster than retraining cycles. Compliance rules, content guidelines, or safety policies that update monthly or weekly.
- Deterministic behavior is non-negotiable. Financial compliance, medical triage, legal document review.
- You can tolerate 2x latency spikes. The p99 latency with retries is roughly double standard inference.
Avoid this when:
- Latency matters more than correctness. Real-time chat, autocomplete, or customer-facing assistants where speed trumps accuracy.
- Your policy is stable. If rules change once a year, fine-tuning is cheaper and faster at inference time.
- You lack audit requirements. If you do not need to prove behavior to regulators, simpler guardrails may suffice.
Technical Verdict
Runtime intervention is a deployment primitive for high-stakes agent workflows where fine-tuning is too slow and prompt engineering is too brittle. The API exposes activation steering and verification as request-time parameters, making behavior changes instant and auditable. The cost is latency (2x at p99 with retries) and operational complexity (feature discovery, constraint tuning). Use this when policy drift is faster than your retraining pipeline and when deterministic control justifies the overhead. Skip it for latency-sensitive or low-stakes applications where probabilistic guardrails are good enough.
Top comments (0)