When AI rewrites millions of lines of code, verification becomes essential
Microsoft details how AI agents are transforming large-scale codebases like Windows and Azure, shifting verification from manual review to automated formal methods to ensure trustworthy transformations.
Microsoft is deploying AI agents to rewrite and modernize vast codebases, including Windows and Azure, where changes must be verified at scale. The company describes challenges in ensuring AI-generated edits preserve behavior, security, and architectural intent across hundreds of millions of lines of code. Since 2024, Microsoft has combined AI agents with static analysis, testing, and formal verification to make large-scale transformations practical and reliable. The approach evolved from hard-coded workflows to agent-driven planning, with tools now focused on validating changes rather than generating them.
The company outlines a migration model where a small team of experts drives large-scale transformations, using agents to apply consistent fixes across codebases. Agents learn from sampled findings, propose fixes, and refine a knowledge base that experts approve before widespread application. This reduces cognitive load on reviewers by grouping similar fixes and directing human feedback to high-leverage areas like resolving ambiguous cases.
Microsoft highlights the shift from compiling and testing to validating behavior at scale when modernizing legacy C/C++ code to Rust. The process involves interactive tools to visualize code structure, decide modernization priorities, and produce validation strategies. Feature-by-feature migration is preferred, with differential testing and scenario-driven validation ensuring end-to-end correctness. Formal specifications are extracted and used to prove modernized code meets requirements, with tools like Verus supporting these proofs.
The company emphasizes the need for explicit intent in AI-driven development, as locally plausible code can still violate critical assumptions. Microsoft is building tools to infer formal specifications from existing codebases, using agents to capture concurrency, fault tolerance, and other system properties. These specifications serve as guardrails for future AI changes, enabling model checking, invariant proofs, and automated validation without requiring engineers to become formal methods experts.