ข้ามไปยังเนื้อหาหลัก

Approximate quantum compilation with tensor networks (AQC-Tensor)

Qiskit addon สำหรับ Approximate quantum compilation with tensor networks (AQC-Tensor) ช่วยให้ผู้ใช้ compile ส่วนเริ่มต้น ของ circuit ให้เป็น approximation ที่เกือบเทียบเท่าของ circuit นั้น แต่มี layers น้อยกว่ามาก สำเร็จได้โดยใช้ tensor networks ตามวิธีที่อธิบายใน [1] ประโยชน์หลักอยู่ใน circuits ที่จำลอง time evolution แต่อาจนำไปใช้กับ circuits ทุกคลาสที่มีการเข้าถึง:

  1. intermediate state ที่ดีเยี่ยม หรือที่รู้จักกันว่า "target state" ที่สามารถบรรลุได้ด้วย tensor-network simulation และ
  2. circuit ที่ดีที่เตรียม approximation ของ target state แต่มี layers น้อยกว่าเมื่อ compile ลงบน target hardware device

เทคนิคนี้สร้าง ansatz circuit จาก target circuit ขนาดใหญ่ที่ผู้ใช้ต้องการรันบน QPU ในที่สุด สำเร็จได้โดยก่อนอื่น simulate บางส่วนของ target circuit ด้วย tensor network methods และรับการอธิบาย intermediate state ที่แม่นยำที่ ansatz circuit จะ approximate เมื่อพบ intermediate state แล้ว จะถูกใช้เป็น cost function เพื่อ optimize parameters ของ ansatz circuit หลังจาก optimization เสร็จสมบูรณ์ ส่วนที่เหลือของ target circuit จะถูก append ไปยัง ansatz แล้วรันบน quantum hardware

ติดตั้ง AQC-Tensor package

มีสองวิธีในการติดตั้ง AQC-Tensor package: PyPI และการ build จาก source แนะนำให้ติดตั้ง packages เหล่านี้ใน virtual environment เพื่อให้แน่ใจว่า package dependencies แยกจากกัน

ติดตั้งจาก PyPI

วิธีที่ตรงไปตรงมาที่สุดในการติดตั้ง AQC-Tensor package คือผ่าน PyPI เพื่อใช้ package ต้องติดตั้ง tensor network backend อย่างน้อยหนึ่งตัวด้วย code snippet ต่อไปนี้จะติดตั้ง addon พร้อมกับ quimb (สำหรับ tensor network support) และ jax (สำหรับ automatic differentiation) หากสนใจ ดู package บน GitHub

pip install 'qiskit-addon-aqc-tensor[quimb-jax]'

ติดตั้งจาก source

คลิกที่นี่เพื่ออ่านวิธีติดตั้ง package นี้ด้วยตนเอง

หากต้องการ contribute ไปยัง package นี้หรือต้องการติดตั้งด้วยตนเอง ให้ clone repository ก่อน:

git clone git clone git@github.com:Qiskit/qiskit-addon-aqc-tensor.git

แล้วติดตั้ง package ผ่าน pip หากวางแผนรัน tutorials ที่พบใน package repository ให้ติดตั้ง notebook dependencies ด้วย หากวางแผนพัฒนาใน repository อาจต้องการติดตั้ง dev dependencies ด้วย

pip install tox jupyterlab -e '.[notebook-dependencies,dev]'

พื้นฐานทางทฤษฎี

กระบวนการ AQC-Tensor อธิบายโดยละเอียดใน [1] ส่วนนี้ให้ภาพรวมของเทคนิค

Diagram แสดง approximate quantum compilation procedure

