Optimizing quantum circuit by using Transformer

A project in Practical Quantum Computing courses. This project explores the optimization of quantum circuits. It involves transforming input circuits using gate identities to optimize performance, considering factors like gate set and circuit size.

In this intriguing project, I delved into the complexities of optimizing quantum circuits. The challenge was to methodically adjust circuits using rewrite rules, a task that tested my problem-solving skills due to the vast search space of transformations.

I aimed to develop “transformers” - a set of functionalities applying rewrite rules in randomly generated quantum circuits. The creation of six distinct transformers, each for different circuit identities, was both challenging and enlightening.

Understanding Transformer in Quantum Computing

Transformers were more than tools; they were the bridge between theory and practical application. Each transformer in Cirq transforms an input circuit into an output circuit. These played pivotal roles in:

  • Gate Decompositions: Simplifying circuits to fit specific quantum devices.
  • Qubit Mapping and Routing: Mapping logic qubits to physical ones.
  • Circuit Optimizations: Enhancing hardware efficiency through optimizations.

Template-based transformers:

In this project, I defined 6 transformer based on these template:

Challenges and Goals

  • Scaling Optimization: Addressing the complexity and scalability challenges in quantum circuit optimization.
  • Overcoming Complexity: Tackling the scalability issues in quantum circuit optimization was a significant learning curve.
  • Refining Transformers: I faced difficulties with the ‘template f’ transformer and plan to address these bugs.

Reflections and Next Steps

While encountering some bugs, particularly with ‘template f’, this project taught me the importance of thorough testing. Moving forward, I plan to develop unit tests for each transformer to ensure reliability and efficiency.

Source code:

Check my github repo to see all the source code.