Quantum Subliminal Learning

June 5, 2026 ยท View on GitHub

Framework: TensorCircuit-NG JAX arXiv Python 3.10+

This repository contains the official reproduction code for the preprint Quantum Subliminal Learning.

In this work, we study how hidden behavioral traits can be transmitted through public distillation channels even when the student never observes the hidden task labels. We compare classical multilayer perceptrons, convolutional controls, and deep quantum neural networks (QNNs), showing that the public-channel geometry of the model strongly controls whether hidden-task information remains visible and transmissible.

Output Policy

The data files under output/ are the paper source-data JSONs. They should be treated as the canonical data bundle for the paper.

Running the generation pipeline, including --quick, writes to output/ by default and can overwrite these files. For installation smoke tests, pass --output-dir with a temporary directory.

Project Structure

The codebase is organized into compact, reusable modules plus figure-level reproduction scripts:

  • fig2_auxiliary_trends.py: Auxiliary-logit subliminal learning trends for MLPs and QNNs.
  • fig3_task_visibility.py: Cross-architecture comparison of task-channel susceptibility and observed transmission.
  • fig4_task_channel_trends.py: Task-channel cross-task transmission trends for MLPs and QNNs.
  • fig3_large_n_mlp.py: Large-N MLP susceptibility reruns for selected widths.
  • cnn_controls.py: CNN control experiments used in the task-channel visibility comparison.
  • generate_all.py: Top-level driver for regenerating all public JSON source-data files.
  • data.py: MNIST/Fashion-MNIST loading, normalization, amplitude encoding, and label poisoning.
  • mlp.py, qnn.py: Classical MLP and TensorCircuit-NG/JAX QNN model definitions.
  • trainers.py, metrics.py, common.py: Shared training loops, flip-rate metrics, Jacobian-based public-channel susceptibility metrics, and JSON output utilities.

Installation & Requirements

This project relies on TensorCircuit-NG for QNN simulation.

Prerequisites

  • Python 3.10+
  • A working JAX installation

Setup

For a fresh environment:

conda create -n quantum-subliminal python=3.10
conda activate quantum-subliminal
pip install -e .

Usage & Experiments

Run commands from the repository root after installing the package with pip install -e ..

These commands regenerate JSON files in output/. Do not run them in-place if you need to preserve the paper source-data files unchanged.

1. Full Reproduction Pipeline

Regenerates the source-data JSON files for Figures 2, 3, and 4, including CNN controls and large-N MLP susceptibility checks.

quantum-subliminal-generate

Output:

  • output/fig2_auxiliary_trends.json
  • output/fig3_task_visibility.json
  • output/fig4_task_channel_trends.json
  • output/pred_ratio_mlp_size_large_n.json
  • output/raw/fig2_auxiliary_raw.json
  • output/raw/fig4_task_raw.json
  • output/raw/cnn_bd_controls.json

2. Fast Smoke Test

Runs the same pipeline with reduced data size and fewer model seeds. This is useful for checking installation and basic functionality, but it is not a paper-quality reproduction.

quantum-subliminal-generate --quick

By default this command still writes into output/. To keep the paper source-data files unchanged, direct smoke-test outputs elsewhere:

quantum-subliminal-generate --quick --output-dir /tmp/quantum-subliminal-smoke

3. Regenerate Individual Components

Each major component can be rerun separately:

quantum-subliminal-generate --part fig2
quantum-subliminal-generate --part fig4
quantum-subliminal-generate --part cnn
quantum-subliminal-generate --part large_n
quantum-subliminal-generate --part fig3

The fig3 stage assembles already-generated Figure 4, CNN-control, and large-N MLP outputs. If those files are missing, the driver regenerates the required dependencies.

Experiment Summary

Figure 2: Auxiliary-Logit Subliminal Learning

Teachers are trained on MNIST. Students are initialized from the same seed and trained only to match teacher auxiliary logits on public noise. The figure sweeps MLP width, QNN depth, and teacher learning rate.

Figure 3: Public-Channel Visibility

This figure compares task-channel susceptibility across CNN controls, narrow MLPs, and QNNs. The susceptibility metric is computed from Jacobian-based public-channel visibility in metrics.py and compared with observed hidden-task transmission.

Figure 4: Task-Channel Cross-Task Transmission

Base models are trained jointly on MNIST and Fashion-MNIST. The teacher is then poisoned on a hidden Fashion-MNIST label pair, while the student receives only MNIST logits during distillation. The student never observes Fashion-MNIST labels in the distillation phase.

Citation

If you find this code useful in your research, please cite:

@misc{zhang2026quantumsubliminallearning,
  title         = {Quantum Subliminal Learning},
  author        = {Shi-Xin Zhang and Yu-Qin Chen},
  year          = {2026},
  eprint        = {2605.29557},
  archivePrefix = {arXiv},
  primaryClass  = {quant-ph},
  doi           = {10.48550/arXiv.2605.29557}
}

License

This code is released under the Apache License 2.0. See LICENSE for details.