โดยทั่วไป AQC-Tensor ต้องการสามสิ่งเป็น input:

  1. การอธิบาย target state ในรูปของ tensor network ซึ่งสร้างได้โดยการ simulate circuit บน tensor network simulator หรืออาจสร้างในรูปแบบอื่น (เช่น โดยการทำ time evolution บน matrix-product state โดยใช้ time-dependent variational principle)
  2. ansatz circuit แบบ parametrized ควรมี hardware-efficient connectivity เพื่อให้มี depth ที่เหมาะสมบน target hardware
  3. Initial parameters สำหรับใส่เข้าไปใน ansatz circuit เพื่อให้ state ที่ได้เป็น approximation ที่ดี ของ target state แล้ว (ซึ่งไม่ได้ต้องการโดยหลักการสำหรับ AQC แต่ช่วยให้ optimizer มีจุดเริ่มต้นที่เหมาะสม)

เทคนิคนี้คือการ optimize parameters ของ ansatz circuit อย่างวนซ้ำ เพื่อให้ state ที่สร้างออกมาใกล้เคียงกับ target state มากที่สุด

การสร้าง Ansatz

เพื่อสร้าง (2) และ (3) จากรายการข้างต้น package qiskit-addon-aqc มีฟังก์ชัน generated_ansatz_from_circuit() ที่รับ input circuit และ output parametrized ansatz กับ initial set ของ parameters parameters ที่ฟังก์ชัน return นั้น เมื่อใส่เข้าไปใน ansatz จะสร้าง state ที่เทียบเท่า input circuit อย่างแน่นอน จนถึง global phase

ansatz ที่สร้างโดยฟังก์ชันนี้ใช้ 9 parameters ต่อ two-qubit block และอิง KAK decomposition ซึ่ง parametrize any two-qubit gate ในรูปของสามพารามิเตอร์ จนถึง single-qubit rotations single-qubit rotations จะถูก decompose เป็น ZXZZXZ ซึ่งแต่ละตัวมีสามพารามิเตอร์ ส่งผลให้ ansatz circuit ประกอบด้วย 3 parameters สำหรับแต่ละ two-qubit block ของ original circuit บวก 3 parameters สำหรับ outgoing single-qubit rotation บน Qubit แต่ละตัวในสอง Qubit (รวม 9 parameters) หลังจากเพิ่ม blocks เหล่านี้ ansatz จะเสร็จสมบูรณ์โดยเพิ่ม layer ของ single-qubit rotations ลงบน active qubit แต่ละตัวที่จุดเริ่มต้นของ circuit

Tensor-network simulation

เพื่อรับการอธิบาย target state ที่ต้องการ addon นี้ใช้ matrix product state (รูปแบบที่ง่ายที่สุดของ tensor network) และรองรับ tensor-network simulators ต่อไปนี้:

พารามิเตอร์ที่สำคัญที่สุดของ tensor network คือ maximum bond dimension ของมัน χ\chi พารามิเตอร์นี้จำกัดปริมาณ entanglement ที่แสดงได้ด้วย tensor network และดังนั้นจึงจำกัดความลึกที่ circuit ที่กำหนดสามารถ simulate ได้อย่างซื่อสัตย์

สำหรับ circuit ที่มี LL Qubit matrix-product state ต้องการ bond dimension สูงสุด χexact=2L/2\chi_{exact} = 2^{L/2} เพื่อ simulate circuit ได้อย่างแน่นอน ทุก ความลึก ซึ่งเกินความสามารถสำหรับ utility-scale circuits ทั่วไปที่ทำงานบน 100+ Qubit ด้วยเหตุนี้ หากลองทดลองกับ addon นี้สำหรับ toy-problem ที่มี Qubit น้อย สิ่งสำคัญคือต้องให้แน่ใจว่า χ<2L/2\chi < 2^{L/2} วิธีนี้ เมื่อ scale ปัญหาไปยัง circuit ขนาดใหญ่ขึ้น target state ยังคง classically simulable อยู่

ขั้นตอนถัดไป

คำแนะนำ

อ้างอิง

[1] Robertson, Niall F., et al. "Approximate Quantum Compiling for Quantum Simulation: A Tensor Network based approach" arXiv preprint arXiv:2301.08609 (2023).

Source: IBM Quantum docs — updated 13 ก.พ. 2569
English version on doQumentation — updated 7 พ.ค. 2569
This translation based on the English version of 11 มี.ค. 2569