Skip to content

About

Agentic AI for Quantum Experiment Design

Resources

Stars

0 stars

Watchers

0 watching

Forks

Β 
Β 

Latest commit

Β 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AαΉ‡ubuddhi (ΰ€…ΰ€£ΰ₯ΰ€¬ΰ₯ΰ€¦ΰ₯ΰ€§ΰ€Ώ)

AI-Powered Quantum Optics Experiment Designer

License: MIT Python: 3.9+ Streamlit

🌟 Overview

AαΉ‡ubuddhi (Sanskrit: ΰ€…ΰ€£ΰ₯ΰ€¬ΰ₯ΰ€¦ΰ₯ΰ€§ΰ€Ώ, "Atomic Intelligence") is an LLM-powered system that designs quantum optics experiments through natural conversation. Using Large Language Models with physics knowledge, it generates complete optical setups, validates designs through simulation, and learns from each experiment.

What Makes It Unique

  • πŸ’¬ Conversational Design: Describe your experiment in plain English - the AI translates it into optical components
  • 🎨 Intelligent Layout: Automatically generates 2D optical table layouts with proper beam routing
  • πŸ”¬ Dual-Mode Simulation: Validates designs using both QuTiP (Fock states) and FreeSim (full physics freedom)
  • 🧠 Learning System: Builds a toolbox of reusable composite components from successful designs
  • πŸ”„ Self-Refinement: Iteratively improves designs through validation loops (up to 3 cycles)
  • πŸ” Web-Enhanced: Can search for quantum optics papers and protocols when needed

πŸ—οΈ System Architecture

The system uses a cognitive pipeline with specialized components:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      User Interface                          β”‚
β”‚          (Streamlit Chat + Optical Table Viewer)             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    LLM Designer Agent                        β”‚
β”‚  β€’ Conversational routing (chat vs. design mode)            β”‚
β”‚  β€’ Memory-augmented design generation                       β”‚
β”‚  β€’ Self-refinement loop (validation β†’ critique β†’ improve)   β”‚
β”‚  β€’ Toolbox integration (primitives + learned composites)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚                   β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Toolbox System  β”‚  β”‚  FreeForm Simulation Agent            β”‚
β”‚  β€’ Primitives    β”‚  β”‚  β€’ Physics-aware code generation      β”‚
β”‚  β€’ Composites    β”‚  β”‚  β€’ Uses simulation pattern library    β”‚
β”‚  β€’ Custom blocks β”‚  β”‚  β€’ Full scientific Python freedom     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            β”‚                   β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Embedding Search β”‚  β”‚  Optical Table Renderer               β”‚
β”‚ β€’ BGE-M3 model   β”‚  β”‚  β€’ Component positioning              β”‚
β”‚ β€’ Semantic       β”‚  β”‚  β€’ Beam path calculation              β”‚
β”‚   retrieval      β”‚  β”‚  β€’ Matplotlib visualization           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Components

  1. app.py - Streamlit web interface with dual-column chat/design layout
  2. llm_designer.py - Main LLM agent with self-refinement and memory
  3. freeform_simulation_agent.py - Physics-aware simulation code generator
  4. toolbox_loader.py - Manages primitives and learned composite components
  5. simple_optical_table.py - 2D optical table renderer with beam routing
  6. embedding_retriever.py - Semantic search using BGE-M3 embeddings
  7. src/agentic_quantum/ - Lightweight quantum primitives library (states, operations, LLM client)

Design Philosophy

The system combines three cognitive layers:

  1. Conversational Layer: Natural language understanding for experiment descriptions
  2. Design Layer: Component selection, layout generation, and beam path planning
  3. Validation Layer: Physics simulation and iterative refinement

AαΉ‡ubuddhi understands physics intent and automatically handles:

  • Component placement and orientation
  • Beam routing and path calculation
  • Physics validation and error detection
  • Design improvement suggestions

πŸš€ Quick Start

Prerequisites

  • Python 3.9 or higher
  • API key from OpenRouter, OpenAI, or Anthropic

Installation

  1. Clone the repository:

    git clone https://github.com/rithvik1122/Anubuddhi.git
    cd Anubuddhi
  2. Run the automated setup:

    bash install.sh

    This will:

    • Create a conda environment with Python 3.9
    • Install all dependencies (numpy, qutip, streamlit, etc.)
    • Set up the project structure
  3. Configure API key:

    cp .env.example .env
    nano .env  # Add your API key

    Required in .env:

    OPENAI_API_KEY=your_openrouter_or_openai_key_here
  4. Launch the application:

    bash launch.sh

    Or manually:

    conda activate anubuddhi
    streamlit run app.py
  5. Open browser to http://localhost:8501

First Experiment

Try these example prompts:

"Design a Hong-Ou-Mandel interference experiment"

"Create a Mach-Zehnder interferometer with two detectors"

"Build a Bell state generator using SPDC"

"I want to measure photon correlations between two outputs"

The AI will:

  1. Generate an optical table layout
  2. Place and orient all components
  3. Calculate beam paths
  4. Validate the design through simulation
  5. Refine if issues are found

πŸ“ Project Structure

Anubuddhi/
β”œβ”€β”€ app.py                          # Main Streamlit application
β”œβ”€β”€ llm_designer.py                 # LLM agent with self-refinement
β”œβ”€β”€ freeform_simulation_agent.py    # Physics simulation generator
β”œβ”€β”€ toolbox_loader.py               # Component toolbox manager
β”œβ”€β”€ simple_optical_table.py         # Optical table renderer
β”œβ”€β”€ embedding_retriever.py          # Semantic search engine
β”œβ”€β”€ install.sh                      # Automated installation script
β”œβ”€β”€ launch.sh                       # Application launcher
β”œβ”€β”€ requirements.txt                # Python dependencies
β”œβ”€β”€ .env.example                    # API key template
β”œβ”€β”€ .gitignore                      # Git exclusions
β”‚
β”œβ”€β”€ src/agentic_quantum/           # Quantum primitives library
β”‚   β”œβ”€β”€ quantum/                   # Quantum states and operations
β”‚   β”‚   β”œβ”€β”€ states.py              # Fock, coherent, squeezed states
β”‚   β”‚   β”œβ”€β”€ operations.py          # Beam splitters, phase shifts
β”‚   β”‚   β”œβ”€β”€ measurements.py        # Detection and measurement
β”‚   β”‚   β”œβ”€β”€ experiment.py          # Experiment construction
β”‚   β”‚   └── simulator.py           # QuTiP-based simulator
β”‚   β”œβ”€β”€ llm/                       # LLM client wrapper
β”‚   β”‚   └── simple_client.py       # SimpleLLM class
β”‚   └── visualization/             # Plotting utilities
β”‚       └── optical_table.py       # Optical table rendering
β”‚
β”œβ”€β”€ toolbox/                       # Component definitions
β”‚   β”œβ”€β”€ primitives.json            # Basic optical components
β”‚   β”œβ”€β”€ learned_composites.json    # User-approved building blocks
β”‚   β”œβ”€β”€ custom_components.json     # Custom user components
β”‚   └── simulation_toolbox.json    # Simulation patterns
β”‚
β”œβ”€β”€ Results_FreeSim/               # Freeform simulation results
β”‚   └── [experiment_folders]/      # Complete experimental data
β”‚       β”œβ”€β”€ 01_freeform_simulation.py
β”‚       β”œβ”€β”€ 03_simulation_report.md
β”‚       β”œβ”€β”€ 04_analysis_results.json
β”‚       β”œβ”€β”€ 06_design_specification.json
β”‚       β”œβ”€β”€ 07_optical_setup.png
β”‚       └── figures/
β”‚
└── Results_QuTiP/                 # QuTiP-constrained results
    └── [experiment_folders]/      # QuTiP validation runs
        β”œβ”€β”€ 03_qutip_simulation.py
        β”œβ”€β”€ 04_design_components.json
        β”œβ”€β”€ 05_deep_analysis.md
        └── 01_optical_setup.png

πŸ”§ How It Works

1. Conversational Routing

The system first determines your intent:

  • Chat mode: Questions, explanations, physics discussions
  • Design mode: "Create", "design", "build" trigger design generation

2. Design Generation

The LLM Designer:

  1. Retrieves similar past experiments from memory
  2. Selects appropriate optical components from toolbox
  3. Generates component positions and orientations
  4. Calculates beam paths between components
  5. Provides physics justification for each choice

3. Validation & Refinement

Automated quality checks:

  • Component overlap detection
  • Beam path feasibility
  • Physics consistency validation
  • Simulation-based verification

If issues are found, the system automatically refines the design (up to 3 cycles).

4. Simulation

Two simulation modes:

QuTiP Mode (Fock space):

  • Best for: Interferometry, beam splitters, phase shifts
  • Constraints: Discrete photon numbers, limited Hilbert space
  • Speed: Fast, numerically stable

FreeSim Mode (full freedom):

  • Best for: Temporal effects, continuous variables, atomic physics
  • Freedom: Any Python library (NumPy, SciPy, custom models)
  • Flexibility: Chooses appropriate formalism per experiment

5. Knowledge Retrieval

The system uses existing knowledge:

  • Retrieves proven designs from toolbox as "learned composites"
  • Semantic search via embedding index for similar components
  • Pre-loaded simulation patterns for different experiment types
  • Physics knowledge from validated design library

πŸ§ͺ Experimental Results

This repository includes 15 complete quantum experiments designed by the system:

Tier 1: Foundational Experiments (5)

  • Mach-Zehnder Interferometer
  • Hong-Ou-Mandel Interference
  • Michelson Interferometer
  • Bell State Generator (SPDC)
  • Delayed Choice Quantum Eraser

Tier 2: Advanced Protocols (7)

  • 3-Photon GHZ State Generator
  • Quantum Teleportation
  • Franson Interferometer (Time-Bin Entanglement)
  • 4-Photon Boson Sampling
  • Squeezed Light via OPO
  • BB84 Quantum Key Distribution
  • Continuous-Variable Quantum Teleportation

Tier 3: Frontier Technology (3)

  • Electromagnetically Induced Transparency (EIT)
  • Hyperentangled Photon Source (Polarization + OAM)
  • Quantum Frequency Converter (Telecom to Visible)

Each experiment folder contains:

  • Complete Python simulation code
  • Design specifications (JSON)
  • Analysis results and metrics
  • Optical table diagrams
  • Performance evaluation

Key Finding: 13 out of 15 experiments preferred FreeSim over QuTiP, demonstrating the value of physics-aware formalism selection.

βš™οΈ Configuration

API Keys

The system supports multiple LLM providers:

# OpenRouter (recommended - access to multiple models)
OPENAI_API_KEY=sk-or-v1-...

# Direct OpenAI
OPENAI_API_KEY=sk-...

# Anthropic Claude
ANTHROPIC_API_KEY=sk-ant-...

Optional Features

# Enable web search for finding papers/protocols
ENABLE_WEB_SEARCH=false

# Maximum self-refinement cycles
MAX_REFINEMENT_CYCLES=3

# Simulation timeout (seconds)
SIMULATION_TIMEOUT=120

# Vector database directory
CHROMA_PERSIST_DIRECTORY=./chroma_toolbox

πŸ“Š Usage Examples

Example 1: Basic Interferometer

Input:

Design a Mach-Zehnder interferometer with phase control

Output:

  • 8-component optical table
  • 2 beam splitters (50:50)
  • 2 mirrors
  • 1 phase shifter
  • 2 detectors
  • Automatic beam routing
  • Simulation showing complementary interference patterns

Example 2: Photon Source

Input:

I need an entangled photon source using spontaneous parametric down-conversion

Output:

  • SPDC crystal with type-II phase matching
  • Pump laser preparation
  • Polarization optics
  • Spatial mode filtering
  • Coincidence detection setup
  • Validation: Bell state fidelity > 0.95

Example 3: Learning from Experience

Input:

Design a Hong-Ou-Mandel setup similar to the previous Bell state generator

Output:

  • System retrieves Bell state design from memory
  • Adapts it for HOM geometry
  • Reuses validated SPDC configuration
  • Adds delay stage for temporal overlap
  • Simulates HOM dip visibility

🀝 Contributing

Contributions welcome! Areas of interest:

  • New optical components: Add to toolbox/primitives.json
  • Simulation methods: Extend freeform_simulation_agent.py
  • Physics domains: Beyond photonics (atoms, ions, superconductors)
  • Optimization algorithms: Genetic algorithms, Bayesian optimization
  • Visualization: 3D rendering, interactive diagrams

πŸ“œ License

MIT License - See LICENSE file for details.

This software is provided for research and educational purposes with proper attribution required.

πŸ™ Acknowledgments

Designed and Developed by S. K. Rithvik

Built with:

  • OpenAI/Anthropic LLMs - Natural language understanding
  • QuTiP - Quantum optics simulation
  • ChromaDB - Vector storage and semantic search
  • Streamlit - Interactive web interface
  • BGE-M3 - Multilingual embedding model

Inspired by:

  • The quantum optics community
  • Open-source scientific computing
  • The vision of AI-human collaboration in physics

πŸ“š Citation

If you use AαΉ‡ubuddhi in your research, please cite:

@software{anubuddhi2025,
  title={AαΉ‡ubuddhi: Agentic AI for Quantum Experiment Design},
  author={Rithvik, S. K.},
  year={2025},
  url={https://github.com/rithvik1122/Anubuddhi},
  note={AI-driven system for conversational quantum experiment design}
}

πŸ“§ Contact

For questions, suggestions, or collaboration:


AαΉ‡ubuddhi (ΰ€…ΰ€£ΰ₯ΰ€¬ΰ₯ΰ€¦ΰ₯ΰ€§ΰ€Ώ)
Atomic Intelligence for Quantum Discovery

Β© 2025 S. K. Rithvik. All rights reserved.

About

Agentic AI for Quantum Experiment Design

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages