iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Training an AI model to ignore malicious instructions makes prompt injection harder, but it does not guarantee that the model will recognize every instruction’s source and authority. In many applications, trusted directions and untrusted material—such as a webpage, email, or document—are placed in the same model input. The model can mistake a command inside that material for something it should obey. If the model can use tools, that mistake may lead to actions or data exposure, not just an incorrect reply.
What prompt injection is—and why training does not automatically stop it
Prompt injection is an attempt to steer a model by putting instructions where it may interpret them as directions to follow. The attack exploits a central feature of AI assistants: they are trained to respond to instructions and useful context. A malicious passage can take advantage of that behavior by competing with the legitimate request or by pretending to have greater authority.
Training can teach a model to prioritize one instruction over another. For example, OpenAI describes an instruction hierarchy of system, developer, user, and tool instructions, in that order. That ordering is a learned behavior, however, not a hard security boundary that mechanically prevents lower-priority text from affecting the model. The model must still interpret what each passage is, where it came from, and whether it is an instruction or merely content to process.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteThat distinction can be difficult in practice. An application may assemble an input from several sources, such as its own directions, the user’s request, and text retrieved from a browser or uploaded file. If these parts are concatenated as ordinary text, their origins may not be sufficiently clear to the model. A sentence in external content can then resemble an instruction in the conversation, even though the application intended the model to treat it as data.
#1 Best Overall
So “trained to ignore hidden commands” is not the same as “incapable of following them.” Training can improve the odds of resolving conflicts correctly. It cannot guarantee that every model, application, input format, and attack will be handled correctly.
How direct and indirect prompt injection differ
Direct injection comes from the user’s message
In a direct prompt injection, the attacker puts an overriding instruction in a message sent to the model. It may explicitly ask the model to disregard earlier directions or try to make the model reveal information. This is the more visible case: the attempted instruction arrives in the same channel as an ordinary user request.
The model’s instruction hierarchy is relevant here. If the system has clearly established that the user cannot override higher-priority rules, training may help the model reject the conflict. But the result still depends on how the instructions are framed, whether they truly conflict, and how the model interprets them.
Indirect injection arrives inside material the model is asked to process
In an indirect prompt injection, the malicious instruction is embedded in external data: for example, a webpage, email, document, or tool result. The user may simply ask for a summary or research task and have no idea that the source contains text aimed at the AI. The attack does not need to appear in the user’s own message to influence the model.
Microsoft’s security guidance distinguishes these two forms and describes a historical Bing Chat browsing issue involving instructions on a webpage and information transmitted through URL parameters. Microsoft says that specific issue has since been fixed; it should not be treated as evidence that the same vulnerability remains open today. The broader lesson is that external content can be an attack surface whenever an application asks a model to read it.
Rank #2
Indirect attacks are not necessarily “hidden” in the sense of invisible to a human. A page may show an instruction openly, while the model is still supposed to regard it as untrusted content. Conversely, an ingestion pipeline may supply material the reader does not see in the displayed page. In both cases, the security problem is not simply whether text is visible; it is whether the system preserves its source and authority.
Why a model may mistake content for an instruction
Applications can blur source boundaries
Microsoft Research’s work on spotlighting describes a common application pattern: content from multiple sources is joined into one text input. When source boundaries are lost or weakly signaled, a model may struggle to tell which passage is a trusted direction and which is outside material. Spotlighting attempts to maintain a provenance signal through transformations of the input. It is one way to communicate origin, not a universal fix.
Even when an application labels sources, the model still has to interpret them. A passage in an email might use urgent, authoritative language. A webpage could imitate a system notice. A tool result might contain a sentence that sounds like a command. If the model relies too heavily on how text sounds instead of its actual labeled role, an attacker may exploit that tendency.
Instruction-following strength is not the same as security judgment
Research on prompt injection has found that some models over-prioritize instructions embedded in content and may focus on later text without fully accounting for the surrounding context. The EMNLP 2024 benchmark by Li and colleagues warns that stronger instruction-following or contextual capability alone does not necessarily eliminate susceptibility. A model can be highly capable at carrying out a request and still make the wrong call about whether a particular passage is authorized to make that request.
A 2026 PMLR paper, Prompt Injection as Role Confusion, offers a related explanation: models may infer who is speaking from the style of text rather than relying only on its labeled role. The authors report that injected text can occupy representational space resembling the trusted role it imitates. In one specific CoT Forgery experiment, the paper reports a 60% attack success rate against frontier models with near-zero baselines. That result belongs to that paper’s experiment; it is not a general rate for prompt injection in everyday products.
What training and benchmark results do—and do not—show
Training for instruction hierarchy can improve performance on tested conflicts. OpenAI reports that its instruction-hierarchy-trained GPT-5 Mini-R improved over a baseline on instruction-hierarchy tests and two prompt-injection benchmarks. The reported summary does not provide a numeric improvement, so it does not support a claim about a particular percentage or a guarantee outside those tests.
Microsoft Research’s BIPIA work describes both black-box prompt-learning defenses and a fine-tuning defense. In the reported experiments, its white-box adversarial-training approach reached near-zero attack success. That is a result for the evaluated defense and test conditions, not proof that deployed systems are immune. A different attack, model, application, or permission set may produce a different outcome.
Training also has trade-offs. OpenAI notes that hierarchy-training tasks can be difficult to grade, that judgments about nuanced conflicts are fallible, and that a model may learn shortcuts such as over-refusing. A defense that blocks more attacks by refusing harmless tasks may look safer on one metric while becoming less useful. Evaluations should measure both resistance to attacks and the model’s ability to complete legitimate work.
Benchmarks are most meaningful when their conditions are clear. Attack success on one dataset cannot be compared directly with a result from another unless the model, attack set, source type, task, and permissions are sufficiently aligned. A text-only test that checks whether a model repeats an instruction is also different from a test of whether an agent actually sends a message, changes a file, or accesses a record.
Why agents make prompt injection more consequential
A text-only assistant that follows an injected command may produce a misleading or unwanted answer. An agent connected to email, files, a browser, a database, or other tools can potentially do more: retrieve information, alter data, or take an external action. The impact depends on two things: whether the model follows the injection and what authority the surrounding application gives it.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #4
OpenAI’s Atlas security publication describes an automated attacker finding a browser-agent exploit in which an injected email caused the agent to send a resignation message instead of completing its requested task. This is a vendor-published demonstration of an action risk, not a measurement of how often such incidents occur across products. It illustrates why prompt injection is described as an open challenge for agent security: a model’s mistaken interpretation can become consequential when tool access turns it into an action.
The practical implication is that a model’s training is only one layer of protection. If an agent does not need permission to send email, modify records, or access unrelated files, removing or narrowing those permissions can limit the damage from a failure. The same principle applies to individual components in a larger agent system: give each only the data and actions required for its task.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.How to reduce the risk in an AI application
1. Treat external content as data, not authority
Retrieved pages, uploaded files, emails, and tool output should be treated as untrusted input, even when they contain imperative wording. The application should make clear that the model is being asked to analyze or summarize this material, not obey instructions found inside it. A sentence does not gain authority merely because it appears in a source the assistant has been asked to read.
2. Preserve provenance through the input
Keep source boundaries visible when assembling model context. The system should distinguish its own directions, the user’s request, and external content in a way the model can use. Microsoft Research’s spotlighting approach is an example of attempting to signal provenance through input transformations. Such signaling can help, but it should be paired with access limits and testing rather than treated as a complete defense.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute3. Scope access and constrain actions
Limit an agent’s access to the data it needs and its ability to take consequential actions. Tool permissions should be narrow enough that a successful injection cannot automatically reach unrelated information or trigger broad changes. Where an action has meaningful consequences, the application can separate reading or drafting from execution, so that an injected instruction does not itself confer permission to carry out the action.
Best Value
4. Test the whole application, not just the base model
Test the actual workflow, including how data is retrieved, placed in the prompt, passed among tools, and acted on. Include realistic malicious content in webpages, emails, documents, and tool results. A model may handle a simple direct attack while failing on a more realistic indirect one, or it may resist a text-only test but take an unwanted action when connected to tools.
OpenAI describes automated adversarial testing, red-teaming, and repeated updates as part of its approach to improving defenses. That is a continuing process rather than a one-time certification: attackers can adapt, and a change in the model, prompt assembly, or tool permissions can change the risk.
5. Measure resistance and usefulness together
When comparing defenses, use the same model, task, attack set, source type, and action permissions where possible. Track whether attacks succeed and whether normal tasks are refused unnecessarily. This matters because over-refusal can be a shortcut learned during training, and a defense that blocks an attack by declining all similar work may not be acceptable for the application.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →- Check direct and indirect attacks separately.
- Include the formats and sources the application actually consumes, such as web pages, email, documents, and tool output.
- Distinguish textual compliance from consequential tool actions.
- Record false refusals and successful completion of legitimate tasks alongside attack resistance.
- Re-test after changes to the model, prompt construction, data sources, or permissions.
What is not established about prompt-injection risk
The cited experiments do not establish an overall success rate for prompt injection across deployed AI systems. They use different models, prompts, attack strategies, tasks, and permissions. The 60% figure from the PMLR CoT Forgery experiment cannot be generalized to ordinary use, and near-zero success in the BIPIA defense experiments does not prove that all versions of that defense will work against every attack.
Nor do these findings establish that any single prompt template, filter, training method, or provenance signal eliminates the risk. A useful security claim needs to name the system and conditions tested. For an agent, that includes not just the underlying model but the data it receives and the tools it is allowed to use.
The practical answer
Prompt injection still works because models must interpret instructions and context, while applications may mix trusted directions with untrusted text. Training can help a model prioritize the right source, but the decision is not infallible, and benchmark improvements are bounded by their test conditions. The safest design does not rely on the model alone: preserve provenance, treat external content as untrusted, limit tools and permissions, and evaluate the complete application for both attack resistance and useful performance.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

