Skip to content

NullLabTests/pennylane-demos

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,386 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PennyLane Demonstrations Hero Image

πŸ”¬ PennyLane Demonstrations β€” Agent Experiments Fork

Fork License Python PennyLane Hypotheses Experiments Activity Contributions

Agent-driven experiments fork of the PennyLane demonstration suite.
Contains 5 Python implementations of testable hypotheses in hybrid quantum-classical ML.
⬆️ Inherits the full upstream demo collection from PennyLaneAI/demos.


Fork Architecture Diagram

Fork architecture showing upstream origin, added experiments, and mapping of each hypothesis to its PennyLane baseline demo. Each experiment extends a specific tutorial.



🌐 Ecosystem Overview

graph TB
    classDef north fill:#1a1a2e,stroke:#00d4aa,stroke-width:2,color:#ccc
    classDef impl fill:#1a1a2e,stroke:#7C3AED,stroke-width:3,color:#fff
    classDef exec fill:#1a1a2e,stroke:#10B981,stroke-width:2,color:#ccc
    classDef up fill:#333,stroke:#666,stroke-width:1,color:#999

    subgraph Upstream_Source["☁️ Upstream"]
        U[("πŸ”¬ PennyLaneAI/demos<br/>Official Demos")]
    end
    subgraph Agent_Stack["πŸ€– Agent Experiment Stack"]
        direction TB
        H[("πŸ§ͺ agent-hypotheses<br/>Research Definitions")]
        D[("🐍 pennylane-demos<br/><b>← You Are Here</b>")]
        E[("πŸ““ agent-experiments<br/>Runnable Notebooks")]
    end
    subgraph Deliverables["πŸ“¦ Deliverables"]
        S[("πŸ“ experiments/<br/>H1–H5 Python scripts")]
        R[("πŸ“Š results/<br/>Metrics & Plots")]
    end

    U -.->|"fork + extend"| D
    H -->|"defines"| D
    D -->|"implements"| S
    S -->|"packaged as"| E
    S --> R
    E -->|"results validate"| H

    class H north
    class D,impl,S,R impl
    class E exec
    class U up
Loading


πŸ§ͺ What's New: Agent Experiments (experiments/)

This fork adds 5 agent-generated experiment scripts on top of the full PennyLane demo suite.

Experiment Matrix

graph LR
    subgraph H1_H2["Trainability Track"]
        H1["H1: NAS HQNN"]
        H2["H2: Dissipation vs Local Cost"]
    end
    subgraph H3_H5["Expressivity Track"]
        H3["H3: Post-Variational"]
        H4["H4: PDE-Constrained"]
        H5["H5: Data-Reuploading"]
    end
    H1_H2 -->|"BP mitigation"| H3_H5
    style H1 fill:#8B5CF6,color:#fff
    style H2 fill:#3B82F6,color:#fff
    style H3 fill:#EF4444,color:#fff
    style H4 fill:#F59E0B,color:#fff
    style H5 fill:#10B981,color:#fff
Loading
ID Script Area Est. Cost Dependencies Run Command
H1 h1_joint_nas_hqnn.py pennylane torch scikit-learn python experiments/h1_joint_nas_hqnn.py
H2 h2_engineered_dissipation_bp.py pennylane matplotlib python experiments/h2_engineered_dissipation_bp.py
H3 h3_post_variational_benchmarks.py pennylane scikit-learn python experiments/h3_post_variational_benchmarks.py
H4 h4_pde_constrained_loss.py pennylane matplotlib python experiments/h4_pde_constrained_loss.py
H5 h5_data_reuploading_scaling.py pennylane scikit-learn python experiments/h5_data_reuploading_scaling.py

Each script is self-contained with CLI argument parsing (--help for options) and timestamped JSON output saved to experiments/results/.



πŸš€ Getting Started

Prerequisites

# Python 3.10+
python --version

# PennyLane (core + lightning simulator)
pip install pennylane pennylane-lightning

Run All Experiments

# Clone this fork
git clone https://github.com/NullLabTests/pennylane-demos.git
cd pennylane-demos

# Run experiments sequentially
for script in experiments/h*.py; do
    echo "=== Running $script ==="
    python "$script"
    echo ""
done

Run with Custom Parameters

Each script supports CLI arguments:

python experiments/h1_joint_nas_hqnn.py --n-samples 200 --n-epochs 20 --output-dir experiments/results
python experiments/h2_engineered_dissipation_bp.py           # uses defaults
python experiments/h3_post_variational_benchmarks.py        # uses defaults
python experiments/h4_pde_constrained_loss.py               # uses defaults
python experiments/h5_data_reuploading_scaling.py           # uses defaults

Results are saved to experiments/results/<id>_<timestamp>.json with plots in PNG format.



πŸ“ Repository Structure

