Microsoft · Filed Apr 21, 2026 · Published Sep 3, 2026

Microsoft Patents a System That Rewrites AI Instructions Using the AI's Own Mistakes

Getting an AI to do exactly what you want often requires painstaking trial and error with the instructions you give it. Microsoft has patented a system that automates that whole process by asking the AI itself to figure out what's wrong with its own instructions.

An example of an AI system rewriting its own instructions based on its mistakes in detecting a "jailbreak" attempt. Drawing from patent filing US 2026/0260061 A1.
An example of an AI system rewriting its own instructions based on its mistakes in detecting a "jailbreak" attempt.
See all 15 drawings from this filing ↓
Publication number US 2026/0260061 A1 US20260260061A1
Applicant Microsoft Technology Licensing, LLC
Filing date Apr 21, 2026
Publication date Sep 3, 2026
Inventors Reid Allen PRYZANT, Jerry Zheng LI, Dan ITER, Yin Tat LEE, Chenguang ZHU, Nanshan ZENG, Anup Shirgaonkar
US classification 704/9
Status when we published Waiting for an examiner (May 27, 2026)
Parent application is a Continuation of 18477680 (filed 2023-09-29)
Document 20 claims

What Microsoft's self-correcting AI prompt system does

A developer sits down to build an AI tool that summarizes legal contracts. They type in a set of instructions for the AI, run some test documents through it, and half the summaries come back wrong. The usual fix is to manually tweak the instructions, guess again, and repeat for hours.

Microsoft's patented system takes that guessing game away from the human. It feeds the AI's own errors back to it, asks the AI to explain what was wrong with the instructions that caused those errors, and then uses that explanation to generate a fresh batch of improved instructions automatically. It's a feedback loop where the AI critiques itself.

A second AI, trained specifically for the subject area at hand, scores the new batch of instructions and picks the best one. That winner becomes the starting point for the next round. The process keeps iterating until the instructions are good enough.

From the filing · CLAIM 1
providing, as input to a large language model (“LLM”), a feedback prompt requesting one or more textual gradients, each textual gradient including a description of one or more flaws in an initial prompt resulting in errors in LLM predictions; …

Translation: The system asks the AI to analyze its own mistakes and explain why its original instructions failed.

How textual gradients drive the rewriting loop

The system centers on what the patent calls textual gradients (a term borrowed from machine learning, where a "gradient" is a signal that tells you which direction to adjust something). Here, instead of numbers, the gradient is a written critique: a description of exactly where the current AI instructions failed and why.

The process works in several stages:

  • Feedback prompt: The system sends the AI its current instructions alongside a sample of outputs that came out wrong. It asks the AI to write a critique explaining the flaws in those instructions.
  • Editing prompt: The system sends the AI the original instructions plus the critique and asks it to generate a set of improved instruction candidates.
  • Paraphrasing prompt: To widen the search, the system also asks the AI to rephrase those improved candidates in different ways, producing even more options.
  • Selection: A secondary AI, fine-tuned on curated data for the specific task domain, evaluates all the candidates and picks the best-performing one.

The selected prompt then replaces the original and the loop restarts. Microsoft's run of AI-tooling filings reflects a pattern of automating the work developers do to prepare and tune AI systems, rather than just improving the AI models themselves.

From the filing · THE ABSTRACT
A selection algorithm is used to select one or more optimized prompts from the set of optimized prompts and/or the set of paraphrased prompts, and the process is repeated with the selected one or more optimized prompts replacing the current prompt.

Translation: The software picks the best new instruction set and tests it again to keep improving.

What this means for people building AI-powered tools

For anyone building an AI-powered product, the quality of the instructions you feed the AI (usually called a "prompt") can make or break how well it works. Right now, getting those instructions right is largely a manual, time-consuming process that requires a lot of expertise. A system that automates that tuning loop could meaningfully lower the barrier to building reliable AI tools, especially in specialized fields like legal, medical, or financial software where accuracy matters most.

