Skip to main content

Quantum neural network models using photonic circuits - Preview

Project description

MerLin - Photonic Quantum Machine Learning Framework

MerLin brings quantum computing capabilities to AI practitioners through easy-to-use PyTorch integrations. Named after the legendary wizard, MerLin adds quantum wizardry to your AI toolkit with no quantum expertise required.

Built for AI/ML practitioners: MerLin is designed to feel familiar to PyTorch users while unlocking the potential of quantum computing. Under the hood, it leverages photonic quantum computing - a cutting-edge approach using single-photons that's hardware-aware and prepares your models for real quantum processors.

Simulation-first with hardware bridges: Optimized for classical simulation today, with connections to currently available photonic QPUs and pathways to next-generation quantum hardware.

Key Goals:

  • Paper Reproduction: Simple tools to reproduce published quantum ML papers and benchmark algorithms - see our reproduced papers list.
  • Quantum Architecture Bridge: Access to latest and next-gen quantum photonic architectures as a bridge between AI and quantum worlds - see our quantum architectures.
  • GPU-Optimized Performance: Fast simulation scaling up to 500+ mode chips with 10-20 photons near the simulability threshold - see performance benchmarks.

Together, these provide researchers with comprehensive tools for exploring and developing new quantum-classical hybrid algorithms.

Why Quantum Layers? Enable non-conventional operations in hybrid workflows that can help classical ML models improve performance, learn faster, or use fewer parameters.

Advanced users can leverage the underlying Perceval framework for custom models or advanced functionality.

Who Should Use MerLin?

  • AI/ML Practitioners: Add quantum layers to existing PyTorch models
  • Quantum Researchers: Experiment with photonic quantum computing
  • Enterprise Teams: Build future-proof quantum-AI applications

Installation

   pip install merlinquantum

For development:

   git clone https://github.com/merlinquantum/merlin.git
   cd merlin
   pip install -e ".[dev]"

Hello Quantum World!

The following shows how to create a very simple quantum layer using MerLin's high-level API. This layer can be integrated into any PyTorch model, and supports usual PyTorch operations like training and inference.

   import merlin as ML # Package: merlinquantum, import: merlin
   import torch
   
   # Create a simple quantum layer
   quantum_layer = ML.QuantumLayer.simple(
       input_size=3,
       n_params=50  # Number of trainable quantum parameters
   )

   # Use it like any PyTorch layer
   x = torch.rand(10, 3)
   output = quantum_layer(x)
   print(f"Input shape: {x.shape}, Output shape: {output.shape}")

Under the hood, this simple interface wraps complex photonic quantum operations — including architecture selection, ansatz design, input encoding, and photon number configuration. Learn more in our User Guide.

Learn More

  • Examples: Check the examples/ directory for tutorials
  • Notebooks: Explore docs/source/notebooks/ for interactive examples

Roadmap

  • v0.1: Initial release with core features

  • In development:

    • More circuit types and ansatz configurations
    • Improved documentation and examples
    • Integration with Quandela's photonic hardware
    • additional machine learning models

Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Test your changes: pytest tests/
  4. Submit a pull request

See our Contributing Guide for detailed guidelines.

License

MIT License - see LICENSE for details.

Support


⚡ Ready to add quantum power to your AI models? Get started with MerLin! ⚡

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

merlinquantum-0.1.1.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

merlinquantum-0.1.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file merlinquantum-0.1.1.tar.gz.

File metadata

  • Download URL: merlinquantum-0.1.1.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for merlinquantum-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7fc3faf8600f88520eae041fc776e985c080203ab31534496cbc6622c81a131f
MD5 9f8c33d17e469b6e259dbb97f0fd0304
BLAKE2b-256 31dca86df3be685a6de9aedeeb6d624557bc2b8dd983601ffe3ab41143605073

See more details on using hashes here.

File details

Details for the file merlinquantum-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: merlinquantum-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.7

File hashes

Hashes for merlinquantum-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b5de8abf7e773b83bd700d0a44041a3181d7e858d3cfca14a105632200e63c7
MD5 6da9d3d86e34cff3fba9fa11c7110077
BLAKE2b-256 6e866a16d4c0f935c11431f1bbbc95897a7157c7870352a6a08cd634772cc364

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page