πŸ“¦ pennylane-demos (fork)
β”‚
β”œβ”€β”€ πŸ§ͺ AGENT EXPERIMENTS β€” Added content
β”‚   β”œβ”€β”€ πŸ“ experiments/
β”‚   β”‚   β”œβ”€β”€ h1_joint_nas_hqnn.py              # H1: NAS for Pareto-optimal HQNNs
β”‚   β”‚   β”œβ”€β”€ h2_engineered_dissipation_bp.py    # H2: Engineered dissipation vs local cost
β”‚   β”‚   β”œβ”€β”€ h3_post_variational_benchmarks.py  # H3: Post-variational strategies
β”‚   β”‚   β”œβ”€β”€ h4_pde_constrained_loss.py         # H4: PDE-constrained loss functions
β”‚   β”‚   β”œβ”€β”€ h5_data_reuploading_scaling.py     # H5: Trainable data reuploading
β”‚   β”‚   └── πŸ“ results/                        # πŸ“Š Generated metrics & plots (gitignored)
β”‚   └── πŸ“„ README.md                           # ℹ️ This file
β”‚
β”œβ”€β”€ ⬆️ UPSTREAM CONTENT β€” Inherited from PennyLaneAI/demos
β”‚   β”œβ”€β”€ πŸ“ demonstrations_v2/                  # 🌐 Official PennyLane demo notebooks
β”‚   β”œβ”€β”€ πŸ“ dependencies/                       # πŸ“¦ Dependency metadata
β”‚   β”œβ”€β”€ πŸ“ documentation/                      # πŸ“– CLI tool & docs
β”‚   β”œβ”€β”€ πŸ“ lib/                                # πŸ› οΈ Shared utilities
β”‚   β”œβ”€β”€ πŸ“ _static/                            # 🎨 Web assets
β”‚   β”œβ”€β”€ πŸ“ _templates/                         # πŸ“ Sphinx templates
β”‚   β”œβ”€β”€ πŸ“„ conf.py                             # βš™οΈ Sphinx configuration
β”‚   β”œβ”€β”€ πŸ“„ index.rst                           # πŸ“‘ Documentation index
β”‚   β”œβ”€β”€ πŸ“„ CONTRIBUTING.md                     # πŸ“– Contributor guide
β”‚   └── πŸ“„ LICENSE                             # βš–οΈ Apache 2.0
β”‚
└── πŸ› οΈ BUILD & CI
    β”œβ”€β”€ πŸ“„ pyproject.toml                      # 🐍 Poetry project config
    β”œβ”€β”€ πŸ“„ poetry.lock                         # πŸ”’ Locked dependencies
    β”œβ”€β”€ πŸ“„ extension.py                        # πŸ”§ Sphinx extension
    └── πŸ“ .github/                            # πŸ€– CI workflows


πŸ”— Sister Repositories

Repository Badge Purpose Link
agent-hypotheses Research hypotheses & metrics β†’ View
pennylane-demos (this repo) Python scripts (forked) ← You are here
agent-experiments Notebooks + CI β†’ View

Data Flow

flowchart LR
    subgraph Up[" "]
        U["PennyLaneAI/demos"] -.->|"basis for"| D["pennylane-demos"]
    end
    subgraph Core[" "]
        H["agent-hypotheses"] -->|"informs"| D
    end
    subgraph Down[" "]
        D -->|"wraps into"| E["agent-experiments"]
    end
    style U fill:#333,stroke:#666,color:#999,stroke-width:1
    style H fill:#1a1a2e,stroke:#00d4aa,color:#fff,stroke-width:2
    style D fill:#1a1a2e,stroke:#7C3AED,color:#fff,stroke-width:3
    style E fill:#1a1a2e,stroke:#10B981,color:#fff,stroke-width:2
Loading

Cross-Repository Data Flow

End-to-end data flow: hypotheses.json defines experiment parameters β†’ Python scripts execute with CLI args β†’ timestamped JSON results validate hypotheses. A complete feedback loop across all three repositories.



⬆️ Upstream Attribution

This fork inherits the full PennyLane demonstration suite β€” a collection of tutorials and implementations ranging from introductory concepts to cutting-edge quantum computing research. Built by Xanadu, for research.

Resource Link
🌐 Online Demonstrations pennylane.ai/qml/demonstrations
πŸ“– Contributing Guide CONTRIBUTING.md
πŸ› οΈ CLI Tool documentation/demo-cli.md
πŸ“¦ Dependency Management dependencies/README.md
πŸ› Issue Tracker PennyLaneAI/demos/issues


πŸ“„ License

The materials and demonstrations contained within this repository are free and open-source, released under the Apache License, Version 2.0.

Please note, the file custom_directives.py is available under the BSD 3-Clause License, with copyright Β© 2017, PyTorch contributors.


Part of the NullLabTests agent-driven research ecosystem.

About

Introductions to key concepts in quantum programming, as well as tutorials and implementations from cutting-edge quantum computing research.

Topics

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks