# All-Optical Machine Learning Using Diffractive Deep Neural Networks

Diffractive optical networks can learn tasks by light passing through printed layers

Xing Lin, Yair Rivenson, Nezih T. Yardimci, Muhammed Veli, Mona Jarrahi, Aydogan Ozcan · arXiv · 2018-4-14

- **Problem** Deep learning normally runs on electronic computers, and it was an open question whether trained passive layers could do the same job with light.
- **Method** D2NNs are stacks of passive surfaces whose phase values are trained numerically, then 3D-printed. Light passing through them performs the task at the speed of light.
- **Results** The numerically tested digit classifier reached 91.75% accuracy on 10,000 MNIST test digits, while the printed networks were tested on far fewer digits.

## Why optical layers need a trainable design

Deep learning is usually carried out as a computation on electronic hardware, with multi-layer networks described digitally and trained on data to reach expert-level performance on tasks such as image classification. The D2NN asks a different question: whether the computation itself can be done by light passing through a set of fixed physical surfaces, so that the trained function is carried by the hardware rather than evaluated step by step in software.

Optical implementations of learning are attractive for their parallel processing and power efficiency, but earlier opto-electronic deep networks operate on physical principles that differ from those of a diffractive stack. A D2NN replaces the electronic neurons with points on passive surfaces, so the connections between neurons come from free-space propagation rather than from programmed weights.

The design is made in two stages: the layers are adjusted numerically in a computer, then they are fabricated, and the fabricated stack performs the task at the speed of light using only diffraction and passive components.

## How a diffractive point acts as a neuron

Each point on a layer is treated as a secondary source, so its output wave amplitude and phase follow from the wave it receives and its own complex-valued transmission or reflection coefficient. The networks studied here are transmissive, coherent and phase-only, and each layer is treated as a thin optical element that changes the phase of the wavefront passing through it.

Propagation between layers is described with the Rayleigh-Sommerfeld diffraction equation, which makes each neuron radiate a wave that spreads to the neurons of the next layer. The wave arriving at a neuron is the coherent sum of the secondary waves from the previous layer, and that sum is multiplied by the neuron's transmission coefficient to give the neuron's output wave.

A transmission coefficient has an amplitude term and a phase term, and for phase-only networks the amplitude is held at 1 in the ideal case, so training changes only the phase of each neuron. Optical losses are left out of this ideal model and are treated separately in the discussion of the printed hardware.

Compared with a standard network, the neuron inputs here are complex-valued and set by interference, the neuron function is a modulation rather than a sigmoid or ReLU, and each neuron's reach is set by the layer spacing, the output signal-to-noise ratio and the coherence of the source.

## Training the phase values and fixing the hardware

During training, data are fed to the input plane, the output is computed through optical diffraction, and the error against the target output is propagated backward to update the phase values of the neurons in every layer. This update follows the stochastic gradient descent approach used in conventional deep learning.

Once training ends, the phase map of every layer is fixed, and the physical stack is inferred from the same fixed configuration with no further adjustment. Fabrication can use 3D-printing or lithography, and the resulting passive stack performs the trained task with optical diffraction alone.

For the digit classifier, the input digit is encoded in the amplitude of the input field, and the ten detector regions are assigned one per digit. The detector with the maximum optical signal gives the predicted class, and that same criterion is used as the loss function during training. Five layers were trained on about 55,000 MNIST images, and the trained design was fixed before numerical testing.

## Handwritten digit classification results

In numerical testing on 10,000 MNIST test digits that were not used for training or validation, the classifier reached 91.75% classification accuracy. The output energy plot in the same numerical test shows that, on average, about 38-53% of the total output plane energy lands on the correct detector region.

The printed experiment used 50 handwritten digits, five for each digit, selected among those whose numerical testing had been successful, and each was illuminated at 0.4 THz with continuous-wave radiation. Under the same percentage measure, the printed network put about 34-40% of the output energy on the correct detector, with the digit 1 as the exception at about 60%.

The authors attribute the weaker result for the digit 0 to the difficulty of printing its large central void, and they observe similar printing problems for other digits with void regions, such as 6, 8 and 9.

Across the numerical and experimental testing, the match between the two was found to be 88%. This 88% describes agreement between numerical and experimental results and is not a classification accuracy on the printed digits.

## Imaging lens and physical auto-encoder

The lens-type network has five transmissive layers and was trained to form a unit-magnification image of the input field amplitude at its output plane, which is about 9 × 9 cm. Its training used about 1,500 images randomly selected from ImageNet, and it has 0.45 million neurons in five layers. Layers are spaced 4 mm apart, with 4 mm from the input plane to the first layer and 7 mm from the last layer to the output plane, so the stack is much more compact than the digit classifier, which has 30 mm spacing.

The network therefore learned the function of an imaging lens, which the authors also describe as a physical auto-encoder.

Pinhole tests with diameters of 1 mm, 2 mm and 3 mm gave output images with a FWHM of 1.5 mm, 1.4 mm and 2.5 mm, respectively. The printed network resolved a line-width of 1.8 mm at 0.4 THz, which corresponds to a wavelength of 0.75 mm in air, while the numerical design resolved about 1.2 mm. The authors attribute the gap between printed and numerical resolution to 3D-printing errors and possible misalignment between the printed layers.

With a large layer area and short distances to the input and output planes, the theoretical numerical aperture approaches 1 in air. Training used ImageNet images with relatively large features, so the network learned to use only part of this bandwidth, and finer training images or a different loss function are suggested for higher resolution.

## Fabrication and alignment error budget

The printed layers sit in a 3D-printed holder with slots for each layer and the input object, and the misalignment of the printed stack is estimated to be smaller than 0.1 mm relative to the ideal neuron positions.

Each printed layer had on average about 51% power attenuation at 0.4 THz for an average thickness of about 1 mm. Because the printed material absorbs part of the wave, the layers introduce residual amplitude modulation, which departs from the phase-only design and adds to the error. The authors note that this absorption also partly explains the lower printed performance in the digit classification experiment.

## Limits of the printed demonstrations

The printed experiments were run only at 0.4 THz with continuous-wave illumination, and the digit classifier printed test set contained 50 digits. The printed digit results therefore rest on a small hand-selected set, and the 10,000-digit results are numerical.

Layer absorption is a loss that the phase-only design does not model, and reflections between layers were neglected in the analysis, which the authors support by the match between experiment and simulation. Reflection losses could be reduced with anti-reflection coatings, but this was not tested in the printed networks.

The lens resolution is limited by the large-scale features in the ImageNet training images, so a finer-resolution lens was not demonstrated. The visible-range designs and large-area versions are discussed as possibilities, and no experiment with them is reported.

## Routes to larger and reconfigurable networks

Integration with lensfree on-chip imaging is proposed as a compact, field-portable system with a neural network detection field-of-view above 18 cm2.

Spatial light modulators could replace fixed layers, giving a reconfigurable electro-optic network that can learn new tasks and compensate for alignment errors. The authors suggest that a network could be retrained by transfer learning when an error is detected during use.

For a monolithic version, the authors point to laser lithography based on two-photon polymerization as a route to fabricate all layers as one structure with fewer alignment errors. Whether a virtual, computer-based network that uses a wave-based communication mechanism between layers can outperform standard deep networks is left open by the authors.

## Paper info

- **Authors**: Xing Lin, Yair Rivenson, Nezih T. Yardimci, Muhammed Veli, Mona Jarrahi, Aydogan Ozcan
- **Venue**: arXiv · Preprint
- **First published**: 2018-4-14
- **Added**: 2026-11-12
- **Updated**: 2018-7-26
- **Version**: v2
- **arXiv**: 1804.08711
- **DOI**: 10.1126/science.aat8084
- **Category**: cs.NE · cs.LG · physics.comp-ph · physics.optics
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1804.08711v2) · [PDF ↗](https://arxiv.org/pdf/1804.08711v2)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Xing Lin, Yair Rivenson, Nezih T. Yardimci, Muhammed Veli, Mona Jarrahi, Aydogan Ozcan (2018). All-Optical Machine Learning Using Diffractive Deep Neural Networks. arXiv:1804.08711v2. https://doi.org/10.1126/science.aat8084

**BibTeX**

```
@article{lin2018optical,
  title = {{All-Optical Machine Learning Using Diffractive Deep Neural Networks}},
  author = {Xing Lin and Yair Rivenson and Nezih T. Yardimci and Muhammed Veli and Mona Jarrahi and Aydogan Ozcan},
  year = {2018},
  eprint = {1804.08711},
  archivePrefix = {arXiv},
  doi = {10.1126/science.aat8084},
  url = {https://arxiv.org/abs/1804.08711v2}
}
```

## Related papers

- [Generalizing from a Few Examples: A Survey on Few-Shot Learning](https://refivu.com/en/papers/8988e143-7a9e-4146-9f9b-40c8e0cb6bb2-generalizing-from-a-few-examples-a-survey-on.md)
- [A Deep Learning Approach for Brain Tumor Classification and Segmentation Using a Multiscale Convolutional Neural Network](https://refivu.com/en/papers/c75a012b-6db8-4ef0-a0e2-0109acd56af3-a-deep-learning-approach-for-brain-tumor-classification.md)
- [AID: A Benchmark Dataset for Performance Evaluation of Aerial Scene Classification](https://refivu.com/en/papers/7ff42b05-661d-4b69-9f82-81042fe1d6b3-aid-a-benchmark-dataset-for-performance-evaluation-of.md)
- [Metrics for Multi-Class Classification: an Overview](https://refivu.com/en/papers/78ca6b47-f74d-4a51-a805-f5f83bb18a77-metrics-for-multi-class-classification-an-overview.md)
- [BinaryConnect: Training Deep Neural Networks with binary weights during propagations](https://refivu.com/en/papers/50c59bf6-7b51-443a-b99a-d2bbc087f3e9-binaryconnect-training-deep-neural-networks-with-binary.md)

## Other paper commentary

- [Paying More Attention to Attention: Improving the Performance of Convolutional Neural Networks via Attention Transfer](https://refivu.com/en/papers/9fd3c7c3-a01f-4f1c-84a7-72570c46bdd4-paying-more-attention-to-attention-improving-the-performance.md)
- [CvT: Introducing Convolutions to Vision Transformers](https://refivu.com/en/papers/4d0c84cf-05bb-4f74-822e-0b8fbc635203-cvt-introducing-convolutions-to-vision-transformers.md)
- [Methods for Interpreting and Understanding Deep Neural Networks](https://refivu.com/en/papers/beae0f88-5d82-43a5-a727-e94025cff266-methods-for-interpreting-and-understanding-deep-neural.md)
- [Learning Multi-Domain Convolutional Neural Networks for Visual Tracking](https://refivu.com/en/papers/5b8779fe-6230-4bef-9d38-11634c64c64a-learning-multi-domain-convolutional-neural-networks-for.md)
- [Learning Efficient Convolutional Networks through Network Slimming](https://refivu.com/en/papers/d840aead-455e-4eaf-8f2c-7e4bff390606-learning-efficient-convolutional-networks-through-network.md)
- [Shortcut Learning in Deep Neural Networks](https://refivu.com/en/papers/429eb10d-b6ea-4d00-b18e-0509b85a5062-shortcut-learning-in-deep-neural-networks.md)
- [Beyond Part Models: Person Retrieval with Refined Part Pooling (and a Strong Convolutional Baseline)](https://refivu.com/en/papers/0d7a16fd-c14e-49e6-938f-2cdeb51ea5a4-beyond-part-models-person-retrieval-with-refined-part.md)
- [Digging Into Self-Supervised Monocular Depth Estimation](https://refivu.com/en/papers/501b9eb4-7fd4-43f0-8b68-eaaf0aab3b71-digging-into-self-supervised-monocular-depth-estimation.md)
- [CyCADA: Cycle-Consistent Adversarial Domain Adaptation](https://refivu.com/en/papers/86c1af43-2e3a-459f-87e6-d7c0653694a6-cycada-cycle-consistent-adversarial-domain-adaptation.md)
- [Language Models (Mostly) Know What They Know](https://refivu.com/en/papers/ffe245df-5662-4bfb-8c0b-899a38b87412-language-models-mostly-know-what-they-know.md)
- [From Local to Global: A Graph RAG Approach to Query-Focused Summarization](https://refivu.com/en/papers/b90240e0-a6fe-4297-adb6-4ebd769e9c60-from-local-to-global-a-graph-rag-approach.md)
- [The Open Images Dataset V4: Unified image classification, object detection, and visual relationship detection at scale](https://refivu.com/en/papers/a257d9ea-aed6-4a9a-9d02-5e4c50a42a90-the-open-images-dataset-v4-unified-image-classification.md)

## Terms in this paper

- [MNIST](https://refivu.com/en/terms/28b9bb66d1c6-mnist)
- [Stochastic Gradient Descent](https://refivu.com/en/terms/a49650824022-stochastic-gradient-descent)
- [classification accuracy](https://refivu.com/en/terms/3c67905d3166-classification-accuracy)
- [Receptive Field](https://refivu.com/en/terms/4d2bf4d526a5-receptive-field)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/818615cb-8c22-447c-a0a6-77954575b98a-all-optical-machine-learning-using-diffractive-deep-neural)
