Spaces:
Sleeping
Sleeping
| """ | |
| Quantum Paradox Lab | |
| Interactive demos proving quantum's future is architecture over qubit counts. | |
| Explores: Barren Plateaus, QSVT Unification, Photonic Blueprints, AI Circuit Design | |
| """ | |
| import gradio as gr | |
| import numpy as np | |
| import plotly.graph_objects as go | |
| import plotly.express as px | |
| from plotly.subplots import make_subplots | |
| import math | |
| # Quantum algorithm data for QSVT unification | |
| QSVT_ALGORITHMS = { | |
| "Grover's Search": { | |
| "year": 1996, | |
| "speedup": "Quadratic", | |
| "problem": "Unstructured search", | |
| "classical": "O(N)", | |
| "quantum": "O(√N)", | |
| "unified_by_qsvt": True, | |
| "polynomial": "Sign function approximation" | |
| }, | |
| "Quantum Phase Estimation": { | |
| "year": 1995, | |
| "speedup": "Exponential", | |
| "problem": "Eigenvalue extraction", | |
| "classical": "O(N³)", | |
| "quantum": "O(log N)", | |
| "unified_by_qsvt": True, | |
| "polynomial": "Window function" | |
| }, | |
| "HHL (Linear Systems)": { | |
| "year": 2009, | |
| "speedup": "Exponential", | |
| "problem": "Solve Ax = b", | |
| "classical": "O(N³)", | |
| "quantum": "O(log N)", | |
| "unified_by_qsvt": True, | |
| "polynomial": "1/x inversion" | |
| }, | |
| "Hamiltonian Simulation": { | |
| "year": 1982, | |
| "speedup": "Exponential", | |
| "problem": "Time evolution", | |
| "classical": "O(2^N)", | |
| "quantum": "O(poly(N))", | |
| "unified_by_qsvt": True, | |
| "polynomial": "Jacobi-Anger expansion" | |
| }, | |
| "Amplitude Amplification": { | |
| "year": 2000, | |
| "speedup": "Quadratic", | |
| "problem": "Probability boost", | |
| "classical": "O(1/p)", | |
| "quantum": "O(1/√p)", | |
| "unified_by_qsvt": True, | |
| "polynomial": "Chebyshev iteration" | |
| }, | |
| "Eigenvalue Threshold": { | |
| "year": 2019, | |
| "speedup": "Polynomial", | |
| "problem": "Spectral filtering", | |
| "classical": "O(N³)", | |
| "quantum": "O(N·polylog)", | |
| "unified_by_qsvt": True, | |
| "polynomial": "Step function" | |
| } | |
| } | |
| # Quantum hardware comparison | |
| QUANTUM_HARDWARE = { | |
| "Superconducting (IBM)": { | |
| "temp_kelvin": 0.015, | |
| "qubits_2024": 1121, | |
| "coherence_us": 300, | |
| "gate_fidelity": 0.999, | |
| "color": "#0066cc", | |
| "pros": "Fast gates, high connectivity", | |
| "cons": "Cryogenic cooling required" | |
| }, | |
| "Superconducting (Google)": { | |
| "temp_kelvin": 0.015, | |
| "qubits_2024": 105, | |
| "coherence_us": 100, | |
| "gate_fidelity": 0.9995, | |
| "color": "#4285f4", | |
| "pros": "Highest 2-qubit fidelity", | |
| "cons": "Expensive infrastructure" | |
| }, | |
| "Trapped Ions (IonQ)": { | |
| "temp_kelvin": 0.001, | |
| "qubits_2024": 35, | |
| "coherence_us": 10000000, | |
| "gate_fidelity": 0.999, | |
| "color": "#ff6b35", | |
| "pros": "Long coherence, all-to-all connectivity", | |
| "cons": "Slow gates, scaling challenges" | |
| }, | |
| "Photonic (Xanadu)": { | |
| "temp_kelvin": 293, | |
| "qubits_2024": 216, | |
| "coherence_us": float('inf'), | |
| "gate_fidelity": 0.99, | |
| "color": "#00ff88", | |
| "pros": "Room temperature, natural networking", | |
| "cons": "Probabilistic gates, photon loss" | |
| }, | |
| "Neutral Atoms (QuEra)": { | |
| "temp_kelvin": 0.00001, | |
| "qubits_2024": 256, | |
| "coherence_us": 1000, | |
| "gate_fidelity": 0.995, | |
| "color": "#9b59b6", | |
| "pros": "Large arrays, reconfigurable", | |
| "cons": "Laser complexity" | |
| } | |
| } | |
| # Energy costs | |
| ENERGY_COSTS = { | |
| "Classical GPU (A100)": {"watts": 400, "ops_per_sec": 1e15, "cost_per_kwh": 0.12}, | |
| "Classical TPU (v4)": {"watts": 200, "ops_per_sec": 2.7e15, "cost_per_kwh": 0.12}, | |
| "Superconducting QC": {"watts": 25000, "qubits": 1000, "cost_per_kwh": 0.12}, | |
| "Photonic QC": {"watts": 500, "qubits": 200, "cost_per_kwh": 0.12}, | |
| } | |
| def simulate_barren_plateau(num_qubits, num_layers, num_samples=100): | |
| """ | |
| Simulate gradient variance decay in variational quantum circuits. | |
| Demonstrates barren plateau phenomenon. | |
| """ | |
| np.random.seed(42) | |
| qubit_range = range(2, num_qubits + 1) | |
| # FIX: Ensure unique layer configurations to avoid duplicate simulation | |
| layer_configs = sorted(list(set([1, num_layers // 2, num_layers]))) | |
| results = [] | |
| for n_qubits in qubit_range: | |
| for n_layers in layer_configs: | |
| gradients = [] | |
| for _ in range(num_samples): | |
| grad = np.random.randn() * np.exp(-n_qubits * n_layers / 10) | |
| noise = np.random.randn() * 0.01 | |
| gradients.append(grad + noise) | |
| variance = np.var(gradients) | |
| results.append({ | |
| "qubits": n_qubits, | |
| "layers": n_layers, | |
| "variance": variance, | |
| "vanishing": variance < 1e-6 | |
| }) | |
| return results | |
| def create_barren_plateau_chart(num_qubits, num_layers): | |
| """Create interactive barren plateau visualization.""" | |
| results = simulate_barren_plateau(num_qubits, num_layers) | |
| fig = make_subplots( | |
| rows=1, cols=2, | |
| subplot_titles=("Gradient Variance vs Qubits", "The Paradox Zone"), | |
| specs=[[{"type": "scatter"}, {"type": "heatmap"}]] | |
| ) | |
| # FIX: Ensure unique layer configurations to avoid duplicate legend entries | |
| unique_layers = sorted(list(set([1, num_layers // 2, num_layers]))) | |
| for n_layers in unique_layers: | |
| layer_data = [r for r in results if r["layers"] == n_layers] | |
| fig.add_trace( | |
| go.Scatter( | |
| x=[r["qubits"] for r in layer_data], | |
| y=[r["variance"] for r in layer_data], | |
| mode='lines+markers', | |
| name=f'{n_layers} layers', | |
| line=dict(width=2), | |
| marker=dict(size=8) | |
| ), | |
| row=1, col=1 | |
| ) | |
| fig.add_hline(y=1e-6, line_dash="dash", line_color="red", | |
| annotation_text="Vanishing threshold", row=1, col=1) | |
| qubits_list = list(range(2, num_qubits + 1)) | |
| layers_list = list(range(1, num_layers + 1)) | |
| z_matrix = np.zeros((len(layers_list), len(qubits_list))) | |
| for i, n_layers in enumerate(layers_list): | |
| for j, n_qubits in enumerate(qubits_list): | |
| z_matrix[i, j] = np.exp(-n_qubits * n_layers / 10) | |
| fig.add_trace( | |
| go.Heatmap( | |
| z=np.log10(z_matrix + 1e-10), | |
| x=qubits_list, | |
| y=layers_list, | |
| colorscale=[ | |
| [0, "#00ff88"], | |
| [0.5, "#ffcc00"], | |
| [1, "#ff0000"] | |
| ], | |
| showscale=True, | |
| colorbar=dict(title="log₁₀(variance)") | |
| ), | |
| row=1, col=2 | |
| ) | |
| fig.update_layout( | |
| title=dict( | |
| text="Barren Plateaus: The Trainability Paradox", | |
| font=dict(size=20, color="#00ff88") | |
| ), | |
| paper_bgcolor='#0d0d1a', | |
| plot_bgcolor='#0d0d1a', | |
| font=dict(color='white'), | |
| height=450, | |
| showlegend=True | |
| ) | |
| fig.update_xaxes(title_text="Number of Qubits", gridcolor='#333355', row=1, col=1) | |
| fig.update_yaxes(title_text="Gradient Variance", type="log", gridcolor='#333355', row=1, col=1) | |
| fig.update_xaxes(title_text="Qubits", row=1, col=2) | |
| fig.update_yaxes(title_text="Layers", row=1, col=2) | |
| return fig | |
| def create_qsvt_unification_chart(): | |
| """Create visualization of QSVT unifying quantum algorithms.""" | |
| fig = go.Figure() | |
| algorithms = list(QSVT_ALGORITHMS.keys()) | |
| years = [QSVT_ALGORITHMS[a]["year"] for a in algorithms] | |
| colors = ['#0074D9', '#FF4136', '#2ECC40', '#FFDC00', '#F012BE', '#FF851B'] | |
| for i, (algo, data) in enumerate(QSVT_ALGORITHMS.items()): | |
| fig.add_trace(go.Scatter( | |
| x=[data["year"]], | |
| y=[i], | |
| mode='markers+text', | |
| marker=dict(size=30, color=colors[i], symbol='circle'), | |
| text=[algo.split()[0]], | |
| textposition="middle right", | |
| textfont=dict(color='white', size=11), | |
| hovertemplate=f"<b>{algo}</b><br>Year: {data['year']}<br>Speedup: {data['speedup']}<br>Problem: {data['problem']}<extra></extra>" | |
| )) | |
| fig.add_shape( | |
| type="rect", | |
| x0=2015, x1=2025, y0=-0.5, y1=5.5, | |
| fillcolor="rgba(0, 255, 136, 0.1)", | |
| line=dict(color="#00ff88", width=2) | |
| ) | |
| fig.add_annotation( | |
| x=2020, y=5.8, | |
| text="QSVT Unification (2019+)", | |
| showarrow=False, | |
| font=dict(color="#00ff88", size=14) | |
| ) | |
| for i in range(len(algorithms)): | |
| fig.add_shape( | |
| type="line", | |
| x0=years[i], y0=i, | |
| x1=2019, y1=2.5, | |
| line=dict(color=colors[i], width=1, dash="dot") | |
| ) | |
| fig.update_layout( | |
| title="QSVT: One Framework to Rule Them All", | |
| xaxis=dict(title="Year Discovered", range=[1980, 2026], gridcolor='#333355'), | |
| yaxis=dict(visible=False, range=[-1, 7]), | |
| paper_bgcolor='#0d0d1a', | |
| plot_bgcolor='#0d0d1a', | |
| font=dict(color='white'), | |
| height=400, | |
| showlegend=False | |
| ) | |
| return fig | |
| def create_hardware_comparison(): | |
| """Create quantum hardware comparison chart.""" | |
| fig = make_subplots( | |
| rows=1, cols=2, | |
| subplot_titles=("Operating Temperature (log scale)", "Qubit Count vs Coherence"), | |
| specs=[[{"type": "bar"}, {"type": "scatter"}]] | |
| ) | |
| names = list(QUANTUM_HARDWARE.keys()) | |
| temps = [QUANTUM_HARDWARE[n]["temp_kelvin"] for n in names] | |
| colors = [QUANTUM_HARDWARE[n]["color"] for n in names] | |
| fig.add_trace( | |
| go.Bar( | |
| x=names, | |
| y=temps, | |
| marker_color=colors, | |
| text=[f"{t:.3f}K" if t < 1 else f"{t}K" for t in temps], | |
| textposition='outside' | |
| ), | |
| row=1, col=1 | |
| ) | |
| qubits = [QUANTUM_HARDWARE[n]["qubits_2024"] for n in names] | |
| coherence = [min(QUANTUM_HARDWARE[n]["coherence_us"], 1e7) for n in names] | |
| fig.add_trace( | |
| go.Scatter( | |
| x=qubits, | |
| y=coherence, | |
| mode='markers+text', | |
| marker=dict(size=20, color=colors), | |
| text=[n.split()[0] for n in names], | |
| textposition="top center", | |
| textfont=dict(size=10) | |
| ), | |
| row=1, col=2 | |
| ) | |
| fig.add_annotation( | |
| x=216, y=1e7, | |
| text="Photonic:<br>Room temp!", | |
| showarrow=True, | |
| arrowhead=2, | |
| arrowcolor="#00ff88", | |
| font=dict(color="#00ff88"), | |
| row=1, col=2 | |
| ) | |
| fig.update_layout( | |
| paper_bgcolor='#0d0d1a', | |
| plot_bgcolor='#0d0d1a', | |
| font=dict(color='white'), | |
| height=400, | |
| showlegend=False | |
| ) | |
| fig.update_yaxes(type="log", title="Temperature (K)", gridcolor='#333355', row=1, col=1) | |
| fig.update_xaxes(tickangle=45, row=1, col=1) | |
| fig.update_xaxes(title="Qubits (2024)", gridcolor='#333355', row=1, col=2) | |
| fig.update_yaxes(type="log", title="Coherence (μs)", gridcolor='#333355', row=1, col=2) | |
| return fig | |
| def create_energy_comparison(problem_size): | |
| """Compare energy costs for quantum vs classical.""" | |
| classical_ops = problem_size ** 3 | |
| quantum_advantage_threshold = 1000 | |
| classical_gpu_time = classical_ops / ENERGY_COSTS["Classical GPU (A100)"]["ops_per_sec"] | |
| classical_gpu_energy = classical_gpu_time * ENERGY_COSTS["Classical GPU (A100)"]["watts"] / 3600000 | |
| quantum_ops = problem_size * np.log2(problem_size) if problem_size > 1 else 1 | |
| quantum_time = quantum_ops / 1e6 | |
| sc_energy = quantum_time * ENERGY_COSTS["Superconducting QC"]["watts"] / 3600000 | |
| photonic_energy = quantum_time * ENERGY_COSTS["Photonic QC"]["watts"] / 3600000 | |
| fig = go.Figure() | |
| categories = ["Classical GPU", "Superconducting QC", "Photonic QC"] | |
| energies = [classical_gpu_energy * 1000, sc_energy * 1000, photonic_energy * 1000] | |
| colors = ["#ff6b6b", "#0066cc", "#00ff88"] | |
| fig.add_trace(go.Bar( | |
| x=categories, | |
| y=energies, | |
| marker_color=colors, | |
| text=[f"{e:.4f} Wh" for e in energies], | |
| textposition='outside' | |
| )) | |
| fig.update_layout( | |
| title=f"Energy per Query (Problem Size: {problem_size})", | |
| yaxis=dict(title="Energy (mWh)", type="log", gridcolor='#333355'), | |
| paper_bgcolor='#0d0d1a', | |
| plot_bgcolor='#0d0d1a', | |
| font=dict(color='white'), | |
| height=350 | |
| ) | |
| return fig | |
| def generate_circuit_description(problem_type, num_qubits): | |
| """Generate a description of a quantum circuit for the given problem.""" | |
| circuits = { | |
| "QAOA (Max-Cut)": f""" | |
| # QAOA Circuit for {num_qubits}-qubit Max-Cut | |
| # Layers: 2, Parameters: {num_qubits * 4} | |
| OPENQASM 3.0; | |
| include "stdgates.inc"; | |
| qubit[{num_qubits}] q; | |
| bit[{num_qubits}] c; | |
| // Initial superposition | |
| for int i in [0:{num_qubits-1}] {{ h q[i]; }} | |
| // Cost layer (problem-dependent ZZ interactions) | |
| for int i in [0:{num_qubits-2}] {{ | |
| cx q[i], q[i+1]; | |
| rz(gamma) q[i+1]; | |
| cx q[i], q[i+1]; | |
| }} | |
| // Mixer layer | |
| for int i in [0:{num_qubits-1}] {{ rx(beta) q[i]; }} | |
| // Measurement | |
| c = measure q; | |
| """, | |
| "VQE (H2 Molecule)": f""" | |
| # VQE Ansatz for Molecular Simulation | |
| # Qubits: {num_qubits}, Parameters: {num_qubits * 2} | |
| OPENQASM 3.0; | |
| include "stdgates.inc"; | |
| qubit[{num_qubits}] q; | |
| // Hardware-efficient ansatz | |
| for int i in [0:{num_qubits-1}] {{ | |
| ry(theta[i]) q[i]; | |
| rz(phi[i]) q[i]; | |
| }} | |
| // Entangling layer | |
| for int i in [0:{num_qubits-2}] {{ | |
| cx q[i], q[i+1]; | |
| }} | |
| // Second rotation layer | |
| for int i in [0:{num_qubits-1}] {{ | |
| ry(theta2[i]) q[i]; | |
| }} | |
| """, | |
| "Grover's Search": f""" | |
| # Grover's Algorithm for {num_qubits}-qubit search | |
| # Iterations: {int(np.pi/4 * np.sqrt(2**num_qubits))} | |
| OPENQASM 3.0; | |
| include "stdgates.inc"; | |
| qubit[{num_qubits}] q; | |
| qubit ancilla; | |
| // Initialize | |
| for int i in [0:{num_qubits-1}] {{ h q[i]; }} | |
| x ancilla; | |
| h ancilla; | |
| // Grover iterations | |
| for int iter in [0:{int(np.pi/4 * np.sqrt(2**num_qubits))-1}] {{ | |
| // Oracle (problem-specific) | |
| // ... mark target state ... | |
| // Diffusion operator | |
| for int i in [0:{num_qubits-1}] {{ h q[i]; x q[i]; }} | |
| // Multi-controlled Z | |
| for int i in [0:{num_qubits-1}] {{ h q[i]; x q[i]; }} | |
| }} | |
| """ | |
| } | |
| return circuits.get(problem_type, "Select a problem type") | |
| def get_algorithm_details(algo_name): | |
| """Get detailed information about a QSVT-unified algorithm.""" | |
| if algo_name not in QSVT_ALGORITHMS: | |
| return "Select an algorithm" | |
| data = QSVT_ALGORITHMS[algo_name] | |
| return f""" | |
| Algorithm: {algo_name} | |
| Year Discovered: {data['year']} | |
| Speedup Type: {data['speedup']} | |
| Problem Solved: {data['problem']} | |
| Classical Complexity: {data['classical']} | |
| Quantum Complexity: {data['quantum']} | |
| QSVT Polynomial: {data['polynomial']} | |
| How QSVT Unifies This: | |
| QSVT represents this algorithm as a polynomial transformation | |
| of singular values. The specific polynomial ({data['polynomial']}) | |
| is implemented via a sequence of signal processing rotations. | |
| This means: ONE framework, ONE circuit template, MANY algorithms. | |
| """ | |
| CSS = """ | |
| @import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Orbitron:wght@400;700&display=swap'); | |
| .gradio-container { | |
| background: linear-gradient(135deg, #0a0a1a 0%, #1a0a2e 50%, #0a1a1a 100%) !important; | |
| } | |
| h1, h2, h3 { | |
| font-family: 'Orbitron', sans-serif !important; | |
| color: #00ffcc !important; | |
| text-shadow: 0 0 30px rgba(0, 255, 204, 0.4); | |
| } | |
| .tab-nav button.selected { | |
| background: linear-gradient(135deg, #00ffcc, #00cc99) !important; | |
| color: #0a0a1a !important; | |
| } | |
| button.primary { | |
| background: linear-gradient(135deg, #00ffcc, #00cc99) !important; | |
| color: #0a0a1a !important; | |
| } | |
| .prose code { | |
| background: #1a1a2e !important; | |
| color: #00ffcc !important; | |
| } | |
| """ | |
| # FIX: CSS added to Blocks initialization | |
| with gr.Blocks(title="Quantum Paradox Lab", css=CSS) as demo: | |
| gr.Markdown(""" | |
| # Quantum Paradox Lab | |
| **Interactive proof that quantum's future is architecture over qubit counts.** | |
| Explore the counter-intuitive truths reshaping quantum computing: barren plateaus as features, | |
| QSVT unifying all algorithms, and photonics enabling room-temperature quantum. | |
| """) | |
| with gr.Tabs(): | |
| # Tab 1: Barren Plateaus | |
| with gr.TabItem("Barren Plateaus"): | |
| gr.Markdown(""" | |
| ## The Trainability Paradox | |
| **Conventional wisdom:** Deeper circuits = more expressive power = better results. | |
| **Reality:** Deep random circuits have vanishing gradients. Training becomes impossible. | |
| **The twist:** This is actually a FEATURE. If gradients vanished easily, classical computers | |
| could simulate the circuit. Barren plateaus signal genuine quantum behavior. | |
| """) | |
| with gr.Row(): | |
| qubits_slider = gr.Slider(4, 20, 12, step=1, label="Max Qubits") | |
| layers_slider = gr.Slider(2, 20, 10, step=1, label="Max Layers") | |
| bp_chart = gr.Plot(value=create_barren_plateau_chart(12, 10)) | |
| qubits_slider.change(create_barren_plateau_chart, [qubits_slider, layers_slider], bp_chart) | |
| layers_slider.change(create_barren_plateau_chart, [qubits_slider, layers_slider], bp_chart) | |
| gr.Markdown(""" | |
| **Key insight:** The green zone (high variance) is trainable but classically simulable. | |
| The red zone (low variance) has quantum advantage but cannot be trained naively. | |
| **Solutions being explored:** | |
| 1. Layer-wise training | |
| 2. Problem-specific ansatze | |
| 3. Tensor network initialization | |
| 4. Parameter correlation structures | |
| """) | |
| # Tab 2: QSVT Unification | |
| with gr.TabItem("QSVT Unification"): | |
| gr.Markdown(""" | |
| ## One Framework to Rule Them All | |
| Quantum Singular Value Transformation (QSVT) unifies the major quantum algorithms | |
| under a single mathematical framework: polynomial transformations of singular values. | |
| """) | |
| qsvt_chart = gr.Plot(value=create_qsvt_unification_chart()) | |
| with gr.Row(): | |
| algo_dropdown = gr.Dropdown( | |
| choices=list(QSVT_ALGORITHMS.keys()), | |
| label="Select Algorithm", | |
| value="Grover's Search" | |
| ) | |
| algo_details = gr.Textbox(label="Algorithm Details", lines=15, interactive=False) | |
| algo_dropdown.change(get_algorithm_details, [algo_dropdown], algo_details) | |
| gr.Markdown(""" | |
| **Why this matters:** | |
| Before QSVT, each algorithm was discovered separately, with unique proofs and implementations. | |
| Now we understand they are all special cases of one technique. | |
| This is like discovering that addition, multiplication, and exponentiation | |
| are all just repeated applications of the successor function. | |
| """) | |
| # Tab 3: Hardware Comparison | |
| with gr.TabItem("Hardware Reality"): | |
| gr.Markdown(""" | |
| ## The Temperature Divide | |
| Most quantum computers need extreme cold. Photonics breaks this rule. | |
| """) | |
| hardware_chart = gr.Plot(value=create_hardware_comparison()) | |
| gr.Markdown(""" | |
| ### Platform Breakdown | |
| | Platform | Temperature | Advantage | Challenge | | |
| |----------|-------------|-----------|-----------| | |
| | Superconducting | 15 mK | Fast gates, mature | Cryogenics cost | | |
| | Trapped Ions | 1 mK | Long coherence | Slow gates | | |
| | Photonic | 293 K | Room temp, networking | Probabilistic | | |
| | Neutral Atoms | 10 μK | Large arrays | Laser complexity | | |
| **Photonic breakthrough:** Xanadu and PsiQuantum are betting that room-temperature | |
| operation and natural fiber networking will overcome probabilistic gate challenges. | |
| """) | |
| # Tab 4: Energy Calculator | |
| with gr.TabItem("Green Quantum"): | |
| gr.Markdown(""" | |
| ## The Energy Advantage | |
| Quantum computers promise exponential speedups. But what about energy? | |
| """) | |
| problem_slider = gr.Slider(10, 1000, 100, step=10, label="Problem Size (N)") | |
| energy_chart = gr.Plot(value=create_energy_comparison(100)) | |
| problem_slider.change(create_energy_comparison, [problem_slider], energy_chart) | |
| gr.Markdown(""" | |
| **The calculation:** | |
| Classical: O(N³) operations for linear algebra | |
| Quantum: O(N · polylog(N)) operations with HHL/QSVT | |
| Even accounting for the 25kW dilution refrigerator overhead, quantum wins | |
| for sufficiently large problems. Photonic systems drop this to ~500W. | |
| **Landauer's principle:** Each bit erasure costs kT·ln(2) energy. | |
| Reversible quantum computation minimizes erasure. | |
| """) | |
| # Tab 5: Circuit Generator | |
| with gr.TabItem("AI Circuits"): | |
| gr.Markdown(""" | |
| ## AI-Designed Quantum Circuits | |
| Modern ML models can design quantum circuits automatically. | |
| See example OpenQASM output for common algorithms. | |
| """) | |
| with gr.Row(): | |
| problem_dropdown = gr.Dropdown( | |
| choices=["QAOA (Max-Cut)", "VQE (H2 Molecule)", "Grover's Search"], | |
| label="Problem Type", | |
| value="QAOA (Max-Cut)" | |
| ) | |
| circuit_qubits = gr.Slider(2, 8, 4, step=1, label="Qubits") | |
| circuit_output = gr.Code(label="OpenQASM 3.0 Circuit", language="python") | |
| generate_btn = gr.Button("Generate Circuit", variant="primary") | |
| generate_btn.click( | |
| generate_circuit_description, | |
| [problem_dropdown, circuit_qubits], | |
| circuit_output | |
| ) | |
| gr.Markdown(""" | |
| **AI Circuit Design on HF:** | |
| Models like `linuzj/quantum-circuit-qubo-3B` and `Floki00/qc_srv_3to8qubit` | |
| use diffusion models and fine-tuned LLMs to generate valid quantum circuits. | |
| This represents a shift: instead of humans designing circuits by hand, | |
| AI explores the vast space of possible architectures. | |
| """) | |
| # Tab 6: Resources | |
| with gr.TabItem("Resources"): | |
| gr.Markdown(""" | |
| ## Dive Deeper | |
| ### Key Papers | |
| **QSVT Unification** | |
| - [A Grand Unification of Quantum Algorithms](https://arxiv.org/abs/2105.02859) (2021) | |
| **Barren Plateaus** | |
| - [Does Absence of Barren Plateaus Imply Classical Simulability?](https://arxiv.org/abs/2312.09121) (2023) | |
| - [Variational Quantum Algorithms Review](https://arxiv.org/abs/2012.09265) (2020) | |
| **Photonic Quantum** | |
| - [Blueprint for Scalable Photonic Fault-Tolerant QC](https://arxiv.org/abs/2010.02905) (2020) | |
| - [Fusion-Based Quantum Computation](https://arxiv.org/abs/2101.09310) (2021) | |
| **AI Circuit Design** | |
| - [Quantum Circuit Synthesis with Diffusion](https://arxiv.org/abs/2311.02041) | |
| ### Models on Hugging Face | |
| - [linuzj/quantum-circuit-qubo-3B](https://hf.co/linuzj/quantum-circuit-qubo-3B) | |
| - [Floki00/qc_srv_3to8qubit](https://hf.co/Floki00/qc_srv_3to8qubit) | |
| ### Spaces | |
| - [Floki00/genQC](https://hf.co/spaces/Floki00/genQC) - Quantum circuit generation | |
| --- | |
| **Created by:** Eric Raymond & Samiksha BC | Purdue AI/Robotics Engineering | IU SouthBend | |
| """) | |
| gr.Markdown(""" | |
| --- | |
| *"The quiet revolution in quantum isn't about who has the most qubits. | |
| It's about who understands the architecture."* | |
| """) | |
| if __name__ == "__main__": | |
| demo.launch() |