Microsoft · Filed Jan 12, 2026 · Published May 21, 2026 · verified — real USPTO data

Microsoft Patents an AI System That Writes Readable Code From Your Examples

Instead of generating cryptic, unreadable code, Microsoft's new patent describes a system that watches what inputs and outputs you want — then synthesizes a program that looks like a real developer wrote it, complete with idiomatic functions and human-readable variable names.

Microsoft Patent: AI Code Synthesis With Readable Variables — figure from US 2026/0140722 A1
FIG. 1A — rendered from the official USPTO publication PDF.
Publication number US 2026/0140722 A1
Applicant Microsoft Technology Licensing, LLC
Filing date Jan 12, 2026
Publication date May 21, 2026
Inventors José Pablo CAMBRONERO SÁNCHEZ, Sumit GULWANI, Vu Minh LE, Daniel PERELMAN, Arjun RADHAKRISHNA, Daniel Galen SIMMONS, Clint Michael SIMON, Ashish TIWARI
CPC classification 717/143
Grant likelihood Medium
Examiner CENTRAL, DOCKET (Art Unit OPAP)
Status Docketed New Case - Ready for Examination (Feb 10, 2026)
Parent application is a Continuation of 17687577 (filed 2022-03-04)
Document 20 claims

What Microsoft's example-driven code generator actually does

Imagine you're working in a spreadsheet tool and you want to automate a task — say, extracting dates from messy text. You don't know how to write code, so you just show the tool a few examples: this input should produce that output. The tool figures out the logic on its own.

The problem with most systems that do this is that the code they generate is ugly and hard to follow — full of placeholder variables like x1 and v2 that mean nothing to you. Microsoft's patent describes a system that goes further: it generates code that actually looks clean and professional, using proper naming conventions for the programming language and replacing those meaningless placeholders with descriptive variable names.

There's also a clever feedback loop built in. If the system isn't confident about a particular input, it asks you to clarify what the right output should be — then uses your answer to tighten up the generated code. You stay in control without needing to write a single line.

How the ML engine picks functions and names variables

The system is built around a concept called Programming by Example (PBE) — where instead of writing code, you provide sample inputs and the outputs you expect, and the system synthesizes a program that reproduces that behavior.

What makes this patent distinct is a two-layer refinement step. First, it uses a machine learning algorithm to select idiomatic functions — meaning functions that follow the conventions and style norms of the target language (think Python list comprehensions vs. a raw loop). The ML model isn't just finding any function that works; it's finding one that fits naturally into the language ecosystem.

Second, any non-semantically-meaningful variables (auto-generated names like var_3) inside those functions are automatically replaced with semantically-meaningful equivalents — names that reflect what the variable actually represents, making the generated code readable by a human.

The system also identifies significant inputs — edge cases or examples where the model's confidence falls below a set threshold and no known-correct output exists. For those, it surfaces a UI prompt asking the user to supply the correct output. That human-provided ground truth is then fed back into the ML algorithm to reconfigure the idiomatic function accordingly, reducing wasted computation on uncertain paths.

What this means for no-code and AI coding tools

For no-code and low-code tools — think Excel's Flash Fill, Power Automate, or any AI coding assistant — code synthesis is only useful if the output is readable and maintainable. A system that generates working-but-opaque code leaves users unable to audit, debug, or extend it. Microsoft's approach directly targets that trust gap by making generated code look like something a competent developer would write.

This also fits neatly into Microsoft's broader Copilot strategy. If AI-generated code in tools like Excel, Power Query, or VS Code is both functionally correct and stylistically clean, users are far more likely to accept, modify, and ship it. The active uncertainty-resolution loop — where the system asks for clarification rather than guessing — is a practical reliability feature that could reduce the hallucination-adjacent problem of confidently wrong code generation.

Editorial take

This is a genuinely useful patent in a well-defined problem space — the gap between 'code that works' and 'code that a human can actually read and trust' is real, and Microsoft is one of the few companies with both the PBE research pedigree (Sumit Gulwani literally invented Flash Fill) and the product surface area to deploy this at scale. The active feedback loop for low-confidence inputs is the smartest part — it's a principled way to handle uncertainty rather than silently generating wrong code.

Get one Big Tech patent every Sunday

Plain English, intelligent commentary, no hype. Free.

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

Editorial commentary on a publicly published patent application. Not legal advice.