The Nonlinearity Problem
Three lessons of increasingly clever linear optics — meshes, crossbars, weight banks — and not one
word about the other half of the recipe. A neural network is
f(W\mathbf{x}), and the
activation
function f is not a garnish. Without it, depth is an
illusion: a stack of purely linear layers, however tall, collapses into a single matrix. Run the
proof yourself — it is three lines of algebra wearing a TypeScript costume:
type Vec = number[];
type Mat = number[][];
const matvec = (M: Mat, x: Vec): Vec =>
M.map((row) => row.reduce((s, m, j) => s + m * x[j], 0));
const matmul = (A: Mat, B: Mat): Mat =>
A.map((row, i) => B[0].map((_, k) => row.reduce((s, a, j) => s + a * B[j][k], 0)));
const W1: Mat = [[2, -1], [0.5, 1]];
const W2: Mat = [[1, 1], [-1, 2]];
const x: Vec = [3, -2];
// Two "layers" with no activation…
const twoLayers = matvec(W2, matvec(W1, x));
// …equal one layer with the merged matrix W2·W1:
const oneLayer = matvec(matmul(W2, W1), x);
console.log("two linear layers: " + JSON.stringify(twoLayers));
console.log("one merged layer: " + JSON.stringify(oneLayer));
// Insert a ReLU between them and the collapse fails — depth becomes real:
const relu = (v: Vec): Vec => v.map((a) => (a > 0 ? a : 0));
console.log("with ReLU between: " + JSON.stringify(matvec(W2, relu(matvec(W1, x)))));
So every optical neural network must answer one question: where does
f happen? The embarrassment of photonics — the reason this lesson
exists — is that the physically honest answer is usually "in electronics". This is the
nonlinearity problem, and it is the oldest problem in optical computing.
Why photons won't gate photons
A nonlinearity requires one signal to change how the medium treats another signal — a
transistor's gate charge changes the channel's conductance. But Maxwell's equations in ordinary
materials are linear: two light beams pass through each other unchanged, superposing without
interacting. That linearity is exactly what made the mesh possible — signals cross a chip without
corrupting one another — and it is exactly what forbids an optical transistor.
Materials do have weak nonlinear responses (the study of them is
Module
7's opening lesson), the workhorse being the Kerr effect: refractive
index shifts with intensity, n = n_0 + n_2 I. The problem is the size
of n_2. Work the number for silicon
(n_2 \approx 4.5\times10^{-18}\,\mathrm{m^2/W}, mode area
A \approx 0.1\ \mu\mathrm{m}^2): the nonlinear phase over length
L is \varphi = (2\pi/\lambda)\,n_2 (P/A) L,
and demanding a full \varphi = \pi switch over a 1 cm waveguide gives
P \;=\; \frac{\lambda A}{2 n_2 L}
\;\approx\; \frac{1.55\times10^{-6} \times 10^{-13}}{2 \times 4.5\times10^{-18} \times 10^{-2}}
\;\approx\; 1.7\ \mathrm{W}.
Watts. Continuous. Per gate. The signals in our accelerators are microwatts to milliwatts —
three to five orders of magnitude below what a passive Kerr nonlinearity needs at
this scale. Resonators and exotic materials close some of the gap (at the price of bandwidth and
loss), but the mismatch is why no practical ONN computes its activations with pure light today,
and why the field's actual engineering choices are the three compromises below.
The menu of compromises
| Approach | How it works | What it costs |
| O/E/O, digital |
Photodetect → ADC → any f in digital logic → DAC → re-modulate |
~1–10 pJ per activation (the converters dominate); nanoseconds of latency; but f is exact, arbitrary, and matches training perfectly |
| O/E/O, analog electro-optic |
Photocurrent drives a modulator directly — no digitisation; the modulator's own transfer curve is f |
~10–100 fJ per activation; f is fixed by device physics (sigmoid-ish/sinusoidal), tunable only via bias; adds detector noise each layer |
| All-optical (saturable absorber, Kerr resonator) |
A material whose transmission depends on intensity applies f in flight |
No control circuitry, femtosecond-fast — but f's shape is take-it-or-leave-it, insertion loss is charged to the loss budget, and the input must sit near the saturation power, constraining the whole system's operating point |
The digital O/E/O route is what the 2017 Shen chip did (on a computer, between passes) and what
most integrated demos still do; it is flexible and honest but re-imports the very conversion costs
the optics was supposed to avoid — lesson 7 will show the ADC/DAC pair dominating the energy
ledger. The analog electro-optic route (demonstrated by Williamson, Hughes and colleagues in 2019)
is the pragmatic middle path: keep the signal analog, spend one detector and one modulator, accept
whatever curve the hardware gives you. The all-optical route is the romantic one — and the chart
below shows the most common incarnation, the saturable absorber, a material that
is opaque to weak light but bleaches transparent under strong light.
A soft ReLU, for free, at the speed of light — but look at where the knee is. It sits at
P_{\text{sat}}, a material constant. Your network's activations must be
delivered at that physical power level, at every neuron, in every layer, after whatever
losses the weights imposed. The activation function has become a constraint on the entire
system's power map. Nothing in analog computing is ever free.
Evaluating f is only half the job; the output must then drive the
next layer. This is cascadability, the criterion that killed all-optical
logic (the full post-mortem is
Module
7's), and it bites ONNs just as hard. Every passive stage attenuates: weights
transmit at most 1, absorbers eat several dB, splitters divide. Chain
L layers each losing 6 dB and the signal is down by
6L dB — after five layers, a factor of ~4,000, heading below the noise
floor lesson 5 will build. Somewhere, gain must be inserted, and each option re-imports a
cost: optical amplifiers add noise (and their own watts), while O/E/O stages restore levels
electronically — which is quietly one of the strongest arguments for O/E/O activations:
they are simultaneously the nonlinearity and the regenerator. When you assess any
all-optical activation paper, ask the cascade question first: can the output of one such stage,
at its actual power level, drive the input of an identical next stage? If the answer is no, it is
a component demo, not an architecture.
In the 1980s, "optical computing" meant optical digital logic, and its central artefact
was the bistable étalon — a Kerr-type resonator that could sit in two transmission states and so
act as an optical flip-flop or gate. Bell Labs built celebrated prototypes (the SEED and its
descendants); conferences overflowed; the transistor's successor seemed to shimmer just out of
reach. It never arrived, and the reasons were precisely the ones on this page — watts per gate
where electronics paid femtojoules, no cheap cascading, no gain — a story told properly in
why
optical logic lost to CMOS. Today's photonic AI wave is, structurally, a wiser retry:
it stopped asking light to do the nonlinear work (where physics charges watts) and asks
it only to do the linear work (where interference computes for free), letting electronics
keep the job it is unbeatable at. Whether that division of labour survives the energy audit is
exactly what lessons 5 and 7 are for. The historical reflex to keep: when a photonic press release
promises to eliminate electronics entirely, check whether it has solved cascadability — or merely
deferred it.
Where this goes next
Every compromise on the menu routes the signal through a detector, and many through converters —
so the activation stage is also where noise enters, layer after layer. Shot noise,
thermal noise, and the finite charge of the electron set a hard ceiling on how many meaningful
bits an analog optical signal can carry. The
next
lesson turns that ceiling into numbers — an effective-number-of-bits budget for the
whole analog chain — and then, in code, watches a small network's accuracy dissolve as we pour
noise into its MACs.