← Latest papers
⚛️ quantum physics

Agentic MLIR-to-QIR Translation with Dual-Backend Testing: A Hybrid Deterministic and LLM Approach

This paper presents a hybrid MLIR-to-QIR translation framework that combines deterministic compiler passes for known dialects with an LLM-based agentic path for unseen dialects, utilizing a dual-backend testing pipeline to ensure high-fidelity output across diverse quantum circuits.

Original author: Sharmin Afrose, Vicente Leyton-Ortega, Narasinga Rao Miniskar, Elaine Wong, Travis S. Humble

Published 2026-11-20
📖 7 min read🧠 Deep dive

Original author: Sharmin Afrose, Vicente Leyton-Ortega, Narasinga Rao Miniskar, Elaine Wong, Travis S. Humble

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). ✨ This is an AI-generated explanation of the paper below. It is not written or endorsed by the author. For technical accuracy, refer to the original paper. Read full disclaimer

The world of quantum computing is currently a landscape of many different languages. Just as a traveler might struggle to communicate across borders where every country speaks a different tongue, scientists and engineers face a similar barrier in quantum technology. Different hardware manufacturers and software groups have built their own unique ways of describing quantum circuits, the instructions that tell a quantum computer what to do. These descriptions are like dialects of a complex technical language. While each dialect works perfectly within its own ecosystem, they do not naturally understand one another. This creates a significant problem: a program written for one type of quantum machine often cannot run on another without a human expert manually rewriting the code, a slow and error-prone process that slows down the entire field. To solve this, researchers need a universal translator that can take a quantum program written in one dialect and convert it into a standard format that any machine can understand, without losing the meaning of the original instructions.

A team of researchers at Oak Ridge National Laboratory has developed a new system to act as this translator, bridging the gap between these competing quantum languages. Their work focuses on converting programs written in a flexible, multi-level format known as a dialect into a universal intermediate representation, a standard code that serves as a common ground for different quantum backends. The challenge is that while some of these dialects are well-known and follow strict rules, others are new and unfamiliar, making it difficult for traditional computer programs to translate them automatically. To tackle this, the team built a hybrid system that combines the speed and precision of traditional software with the adaptability of artificial intelligence. They created a translator that can choose between three different paths depending on the task: a fast, rule-based path for known languages, a flexible, AI-driven path for new languages, and a repair path that fixes mistakes if the first attempt fails.

The system operates like a highly organized factory line with a built-in quality control mechanism. When a quantum program arrives, the system first checks which dialect it is written in. If the dialect is one the system knows well, such as those used by major frameworks like Catalyst or Quake, it takes a direct, deterministic route. In this mode, the software follows a strict set of pre-written rules to convert the code, a process that takes only a fraction of a second and is perfectly accurate for known structures. However, if the system encounters a new or unfamiliar dialect, it switches to an agentic mode. Here, it employs a large language model, a type of artificial intelligence trained to understand and generate code, to perform the translation. This AI agent acts like a skilled linguist, analyzing the new language and constructing the translation based on patterns it has learned, guided by specific examples and rules provided in the prompt.

Crucially, the researchers did not simply trust the AI to produce the correct output. They built a rigorous testing pipeline that acts as a double-check. Once the translation is complete, the system runs the original quantum program and the newly translated version on two separate, independent simulators. These simulators act as virtual quantum computers that execute the instructions and produce results. The system then compares the statistical distributions of the outcomes from both runs. If the results match closely enough, the translation is accepted. If they do not match, the system does not give up; instead, it enters a repair loop. It feeds the error information back to the AI agent, explaining what went wrong, and asks the agent to try again. This cycle of translation, testing, and repair can repeat several times until a valid, working translation is found.

To ensure the system works even when the AI produces incomplete or messy output, the researchers added a safety mechanism called a guardrail assembler. Smaller AI models sometimes generate the correct sequence of quantum operations but forget to include the necessary structural details, like variable declarations or formatting, that make the code valid. The guardrail assembler steps in to fix these structural issues. It extracts the core operations from the AI's output and reassembles them into a complete, valid code file using standard templates. This allows the system to recover from errors that would otherwise cause the translation to fail completely, making the process much more robust.

The researchers tested their system on a diverse set of forty-one different quantum circuit designs, ranging from simple two-qubit operations to complex algorithms involving up to one hundred qubits. They evaluated the system across three different dialects, including two well-known ones and a new, unseen dialect designed for fault-tolerant quantum computing. The results showed that for the known dialects, the deterministic path was flawless, achieving perfect accuracy in translating the gate structures and producing results that matched the original programs with a similarity of over ninety-five percent. When the system was forced to use the AI agent for known dialects, it still performed well, though it took significantly longer, ranging from thirty-five to sixty-two seconds compared to the milliseconds of the deterministic path.

The most significant test came with the unseen dialect. Since no pre-written rules existed for this new language, the system had to rely entirely on the AI agent. In this scenario, four out of six different AI models tested were able to produce valid translations on the very first try. These models successfully translated logical-level operations, which are abstract instructions for error-corrected quantum computers, into the standard format. The system demonstrated that it could handle new languages without needing a human to write a new translator from scratch. The researchers noted that while the AI models could translate the logical operations, they did not automatically expand them into the physical details required by the hardware, a task that remains the responsibility of the backend system.

The study also highlighted the importance of how information is provided to the AI. The team found that simply giving the AI a search tool to look up information, a method known as retrieval-augmented generation, often led to errors with smaller models. Instead, they found success by injecting all the necessary reference material, such as gate mappings and code templates, directly into the prompt. This approach, which they call context engineering, ensured the AI had all the facts it needed right at hand, eliminating the confusion that arose when the model tried to search for answers on its own.

In the end, this work presents a practical solution to the interoperability problem in quantum computing. By combining the speed of traditional compilers with the flexibility of artificial intelligence and a rigorous testing loop, the researchers have created a system that can translate quantum code across different languages with high reliability. The system does not just guess; it verifies its work, repairs its mistakes, and adapts to new challenges. While the deterministic path remains the fastest and most reliable for known languages, the agentic path offers a vital bridge for the future, allowing the quantum software ecosystem to evolve and incorporate new dialects without being held back by the need for manual rewriting. This hybrid approach suggests a future where quantum programs can move freely between different hardware platforms, accelerating the development of quantum technology as a whole.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →