Inspiration

Modern digital communication relies heavily on public-key cryptosystems like RSA and Elliptic Curve Cryptography (ECC). However, Shor's algorithm running on a sufficiently large fault-tolerant quantum computer will break these mathematical assumptions. While Quantum Key Distribution (QKD)—specifically the Bennett-Brassard 1984 (BB84) protocol—offers information-theoretic security guaranteed by the laws of quantum mechanics, physical quantum channels remain vulnerable to active physical eavesdropping attacks.

In traditional QKD networks, when an eavesdropper intercepts the channel, the protocol simply aborts and discards the transmission. There is no automated attribution, real-time threat analysis, or autonomous mitigation. We asked ourselves: What if we could combine the fundamental laws of quantum physics with cloud-scale reasoning models to build an autonomous, self-healing quantum cybersecurity sentinel?

This inspired Quantum Catching the Spy: a research-grade quantum communication simulation powered by IBM Qiskit and safeguarded in real-time by an autonomous NVIDIA Nemotron AI Sentinel hosted on cloud infrastructure.


What it does

Quantum Catching the Spy simulates a complete BB84 prepare-and-measure quantum network involving four key entities:

  1. Advik (Sender): Encodes random classical bits into non-orthogonal conjugate quantum states using computational (|+\rangle) and diagonal (|\times\rangle) bases.
  2. Bhaskar (Receiver): Measures incoming single-qubit states using randomly chosen conjugate bases.
  3. Ekta (The Spy): Executes an active Measure-and-Resend interception attack on qubits in transit.
  4. NVIDIA Nemotron AI Sentinel: Evaluates real-time Quantum Bit Error Rate (QBER) telemetry, performs cryptographic threat attribution, and executes autonomous channel self-healing.

The Autonomous Closed-Loop Cycle:

  • Cycle 1 (Threat Detection): Ekta intercepts the transmitted photons. According to the No-Cloning Theorem and Heisenberg's Uncertainty Principle, unauthorized non-orthogonal measurement collapses the quantum wavefunction, inevitably injecting an error rate: $$QBER = \frac{\text{Incorrect Bits in Sifted Key}}{\text{Length of Sifted Key}} \times 100\% \approx 25.00\%$$
  • Real-Time AI Telemetry Analysis: As QBER crosses the physical security threshold ((> 15.0\%)), the live telemetry stream is forwarded to NVIDIA Nemotron. The reasoning model distinguishes between physical channel noise and deterministic Measure-and-Resend eavesdropping, generating a structured JSON verdict: ```json { "status": "CRITICAL_ATTACK", "attack_probability": 1.0, "reasoning": "The measured QBER of 25.00% matches the theoretical threshold for a full Measure-and-Resend eavesdropping attack, indicating near-certain interception.", "mitigation_action": "ABORT_SESSION" }

Cycle 2 (Autonomous Channel Healing): The sentinel purges compromised session keys, synchronizes dynamic basis rotation, and introduces decoy states. The eavesdropper is blinded and isolated. In the second transmission cycle, the channel is verified and healed back to: $$QBER_{\text{healed}} = 0.00%$$ A cryptographically secure session key is established without human intervention.

How we built it:

Quantum Circuit Simulation Engine: Built using IBM Qiskit 1.x and Qiskit AerSimulator. We model single-qubit quantum circuits applying Pauli-(X) and Hadamard ((H)) gates for state preparation, followed by projective measurement operators.

Autonomous Reasoning Sentinel: Integrated NVIDIA Nemotron (Llama-3.1-Nemotron-70B / Nemotron-3.5-Lightning) via an asynchronous, non-blocking OpenAI-compatible client connecting to Nebius AI Cloud / NVIDIA Cloud endpoints.

Resilient Fallback Engineering: Developed a deterministic fallback security layer in security_agent.py. If network timeouts, rate limits, or packet drops occur, the quantum pipeline never crashes—a deterministic rule-based defense activates automatically.

Interactive Web GUI: Designed an enterprise-grade dark/light dashboard in Gradio, featuring live monospace ASCII circuit topology art, interactive transmission scaling, and high-DPI Matplotlib QBER comparative analytics.

Academic Rigor: Backed by an academic research paper ("Catching the Spy: Eavesdropper Detection Analysis in Quantum Key Distribution Networks Using Qiskit") and reproducible Monte Carlo verification across 10 to 1,000 transmitted qubits.

Challenges we ran into:

Reasoning Model Token Management: Nemotron reasoning models generate internal thought tokens (reasoning_content) before emitting structured JSON. Initially, lower token caps truncated the final payload. We solved this by scaling token allocations and engineering a multi-tier regex extraction fallback that reliably extracts the verdict even under token strain.

Deterministic Quantum Measurement in Headless Environments: Qiskit's AerSimulator memory extraction behaves differently across versions. We standardized memory bit extraction and basis reconciliation across headless remote environments and local Python runtimes. Synchronizing ZeroGPU and Local Execution: Designing an architecture that functions seamlessly on local workstations while staying 100% compatible with Hugging Face ZeroGPU environments required custom decorator wrapping for spaces.GPU.

UI Symmetry & Monospace Quantum Circuit Rendering: Standard text boxes distorted the box-drawing unicode characters of quantum circuits. We engineered custom CSS styling to guarantee monospace font fidelity, smooth scrollability, and responsive layouts.

Accomplishments that we're proud of:

True AI + Quantum Convergence: Moving beyond generic chatbot wrappers to build an actual closed-loop cyber-physical defense system that actively inspects and heals a quantum communication channel. End-to-End Autonomous Mitigation: Watching Cycle 1 detect Ekta's eavesdropping at 25% error rate and autonomously heal to 0.00% QBER in Cycle 2 in under 10 seconds.

Rigorous Scientific Grounding: Every threshold and simulation metric is directly verified against published theoretical bounds (Shor-Preskill and Bennett-Brassard limits).

Vendor Lock-In Free Architecture: Deployable across Nebius AI Studio and NVIDIA Developer Cloud with zero code modifications.

What we learned:

The profound implications of the No-Cloning Theorem when applied to automated network telemetry. How to write robust prompt-engineering guardrails for LLMs acting as real-time infrastructure agents, ensuring deterministic JSON output structures.

Practical techniques for building resilient micro-architectures that gracefully handle cloud API latency without compromising critical telemetry loops.

What's next for Quantum Catching the Spy: Autonomous QKD Sentinel:

Entanglement-Based Protocols (E91): Extending the simulator from prepare-and-measure BB84 to Bell-state entanglement and Ekert91 protocols tested against CHSH inequality violations. Physical Channel Noise Modeling: Introducing atmospheric attenuation, dark counts, and optical fiber depolarization to evaluate how the AI sentinel differentiates between environmental noise and subtle, low-intercept eavesdropping attacks.

Post-Processing Pipeline: Integrating the Cascade error-correction algorithm and Toeplitz-hash privacy amplification to extract finalized one-time pad keys.

Hardware Deployment: Interfacing the Qiskit pulse-level simulation with physical Quantum Random Number Generators (QRNGs) and optical testbeds.

Built With

  • autonomous-agents
  • bb84
  • cybersecurity
  • google-colab
  • gradio
  • hadamard-gate
  • html5
  • hugging-face
  • latex
  • matplotlib
  • monte-carlo
  • nebius-ai-cloud
  • numpy
  • nvidia-cloud
  • nvidia-nemotron
  • openai-api
  • pandas
  • post-quantum-cryptography
  • python
  • qiskit
  • qiskit-aer
  • quantum-circuits
  • quantum-computing
  • quantum-cryptography
  • scipy
Share this project:

Updates

Submission history