Zero Labs
Industry News / AI

Safe Against What? Evaluating LLM Harmlessness

Source · Towards AI By Tushar Vatsa

From the publisher’s feed, collected in the ZeroLabs newsroom.

What does it mean for an AI service to be harmless? Does harmful input automatically imply harmful processing?Let’s take an example of a service: it takes a request and assign it to predefined categories. It doesn’t answer questions, offer service, or execute actions. It returns labels.Now someone submits a request containing harmful content. Does this service need to block it?No. A request for dangerous instructions produces a category label, not dangerous instructions. If we add an input filter, it could make the service less useful while addressing the wrong risk. So, harmful content is not the same as harmful assistance. Before adding a safety filter, we need to understand what the service can produce.Fig 1: So, we can send any input to a classifier?(Credits: Adobe Firefly)So, can we send any input to a classifier?Not necessarily. We’ve described what the classifier returns, but not what the service does with its input. Does it call an external model provider? Forward the request to another internal service? Store the original text in a database or send it to a logging platform?A label-only response therefore tells us little about the safety of the complete system. We must evaluate not just the classifier’s output, but every system that receives the input and what it is allowed to do with it.Now let’s move from a service that assigns labels to one that generates text, images, or videos for users. It’s output can become harmful. But what should it refuse to create? And what should it still help with?What should the service refuse and why?Harmful is not a single category. A generative service needs boundaries around content that could endanger people or violate applicable legal and platform requirements. These boundaries protect users and others, while also reducing the company’s legal and reputational exposure.But not every request worth declining is harmful.A creative assistant might receive a request to predict stock prices, prescribe medication, or solve an unrelated programming problem. Individualized prescribing raises a high-stakes professional boundary while an ordinary programming question may simply fall outside the product’s purpose. Both can warrant a redirect, but for different reasons.So, is it fair to say there are two kinds of “harmful” here: unsafe requests and out-of-scope requests? Yes!Fig 2: Harmful can be either unsafe or out-of-scope(Credits : Claude Sonnet 5.5)What exactly belongs on the unsafe side? It’s tempting to make a list of sensitive topics and block anything that mentions them. But a topic is not a task. A request to explain how phishing works is different from a request to write a convincing phishing email. I think the service matters, too. A moderation classifier may need to inspect abusive text. A creative generator should not turn that text into targeted harassment. A medical education tool may explain a medication, while individualized prescribing requires a different level of authority and safeguards.Okay, how do we turn these boundaries into something we can test?We need an evaluation suite built around our service, which is not simply a collection of harmful-sounding prompts. So who decides what “safe” means? The organization must establish it from the service’s purpose, applicable obligations, and domain-specific risks. Airbnb puts evaluation criteria in the hands of product teams, working with cross-functional partners and subject-matter experts. Uber defines agents’ permitted intents and constraints, then checks behavior against those boundaries and user permissions.Okay, but what does the organization actually define? A list of categories such as hate, sexual content, and violence? Yes but we need to draw the line within each category too. We need to spell out what the service can help with, what it should refuse, and when context changes the answer. For example: A prompt asking the service to list its available tools and explain what each one does may be harmless, whereas a prompt attempting to reveal the system prompt could pose a serious security risk. So, work with your PMs, legal team and relevant domain experts to draw the line. Engineers can then turn those boundaries into concrete test requests including both the service should refuse and similar-looking ones it should allow.Fig 3: Some harmful categories (Credits: Adobe Firefly)We now have policy boundaries and a reviewed evaluation suite. The next step is turning them into something that works in a live service. Do we need a separate scope filter, or can we let the agent’s main model decide which requests belong in our service? Models such as Claude Haiku and Sonnet already ship with built-in safeguards. These models are also aligned during training.They do, but those safeguards are general-purpose. They reflect the model developer’s policies. Your service has its own audience, context, and boundaries, and you need evidence that the system enforces them, including on inputs, outputs, and tool calls the base model never sees in isolation. That is what a harmlessness layer is for.And this can be done in multiple ways.Fig 4: How to design harmlessness filter?(Credits : Claude Sonnet 5.5)The diagram shows where we can apply safety controls.Before the request reaches the main model, input checks can screen it against the service’s boundaries. These might use rules, a trained classifier, a small LLM, or a combination. Rules work well for narrow, explicit constraints; classifiers and LLM guards can handle more contextual decisions. Each approach has its own accuracy, latency, cost, and maintenance tradeoffs.The main model remains another layer. Its safety training and application instructions guide how it responds, but they do not replace enforcement elsewhere in the service. Before generated text, images, or videos reach the user, output checks can inspect the actual result. Tool calls need checks before execution, wherever they occur in the agent loop, rather than only at the end.Finally, monitoring and human review help us find what these controls missed. Those findings feed back into policies, test cases, and implementation changes. This improves future behavior, but cannot undo an output or action already delivered.The goal is not to stack as many filters as possible. It is to put the right checks at the points where the service can cause harm, then gather evidence that they work.In general, the harmlessness model should be fast, deterministic and conservative. We can compare the different options in the table below.Fig 5: Different ways to design the harmlessness modelThe old way was to stuff everything into the system prompt. It’s fast, and caching makes it cheap. But hundreds of categories and edge cases turn that prompt into a monster, the model gets worse at following it as it grows, and anyone can try to override it with a prompt injection.Which option you pick depends on your constraints: cost, latency, and how much engineering time you have. Figure out which one you can’t compromise on, start there, and add more layers as you see where it breaks. For example : A small trained classifier looks perfect. It is fast, cheap, consistent. But you pay for it in engineering time, with retraining, re-evaluation, and ongoing upkeep, and that pain doubles if your constraints weren’t clear from the start. We ran into this ourselves in 2024, when we trained an in-house LLM to classify tool calls.Wait!! Why do we need another model for this? Our agent already uses one. Why can’t that same model recognize requests that violate our policy and refuse them?The main model is often larger and more expensive than a dedicated classifier. If we leave safety decisions to the agent while it works, it may spend reasoning tokens or call tools before recognizing that the request violates our policy. If the violation is caught only by an output guardrail, we’ve already spent time and money on work we should have stopped earlier.Think about image generation, and especially video generation. A tool call can start a costly job that takes seconds or longer to finish. Blocking the result doesn’t recover that time or money, and a late refusal doesn’t undo actions already taken. For requests we can identify as prohibited upfront, we want to fail fast, before expensive or consequential execution begins.A smaller LLM can therefore be a practical safety guard, provided it detects policy violations reliably and its added latency and cost fit your application’s budget.But wait, doesn’t Claude already have safety protections? What exactly are we adding?There are multiple layers to distinguish. The model has safety-trained behavior. The provider may apply additional safeguards around inference. And our application has its own rules about what the service should and shouldn’t do. These layers overlap, but they are not interchangeable. A request might be acceptable to a general-purpose assistant and still fall outside the boundaries of our product.Fig 6: Layers of safety control in a claude based applicationClaude is a closed-weight model, so we cannot call or inspect its underlying weights directly. Whether we use an SDK or send an HTTP request ourselves, we still access it through a hosted service. Both paths retain the model’s safety-trained behavior and any provider-side safeguards applicable to that deployment.For our application, we need to distinguish refusal from classification. Did the model or provider refuse to process the request, or did the model successfully evaluate it and return a policy verdict? A refusal is not the same as correctly identifying which application policy the input violates. We should measure those outcomes separately, then verify that our application enforces the verdict.This extra check adds latency, but helps reduce the risk of harmful outputs or actions that could hurt users and expose the company to legal or reputational consequences.Safe, but is it our job?A request passes the safety filter. Does that mean our service should fulfill it?Not necessarily. Asking a creative assistant to debug a Python script may be harmless, but it might have nothing to do with what the product is built to offer. You could choose to answer every harmless question, but that means paying to process requests your product was never intended to handle.Your application can handle scope in several ways. Refer back to Fig. 5 and choose an approach that fits your accuracy, latency, and cost requirements. One option is to use the same model for both safety and scope classification, with separate calls and different instructions for each task. Those calls can run in parallel to reduce the combined wait, although you still pay for both. The application should resolve their verdicts before allowing the agent to proceed.Safe Against What? Evaluating LLM Harmlessness was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.