For end users, the payoff is indirect but real: AI features in apps built this way should produce fewer embarrassing or wrong answers. The failure this prevents is the one you've probably already seen, an AI assistant that confidently gives you a bad answer because no one had time to properly tune its instructions.

Microsoft's 20th filing we've tracked since May on AI models working together builds on earlier applications covering reusing predictions and two models sharing chat work.

Editorial take

The most honest thing to say about this patent is that it solves a real, everyday pain point rather than a theoretical one. Anyone who has spent an afternoon trying to get an AI chatbot to reliably do one specific thing will immediately recognize the problem Microsoft is addressing.

The clever move is using the AI as its own critic. Instead of a human writing the critique of bad AI output, the system asks the AI to do it, then uses that critique to rewrite the instructions. That closes the loop in a way that scales.

The selection step, where a second AI trained on domain-specific data picks the winner, is where the practical value concentrates. Generic prompt improvements are easy to get; improvements that hold up in a specific industry are harder, and that fine-tuning step is what would make this useful in a production setting rather than a research demo.

Get our take in your Top Stories

Liked this breakdown? Add Patentlyze as a preferred source on Google, and our plain-English take shows up more often in your Top Stories the next time Microsoft patent news breaks.

There are more where this came from

We read every patent application Big Tech publishes and send you the ones worth knowing. Plain English, free, every week.

The drawings

15 drawing sheets from US 2026/0260061 A1 · click any drawing to enlarge

AI system with prompt optimizer., drawing sheet 1 from US 2026/0260061 A1
Sheet 1 AI system with prompt optimizer.
Flowchart of prompt optimization process., drawing sheet 2 from US 2026/0260061 A1
Sheet 2 Flowchart of prompt optimization process.
Example of AI prompt rewriting., drawing sheet 3 from US 2026/0260061 A1
Sheet 3 Example of AI prompt rewriting.
Prompt optimization system overview., drawing sheet 4 from US 2026/0260061 A1
Sheet 4 Prompt optimization system overview.
Examples of prompt optimization scenarios., drawing sheet 5 from US 2026/0260061 A1
Sheet 5 Examples of prompt optimization scenarios.
F1 scores for Jailbreak and Ethos., drawing sheet 6 from US 2026/0260061 A1
Sheet 6 F1 scores for Jailbreak and Ethos.
F1 scores for Liar and Sarcasm., drawing sheet 7 from US 2026/0260061 A1
Sheet 7 F1 scores for Liar and Sarcasm.
F1 scores versus optimization steps., drawing sheet 8 from US 2026/0260061 A1
Sheet 8 F1 scores versus optimization steps.
Show the other 7 sheets
Microsoft Patents a System That Rewrites AI Instructions Using the AI’s Own Mistakes patent drawing, sheet 9
Sheet 9
Microsoft Patents a System That Rewrites AI Instructions Using the AI’s Own Mistakes patent drawing, sheet 10
Sheet 10
Microsoft Patents a System That Rewrites AI Instructions Using the AI’s Own Mistakes patent drawing, sheet 11
Sheet 11
Microsoft Patents a System That Rewrites AI Instructions Using the AI’s Own Mistakes patent drawing, sheet 12
Sheet 12
Microsoft Patents a System That Rewrites AI Instructions Using the AI’s Own Mistakes patent drawing, sheet 13
Sheet 13
Microsoft Patents a System That Rewrites AI Instructions Using the AI’s Own Mistakes patent drawing, sheet 14
Sheet 14
Microsoft Patents a System That Rewrites AI Instructions Using the AI’s Own Mistakes patent drawing, sheet 15
Sheet 15
Browse all the drawings 15 drawing sheets
Patent filing page

Source. Full patent text and figures from the official USPTO publication PDF.
Reader comments

Be the first to weigh in

Start the discussion

Real name or a handle, either is fine. Comments are read by a person before they appear, so allow a little time. Keep it about the filing.