Skip to content

Conversation

@fkiwit
Copy link

@fkiwit fkiwit commented Sep 22, 2025

Title:
Add demo on loading classical data with low-depth circuits

Summary:
This pull request adds a new demonstration on how to efficiently load classical image data into quantum states using low-depth quantum circuits, based on the paper "Typical Machine Learning Datasets as Low‑Depth Quantum Circuits". The demo uses the MNIST dataset and shows how to train a variational quantum classifier on the encoded data. This demo leverages the new qml.data module for dataset loading.

Relevant references:

  • "Typical Machine Learning Datasets as Low‑Depth Quantum Circuits" (2025) [1]
  • "A flexible representation of quantum images for polynomial preparation, image compression, and processing operations" [2, 3]
  • "A Multi-Channel Representation for images on quantum computers using the RGBα color space" [4, 5]
  • "Efficient MPS representations and quantum circuits from the Fourier modes of classical image data" [6]

Possible Drawbacks:
The dataset required for this demo is large (~1GB), which might be a consideration for users with limited bandwidth or storage.

Related GitHub Issues:
None


If you are writing a demonstration, please answer these questions to facilitate the marketing process.

  • GOALS — Why are we working on this now?

Promote the new qml.data feature for loading datasets and show a PennyLane implementation of a recent paper on efficient data loading for QML.

  • AUDIENCE — Who is this for?

QML researchers, students, and practitioners interested in efficient data loading techniques and their application to image classification tasks.

  • KEYWORDS — What words should be included in the marketing post?

Quantum Machine Learning, Quantum Datasets, Image Loading, Low-depth circuits, Variational Quantum Classifier, MNIST, PennyLane, qml.data

  • Which of the following types of documentation is most similar to your file?
    (more details here)
  • Tutorial
  • Demo
  • How-to

@github-actions
Copy link

github-actions bot commented Sep 22, 2025

Your preview is ready 🎉!

You can view your changes here

Deployed at: 2025-11-20 22:07:40 UTC

Copy link
Contributor

@DSGuala DSGuala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made an initial skim and left comments. Overall a very nice/complete first draft.

Still pending from my side:

  • In depth review of the text for clarity
  • In depth review of the code for efficiency and output

But basically I think 1 or two more rounds of review and this should be ready to go.

DSGuala and others added 16 commits September 29, 2025 17:52
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
#
# On the right we decode the states back into pixel space. In line with the histogram, the
# reconstructed “1” is virtually indistinguishable from its original, whereas the reconstructed “0”
# shows minor blurring. By selecting a deeper circuit the quality of the reconstructed images could be
Copy link
Contributor

@daniela-angulo daniela-angulo Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# shows minor blurring. By selecting a deeper circuit the quality of the reconstructed images could be
# shows minor blurring. By selecting a deeper circuit, the quality of the reconstructed images could be

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this, but I think the original version was right. Deeper is just an adjective modifying circuit.

Copy link
Contributor

@daniela-angulo daniela-angulo Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha because I didn't write my comma where I wanted to. I didn't mean that, I'm sorry, of course my way is very wrong. I meant "By selecting a deeper circuit, the quality of the reconstructed images could be"
I updated the suggestion

Co-authored-by: Daniela Angulo <42325731+daniela-angulo@users.noreply.github.com>
fkiwit and others added 3 commits November 2, 2025 19:58
Co-authored-by: Daniela Angulo <42325731+daniela-angulo@users.noreply.github.com>
Co-authored-by: Diego <67476785+DSGuala@users.noreply.github.com>
@@ -0,0 +1,2 @@
autoray==0.6.12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a compatibility error with autoray 0.6.12 when building the demo. Could we upgrade this to 0.8 or remove the requirement? Or will that break something else?


######################################################################
# 3. Quantum classifiers
# ----------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# ----------------------
# ~~~~~~~~~~~~~~~~~~~~~~


######################################################################
# Reconstructing images from quantum states
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copy link
Contributor

@daniela-angulo daniela-angulo Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# -----------------------------------------


######################################################################
# Preparing the training / validation split
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copy link
Contributor

@daniela-angulo daniela-angulo Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ------------------------------------------


######################################################################
# Training setup and loop
# ~~~~~~~~~~~~~~~~~~~~~~~
Copy link
Contributor

@daniela-angulo daniela-angulo Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# ~~~~~~~~~~~~~~~~~~~~~~~
# -----------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants