AI-Powered Quantum Optics Experiment Designer
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.
- π¬ 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
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 β
ββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββ
app.py- Streamlit web interface with dual-column chat/design layoutllm_designer.py- Main LLM agent with self-refinement and memoryfreeform_simulation_agent.py- Physics-aware simulation code generatortoolbox_loader.py- Manages primitives and learned composite componentssimple_optical_table.py- 2D optical table renderer with beam routingembedding_retriever.py- Semantic search using BGE-M3 embeddingssrc/agentic_quantum/- Lightweight quantum primitives library (states, operations, LLM client)
The system combines three cognitive layers:
- Conversational Layer: Natural language understanding for experiment descriptions
- Design Layer: Component selection, layout generation, and beam path planning
- 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
- Python 3.9 or higher
- API key from OpenRouter, OpenAI, or Anthropic
-
Clone the repository:
git clone https://github.com/rithvik1122/Anubuddhi.git cd Anubuddhi -
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
-
Configure API key:
cp .env.example .env nano .env # Add your API keyRequired in
.env:OPENAI_API_KEY=your_openrouter_or_openai_key_here
-
Launch the application:
bash launch.sh
Or manually:
conda activate anubuddhi streamlit run app.py
-
Open browser to
http://localhost:8501
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:
- Generate an optical table layout
- Place and orient all components
- Calculate beam paths
- Validate the design through simulation
- Refine if issues are found
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
The system first determines your intent:
- Chat mode: Questions, explanations, physics discussions
- Design mode: "Create", "design", "build" trigger design generation
The LLM Designer:
- Retrieves similar past experiments from memory
- Selects appropriate optical components from toolbox
- Generates component positions and orientations
- Calculates beam paths between components
- Provides physics justification for each choice
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).
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
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
This repository includes 15 complete quantum experiments designed by the system:
- Mach-Zehnder Interferometer
- Hong-Ou-Mandel Interference
- Michelson Interferometer
- Bell State Generator (SPDC)
- Delayed Choice Quantum Eraser
- 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
- 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.
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-...# 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_toolboxInput:
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
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
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
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
MIT License - See LICENSE file for details.
This software is provided for research and educational purposes with proper attribution required.
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
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}
}For questions, suggestions, or collaboration:
- GitHub Issues: https://github.com/rithvik1122/Anubuddhi/issues
- Discussions: https://github.com/rithvik1122/Anubuddhi/discussions
AαΉubuddhi (ΰ€
ΰ€£ΰ₯ΰ€¬ΰ₯ΰ€¦ΰ₯ΰ€§ΰ€Ώ)
Atomic Intelligence for Quantum Discovery
Β© 2025 S. K. Rithvik. All rights reserved.