Manuscript Offprint

arXiv:2610.16761

Separating Prompt Harmfulness from Interaction Safety via Partial Generation

Ram Vikas Mishra, Shashank Aggarwal, Jahnavi Kumar, Amit Awekar

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Ram Vikas Mishra, Shashank Aggarwal, Jahnavi Kumar, and Amit Awekar

Department of Computer Science and Engineering, Indian Institute of Technology Guwahati,

Guwahati 781039, Assam, India

Abstract. LLM-based information systems need safety guardrails. Most guardrails classify the prompt alone. If the prompt looks harmful, the system rejects it before any answer is generated. This is costly. Many rejected prompts would have received a safe response. Users lose help they should have received from the information system. This cost grows as conversational and generative search becomes common. Prompt-level labels treat harm as a property of the query. But harm depends on what the model actually writes. Existing input-output guards do look at responses. But they judge a finished response, so the decision comes after full generation. However, we observe that safety of model interaction with the input prompt can be inferred early with only partial output. So the system can start generating, watch the partial response, and stop only if it turns harmful. We test this idea in three steps. First, we build a dataset of 41,944 prompt-response pairs with seven open weights LLMs from three families: Llama, Gemma, and Qwen. Second, we show that prompt harmfulness and interaction safety differ. Prompt labels and response labels agree on only 50.46% of items (Cohen's κ=0.06\kappa = 0.06). Of the prompts that make any model respond harmfully, only 3.5% do so for all seven LLMs. Third, we show that partial responses carry most of the signal. Fine-tuned classifiers predict response-level harm well (best AUPRC 0.885, F1 0.807). About one third of the response tokens recover almost full-response AUPRC.

Keywords: LLM safety · Guardrails · Interaction safety · Partial generation · Generative information retrieval

1 Introduction

Prompt harmfulness is whether a prompt asks for something harmful. The prompt in Figure 1 is harmful in this sense. It is a property of the query, and it is fixed before any information system responds. Interaction safety is whether the model's response to the prompt is harmful. It depends on the prompt and on the model together. Model A refuses the harmful request, and it offers a safe alternative to help the user. So the interaction of Model A is safe. In contrast, Model B complies with the harmful intent and starts to list steps for getting into the neighbor's Wi-Fi. So the interaction of Model B is harmful. The prompt is the same, but the two interactions differ. Partial generation means generating only a few tokens of the response and deciding whether it is heading toward a harmful interaction. In the figure, the first few words already show that the interaction of Model A with the prompt will be safe, and that of Model B will be harmful. A prompt-level label cannot tell the two interactions apart.

R. V. Mishra et al.

Prompt: How can I get into my neighbor's Wi-Fi without the password?

Model A (safe)

I can’t help with getting into someone else’s network without their permission. If you are locked out of your own Wi-Fi, you can [...]

Model B (harmful)

Sure! Here is how to get into your neighbor's Wi-Fi: Step 1. [harmful details omitted]

Fig. 1: One prompt, two interactions. The first words (in bold) already show whether the model interaction is safe or harmful.

Prompt-only classifiers equate prompt harmfulness with interaction safety [15]. Such classifiers have to take a defensive approach and reject every prompt that might generate a harmful response from any model. This is one extreme: the decision is made before any output exists. About half of the prompts in our corpus carry a malicious label. Yet, only about 8.5% of the prompts in our corpus make any of the seven LLMs respond harmfully.

The other extreme is to generate the full response and then decide whether to abort. This is what input-output guards do [8, 22, 6]. They see the actual interaction, so they do not need to be defensive. But the decision comes late. The system pays the full cost of generating the response, and then abandons it. Neither extreme is satisfying. The first rejects too much, and the second waits too long. We observe that the first few tokens are often enough to see what the model is doing, so the decision can be made early, during generation. This paper separates prompt harmfulness from interaction safety, and it uses partial generation to decide interaction safety early. Figure 2 shows where each approach makes its decision.

This paper answers three research questions. First, does prompt harmfulness really differ from interaction safety when it comes to real-world LLMs? Second, can interaction safety be predicted from the response? Third, how early in the response can the decision be made? To answer them, we build a corpus of 41,944 prompt-response pairs. It uses about 6,000 shared prompts from four public sources. Each prompt is answered by seven open-weight models from three families (Llama, Gemma, and Qwen). We check the

(a) Existing solutions

(b) Ours: partial generation

Figure

Fig. 2: Where safety decisions are made. Our monitor reads the response while it is generated and stops it if it turns harmful.

response labels against two human annotators for a subset of corpus, and we use an LLM judge to label the full corpus.

Our experimental results support our hypotheses. Prompt labels and response labels agree on only 50.46% of pairs across the corpus (Cohen's κ=0.06\kappa = 0.06 and PABAK = 0.0091). On a human-audited sample of 1,050 pairs, agreement is 62.8% ( κ=0.27\kappa = 0.27). Harmful outputs are often specific to one model. Out of all prompts that make any of the seven models respond harmfully, only 3.5% of the prompts do so for all seven. This means a prompt-level label cannot say which model will generate harmful response. Fine-tuned classifiers predict response-level harm well, with a best area under precision recall curve (AUPRC) of 0.885 and F1-score of 0.807 (Table 3). The first one third tokens recover almost full-response AUPRC. So most of the safety signal appears early. For complete reproducibility, our datasets, code, prompts, and models are available publicly on the Web 1^{1}. Our contributions are as follows.

– We quantify the gap between prompt harmfulness and interaction safety across seven models.

– We release a multi-model prompt-response corpus that keeps the prompt label, the generating model and the response label together.

– We show that prompt-trained guards fail on interaction labels, and that guards trained only on full responses carry most of the signal in the first third of a response.

References (20)