Skip to content

FujitsuResearch/latent-uap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latent-conditioned Parameterized Quantum Circuits as Universal Approximators for Distributions over Quantum States

Introduction

This repository contains the code implementation for the paper "Latent-conditioned Parameterized Quantum Circuits as Universal Approximators for Distributions over Quantum States". The codebase provides tools and scripts to replicate the experiments described in the paper, focusing on learning quantum data distributions using the Latent Parameterized Quantum Circuits (LPQCs) framework.

Repository Structure

The codebase is organized into the following modules:

  • data: Utility functions for generating quantum data used in the experiments.
  • model: JAX-based implementation of the LPQC class (flow_jax), including training utility functions.
  • utils: Utility functions for implementing quantum circuits using TensorCircuit, computing Wasserstein distances, and Classical Shadows Kernel-based distance.
  • main: Scripts main_gen_demo.py for generating multi-clustered quantum states and QM9 quantum states.
  • datasets: Directory containing filtered data from the QM9 dataset.
  • postprocess: Functions for plotting and analyzing experimental results.
  • runscripts: Shell scripts to execute the experiments.

Prerequisites

To run the code, ensure the following requirements are met:

  • Python version >= 3.10
  • Additional dependencies are listed in requirements.txt.

Install the required packages using:

pip install -r requirements.txt

Running the Experiments

Two scripts are provided to replicate the experiments described in the paper:

  1. Multi-cluster Quantum States: To train the model on multi-cluster quantum states, execute:

    sh runscripts/demo_train_multi_cluster.sh

    To train the model with a quantum generative model baseline, the first L/2 layers use random parameters (sampled from a prior distribution with modes), followed by L/2 layers of the same hardware-efficient ansatz with trainable parameters.

    sh runscripts/demo_rand_baseline.sh

    To train the model with a standard (classical) MLP latent generator with density-matrix projection

    sh runscripts/demo_cluster_classical_LMLP.sh
  2. QM9 Dataset: To train the model on the QM9 dataset, execute:

    sh runscripts/demo_train_qm9_MPE_mol_7_2.sh

    To train the model with a standard (classical) MLP latent generator with density-matrix projection

    sh runscripts/demo_QM9_classical_LMLP.sh

    We also implement the paper "QVAE-Mole: The Quantum VAE with Spherical Latent Variable Learning for 3-D Molecule Generation" (NeurIPS2024) to compare with our method. https://openreview.net/forum?id=RqvesBxqDo&noteId=F7Zos3tCK9

    To train QVAE-Mol model with the same dataset (QM9 subset of 4236 molecules with 8 atoms and 2 rings, using 2000 for training), please run:

    sh runscripts/demo_QM9_MolQAE.sh
  3. Verify Barren Plateau: To verify the barren plateau in no-latent and latent PQC models, execute:

    sh runscripts/demo_check_BP_PQC.sh
    sh runscripts/demo_check_BP_PQC_vs_qubits.sh

Post-processing Results

To visualize and analyze the experimental results, navigate to the postprocess directory and run the following scripts:

  • For multi-cluster quantum states:

    python postprocess/plot_demo_prior_cluster.py
  • For QM9 dataset:

    python postprocess/plot_demo_prior_qm9_7_2.py
  • For checking the barren plateau of PQC:

    python postprocess/plot_demo_BP_PQC.py
    python postprocess/plot_demo_BP_PQC_vs_qubits.py
  • For comparison with classical LMLP:

    python postprocess/plot_clusters_compare_classical.py
  • For comparing fidelity and superfidelity:

    python postprocess/plot_clusters_compare_metric.py

Contributing

We welcome contributions to enhance the codebase. Please submit pull requests or open issues to suggest improvements, report bugs, or add new features.

License

This project is licensed under the BSD-3-Clause-Clear license. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors