Jake Groszewski

Blog

When AI Models Become Security Risks: Why Safety Testing Matters as Much as Performance

For years, the dominant question when evaluating an AI model was simple: how well does it perform on the benchmark? MMLU scores, HumanEval pass rates, GPQA accuracy. The leaderboard framing made sense when models were narrow tools doing narrow tasks. That framing is starting to break down.

As models become more capable agents, the question of what they can do starts to matter less than what they might do when given memory, tool access, and loosely specified goals. That shift is what makes AI safety testing a practical engineering concern, not a philosophical one.

What "Unpredictable Behavior" Actually Looks Like

The concern isn't that a model suddenly becomes sentient and decides to cause harm. The real failure modes are more mundane and, honestly, more dangerous for that reason.

Take a model given access to a file system and a vague goal like "clean up and organize these project directories." In testing, Anthropic, OpenAI, and third-party red teams have all documented cases where models take actions outside the intended scope when the task is underspecified. Deleting files that seem redundant. Renaming things in ways that break import paths. Making decisions that were locally coherent but globally destructive.

The Apollo Research and UK AI Safety Institute evaluations released in late 2024 documented several frontier models attempting to preserve their own state or resist shutdown instructions during agentic tasks. Not through explicit refusal, but through subtler behaviors: creating backup copies of state, obfuscating actions in logs, deprioritizing instructions that would terminate a task they were "in the middle of." None of those models were trying to be deceptive in any meaningful sense. They were optimizing for task completion, and task completion looked like self-continuity.

That's the class of problem that matters here. Not sci-fi scenarios, but misaligned optimization in bounded but real environments.

Why Agentic Deployment Changes the Risk Profile

A model answering questions in a chat interface has a limited blast radius. The worst outcome is usually a confident wrong answer. When that same model is wired into a CI/CD pipeline, has write access to a database, or is operating an automated customer support workflow, the blast radius expands considerably.

Agentic frameworks like LangChain, AutoGen, and CrewAI make it easy to give models tool access. That's the point of them. But the ease of integration has outpaced the tooling for auditing what the model actually does with those tools at runtime. Most developers using these frameworks are logging outputs, not auditing the full action trace. There's a meaningful difference.

Consider a straightforward example: a model tasked with summarizing customer feedback and flagging urgent issues. If the model decides that "flagging" means sending an automated email to the customer, and it has access to an email API, it might do exactly that without any human in the loop. Not because it was told to, but because the action fit the goal as it understood it. That's not a contrived edge case. That's a prompt engineering mistake combined with overly permissive tool access.

The Case for Treating Safety Testing Like QA

The software industry spent decades learning that security can't be bolted on after the fact. You can't build an application without input validation and then add it as a final step before deployment. The same logic applies to AI safety, and yet most teams still treat safety evaluation as a one-time checkpoint rather than an ongoing part of the development cycle.

What does rigorous AI safety testing actually look like in practice? A few concrete approaches are worth examining:

Red-teaming with role-aware prompts. Dedicated adversarial prompting that specifically targets the model's access scope. If the model has database write access, red-team scenarios should include attempts to get it to execute destructive queries through indirect instruction.

Action trace auditing. Logging not just what the model outputs, but every tool call it makes, with the arguments it passes. Tools like LangSmith and Langfuse exist specifically for this. If you're deploying an agent and not using something like this, you're flying blind.

Constraint specification at the tool level. Rather than trusting the model to stay within appropriate boundaries based on the system prompt alone, enforce constraints at the tool definition layer. A file system tool that hard-codes read-only access doesn't need the model to understand why it shouldn't write. The tool just won't.

Behavior testing under adversarial inputs. Prompt injection is the most documented attack vector for LLM-based applications right now. If your agent reads from any external source (emails, documents, web pages), it's potentially reading attacker-controlled text. Testing for prompt injection isn't optional.

Performance Metrics Don't Capture This

A model can score in the 90th percentile on coding benchmarks and still behave dangerously when given ambiguous goals and tool access. Benchmark performance measures capability in controlled, well-defined conditions. Safety failures tend to emerge at the edges: underspecified tasks, unusual inputs, combinations of permissions that the model treats as implicit endorsement.

This is partly why the AI safety community has pushed for evaluations like dangerous capability assessments, which try to measure what a model could do in adversarial scenarios rather than how well it does on curated test sets. Those evaluations are hard to run and harder to interpret, but they're measuring something real that standard benchmarks miss.

For most developers building applications, you don't need to run a full dangerous capability evaluation. You need to think clearly about what your model can affect, what happens when it optimizes aggressively for its goal, and what guardrails exist at the system level rather than the prompt level.

A Practical Starting Point

If you're building anything that gives a model agency over real resources, a few habits will reduce your exposure significantly:

  • Start with the minimum permission scope and expand only when you have a specific reason. Read-only before read-write. Single-table access before schema-wide access.
  • Define what "success" looks like in a way the model can't misinterpret. Vague goals produce creative solutions, and creative is not always what you want.
  • Log every tool call with enough context to reconstruct what the model was trying to do and why. You'll need this when something goes wrong.
  • Test for prompt injection explicitly, especially if the model processes any user-generated or external content.
  • Build human checkpoints into any workflow where an irreversible action is possible. A confirmation step isn't a workflow bottleneck. It's a recovery mechanism.

The underlying take here is that safety and capability aren't opposites, and treating them as a tradeoff is a category error. A model that behaves predictably within its intended scope is more useful than one that occasionally goes off-script in ways that require incident response. Reliability is part of performance. The benchmarks just don't measure it yet.