Skip to content

VietTralala/123-triply-eff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code for "One, Two, Three: One Empirical Evaluation of a Two-Copy Shadow Tomography Scheme with Triple Efficiency"

This repository contains the implementation of the numerical studies presented in the paper:

"One, Two, Three: One Empirical Evaluation of a Two-Copy Shadow Tomography Scheme with Triple Efficiency"
Viet T. Tran, Richard Kueng (2025)


Reproducing Experiments

Environment Setup

  • 1. Create a Conda environment

    conda create -n <env_name>
    conda activate <env_name>
    conda install -c conda-forge uv python
  • 2. Clone repo

    git clone https://github.com/VietTralala/123-triply-eff.git 
    cd 123-triply-eff
  • 3. Install local package into conda

    uv pip install -e .

Notes

  • uv run python ... will create a .venv folder and install things in there.
  • whereas uv pip install -e . will install the package into the conda env so that we can just use python - m ...

Workflow Steps

  • Step 0 — Generate test states
    Generate GHZ, zero, and Gibbs states for n=2,3,4,5:

    uv run python -m scripts.generate_test_states

    To generate larger states, modify the main loop in the script. Output folders: ./data/normalized_gibbs/, ./data/special_states/

  • Step 1 — Study support recovery

    uv run python -m scripts.study_support_recovery --n 2 3 4 5 --eps 0.05 0.11 0.34
    uv run python -m scripts.study_support_recovery --n 2 3 4 5 --eps 0.05 0.11 0.34 --specialstates --datadir special_states
  • Step 2 — Mimicking state construction

    uv run python -m scripts.study_mimicking_state_construction --n 2 3 4 5 --eps 0.05 0.11 0.34 --algo both
    uv run python -m scripts.study_mimicking_state_construction --n 2 3 4 5 --eps 0.05 0.11 0.34 --algo both --specialstates --datadir special_states
  • Step 2.5 — Precompute Bell probabilities
    With GPU:

    uv run python -m scripts.precompute_bell_probs --gpu 0 1 --n 2 3 4 5 --eps 0.05 0.11 0.34
    uv run python -m scripts.precompute_bell_probs --gpu 0 1 --n 2 3 4 5 --eps 0.05 0.11 0.34 --specialstates --datadir special_states

    Or with CPU:

    uv run python -m scripts.precompute_bell_probs --cpu --n 2 3 4 5 --eps 0.05 0.11 0.34
    uv run python -m scripts.precompute_bell_probs --cpu --n 2 3 4 5 --eps 0.05 0.11 0.34 --specialstates --datadir special_states
  • Step 3 — Sign reconstruction

    uv run python -m scripts.study_sign_reconstruction --n 2 3 4 5 --eps 0.05 0.11 0.34
    uv run python -m scripts.study_sign_reconstruction --n 2 3 4 5 --eps 0.05 0.11 0.34 --specialstates --datadir special_states

Alternative: Instead of running all steps locally, you can download the computation results from:

DOI

After downloading, extract approx_recovery_jacc.tar.gz into data/results/approx_recovery_jacc/.
Note: The extracted data requires approximately 90GB of disk space.


Reproducing Plots

After running the experiments or downloading the dataset, your folder should include:

data/
├── normalized_gibbs/
├── special_states/
└── results/
    └── approx_recovery_jacc/
        ├── n2_eps0.34_type=zero/
        │   ├── results_<timestamp>.pkl
        │   ├── measurements_<timestamp>.pkl
        │   ├── mimicking_results_v1_<timestamp>.pkl
        │   ├── mimicking_results_v2_<timestamp>.pkl
        │   └── stage3_results_<timestamp>.pkl

Open the notebooks:

  • notebooks/02_main_plots.ipynb
  • notebooks/03_other_plots_and_table.ipynb

These reproduce the main figures and tables from the paper.

Note: The default config reproduces a reduced-scale version of the data, for compatibility with limited compute.As a result, numerical results differ slightly from those reported in the paper.


Example Results

Below are selected figures generated using the reduced dataset from this repository (see notebooks/02_main_plots.ipynb).

Left: Support recovery, Right: Sign reconstruction.

Mimicking state construction.

The table below summarizes fit results for key quantities across steps 1–3 (support recovery, mimicking state construction, and sign reconstruction), evaluated on GHZ, Gibbs, and zero states for varying system sizes. Each value represents the median fit parameter along with its 95% confidence interval (see notebooks/03_other_plots_and_table.ipynb).

About

Implementation of the paper "One, Two, Three: One empirical evaluation of a two-copy shadow tomography scheme with triple efficiency" arXiv:2508.11744, accepted at IEEE Quantum Week (QCE) 2025

Topics

Resources

License

Stars

Watchers

Forks

Contributors