Computational processes implemented with neural networks
AI 4200 · DEEP LEARNING
All slides, one per page
© 2026 Dr. Jesse Roberts
The rest of the semester
Thu Nov 19
Today: computational processes · course evaluations
Tue Nov 24
Project 2 presentations
P2 due
Thu Nov 26
No class (Thanksgiving)
Tue Dec 1
Quiz 4
Thu Dec 3
Book discussion
Tue Dec 8
Final, 3:30
P3 due
PROJECT 2 PRESENTATIONS · TUE NOV 24
Three groups, 18 minutes + 7 minutes of questions each. Round robin: every member must be ready to answer any question.
Project 3 · specialist vs. generalist. Design a network for your problem and pit it against an adapted foundation model.
Due Tue Dec 8, 3:30
Moved. Today's lecture came forward from Dec 3; everything after it moved down one class day.
SEMESTER TOUR · 1 OF 6
Why depth
Stacked linear layers collapse
· W₁ᵀ· W₂ᵀ=· Wᵀstill one linear map
  • W1ᵀ W2ᵀ = Wᵀ: still one linear map
  • Depth alone buys nothing
Nonlinearity lets it bend
bentstraight
  • An activation between layers
  • Each layer can fold and stretch the space
XOR needs depth
no line separatesthe colourstwo layers: yes
  • No single line separates it
  • Layer 1 moves the points, layer 2 draws the line
Untwisting the space
layer by layer, untangled
  • Each layer untangles the data a little more
  • Next question: how can we make it learn?
Depth plus nonlinearity lets a network untwist the data until a straight line works.
SEMESTER TOUR · 2 OF 6
Making deep nets learn
Initialization and variance
explodesgradient ≈ 1vanishes← gradient flows backfirst layerlast layer
  • Scale weights by fan-in and fan-out
  • Variance near 1, forward and backward
Residuals and normalization
x+outLayerNormLinearf × 4fGELULinear4f × fresidual path: nothing on it but +
  • Each block adds onto a path that skips it
  • Layer norm resets the scale
Modern activations
ReLU = ŷ·H(ŷ)SiLU = ŷ·σ(ŷ)
  • ReLU = ŷ · H(ŷ): a gate
  • SiLU → SwiGLU → mixture of experts
Loss, gradient, step
xnetworkwith dropoutŶsoftmaxP̂cross-entropyloss L vs. label Prepeat ↻∂L/∂Ŷ = P̂ − PAdam steplr schedule
  • Softmax + cross-entropy: ∂L/∂Ŷ = P̂ − P
  • Adam with a learning-rate schedule; dropout
A deep net trains when signal and gradient keep their scale through every layer.
SEMESTER TOUR · 3 OF 6
Generalization
It can memorize anything
shuffled labels0 error
  • Fits shuffled labels to zero training error
  • Its model class covers almost everything
Yet on real labels, it works
p = nparameters →
  • Double descent past p = n
  • More parameters, lower test error
Training picks a simple fit
large norm: 1,041small norm: 2.7both fit perfectly;training picks this one
  • Many perfect fits; training finds a small-norm one
  • Implicit regularization
Same task, not same distribution
all possible modelschosen model classfits the training dataalso fits test
  • Fitting the test set is not the whole task
  • The real task includes what the test set never showed
Generalizing means solving the same task, not just matching the distribution.
SEMESTER TOUR · 4 OF 6
Symmetry
The shift test
trainedshifted 3 px7 ✓wrong ✗
  • Shift the digits a few pixels: accuracy collapses
  • MLP weights have addresses
Augmentation
shifted and scaled copies
  • Teach the symmetry with shifted copies
  • Changes the data, at a cost
Convolution: inductive bias
same filter,every position3×3one set of weights
  • Local, with tied weights
  • One filter finds a stroke anywhere
Built-in symmetry (Project 2)
netsame answerany order
  • Sets, graphs, rotations, energy
  • Symmetry by construction, not by data
Teach a symmetry with data, or build it in and need less data.
SEMESTER TOUR · 5 OF 6
The transformer
Max pooling is a gate
0.20.90.10.4hard max: one winssoftmax: all weightedattention
  • Hard max → softmax gate
  • SoftPool → attention pooling
Attention: the context-informed gate
x10.05x20.10x30.15x40.60x50.10Σnew x3gate = softmax(q3 · kj)q from x₃, k from every xmax pool: from the values in a windowattention: from context
  • The gate comes from q · k: the context decides
  • Encoder: every position sees every position
Causal attention (decoder)
each token seesonly the pastthen: predict the next one
  • Each token sees only the past
  • Next-token training (Daniel and Noah)
Cross-attention (encoder-decoder)
the0.05black0.70cat0.15sleeps0.10<s>elgatoΣnegroquery from gatopredicted next wordgates: softmax(q · k)k, v from the encoder
  • Queries from the decoder
  • Keys and values from the encoder
Attention is a gate whose weights come from the context.
SEMESTER TOUR · 6 OF 6
Foundation models and adapting them
Foundation models
pretrainonce, extreme datachatcodevision
  • Pretrain once on extreme data
  • An excellent prior over a whole domain
In-context learning
THE PROMPTcat → gatoblack → negrosleeps → ___duermeno weights change
  • Trained on enough tasks, it learns to learn
  • Examples in the prompt, no weight changes
A new head or full fine-tuning
pretrained bodyfrozennew headtrainedor: LoRAW₀+BAbeside W₀
  • Freeze the body, train a new head
  • Or train every weight
LoRA
W₀frozen+BArank r ≪ nfew weights trained
  • Freeze W₀, train a low-rank B A beside it
  • A good prior needs only a few directions
Pretrain once, adapt everywhere.
The semester on one map
LAYER 1
Why want it
Can a network do what simpler models can't?
Why depth
LAYER 2
Make it learn
It can. How can we make it learn?
Making deep nets learn
LAYER 3
Bias what it learns
It trains. Did it learn the right thing?
Generalization · what an MLP really learned
Symmetry · shift test, augmentation, convolution
The transformer · one gate, wired three ways
Foundation models · pretrain once, adapt
LAYER 4 · TODAY
Build with it
You know the parts. What processes can you build from them?
Computational processes
Three layers built the parts. The last one asks what you can build out of them.
From parts to processes
?
Suppose every network you need already exists. What is left to design?
THE PROCESS
  • An idea about how a problem gets solved
  • Who does what, in what order, what counts as better
THE NETWORK
  • A familiar part that does the hard step
  • Swap the architecture; the process stays
TODAY · SIX PROCESSES  +  ONE WE ALREADY KNOW
Competition
GANs
Self-play
DQN
Iterative refinement
diffusion
Rendering
NeRF
Computing with memory
differentiable computer
Cognition
Spaun
Database lookup
attention, via MIPS
For each one, ask: what is the process, and which part does the network learn?
PROCESS 1 OF 6 · COMPETITION
The intuition: competition helps
REAL BILL
A real one-dollar bill: green serial numbers, Treasury seal, Federal Reserve seal, portrait of Washington, fine engraved border
what the inspector compares against
COUNTERFEITER
INSPECTOR'S RULE
1
Fake one-dollar bill, round 1: a grey, blurry copy with no green ink, no portrait, no seals and no serial numbers
A crude copy: grey, blurry, half missing
Real bills are sharp, with green ink
fake caught
2
Fake one-dollar bill, round 2: sharp and in colour, but the portrait, both seals and the serial numbers are missing
Sharp, in colour: the first rule fails
Real bills have a portrait and two seals
fake caught
3
Fake one-dollar bill, round 3: portrait and seals are back, but no serial numbers and the fine lines are smudged
Portrait and seals in place: the second rule fails
Real bills have serial numbers and fine line detail
fake caught
Each better fake forces a finer rule, and each finer rule forces a better fake.
PROCESS 1 OF 6 · COMPETITION
GANs: the structure
Discriminator
job: tell real from fake
Linear 784 → 512
SiLU
Dropout 0.3
Linear 512 → 256
SiLU
Dropout 0.3
Linear 256 → 1
sigmoid
STAGE 1 · A REAL DIGIT
Dataset
10,000 real digits
A few real MNIST digits from the dataset A real MNIST digit from the dataset
real
p̂(real)
D wants this near 1
STAGE 2 · A FAKE
z
a random vector,
64 elements
Generator
job: make D say “real”
Linear 64 → 256
BatchNorm
SiLU
Linear 256 → 512
BatchNorm
SiLU
Linear 512 → 784
tanh
A digit made by our trained generator
fake
p̂(fake)
D wants this near 0
PROCESS 1 OF 6 · COMPETITION
The forward pass
PASS 1 · A REAL DIGIT
Dataset
one of the 64 real digits in this batch
A real digit from the training batch
Discriminator
p̂(real) = 0.60
D wants this near 1
PASS 2 · A FAKE
z
[0.43, −1.45, 0.01, …]
Generator
The generator's fake digit at step 300: still a fuzzy blob
Discriminator
same weights
p̂(fake) = 0.24
D wants this near 0
DISCRIMINATOR LOSS · BINARY CROSS-ENTROPY
LD = −log p̂(real) − log(1 − p̂(fake))
   = 0.51 + 0.27 = 0.79
GENERATOR LOSS · −1 × BCE ON THE FAKE
LG = −BCE = log(1 − p̂(fake))
   = log(0.76) = −0.27
PROCESS 1 OF 6 · COMPETITION
The backward pass
STEP 1 · UPDATE THE DISCRIMINATOR
An image, real or fake
X
Discriminator
weights WD
p̂
BCE
LD
∂LD/∂p̂
∂p̂/∂WD
∂LD/∂WD = ∂LD/∂p̂ · ∂p̂/∂WD
WD ← WD − η ∂LD/∂WD
gradient descent: catch more fakes
STEP 2 · UPDATE THE GENERATOR
z
Generator
weights WG
The fake image the generator made
Xfake
Discriminator
WD held fixed
p̂
−BCE
LG
∂LG/∂p̂
∂p̂/∂Xfake
∂Xfake/∂WG
∂LG/∂WG =
∂LG/∂p̂ · ∂p̂/∂Xfake
· ∂Xfake/∂WG
WG ← WG − η ∂LG/∂WG
descent on LG = log(1 − p̂)
The generator learns through the discriminator's slope ∂p̂/∂Xfake.
PROCESS 1 OF 6 · COMPETITION
Results: noise becomes digits
Generator output for 16 fixed noise vectors at training step 0
step 0
Generator output for 16 fixed noise vectors at training step 300
step 300
Generator output for 16 fixed noise vectors at training step 2000
step 2,000
Generator output for 16 fixed noise vectors at training step 6000
step 6,000
Generator output for 16 fixed noise vectors at training step 12000
step 12,000
Sixteen real MNIST digits, for comparison
real digits
  • Step 0: noise. Step 300: fuzzy blobs, all much alike
  • By step 12,000: recognizable digits, from a generator that never saw a real image
  • Scaled up, the same game makes faces of people who don't exist (StyleGAN, 2019)
A collage of photo-realistic faces made by StyleGAN; none of these people exist
Everything the generator learned came back through the discriminator.
Our MLP GAN on 10,000 MNIST digits (lecture-code/gan_mnist.py). GAN: Goodfellow et al., 2014. Faces: thispersondoesnotexist.com.
PROCESS 1 OF 5 · COMPETITION
Training a GAN is a game
Two losses pulling against each other, not one loss rolling downhill
THE LOOP
Take turns
1. Update the discriminator on a batch of real images and a batch of fakes
2. Update the generator so the current discriminator calls its fakes real
3. Repeat: each trains against today's opponent
WHERE IT ENDS
A standoff
Fakes match the data, so the discriminator can only guess
p̂ = 0.5
for every image, real or fake
Keep the generator, discard the discriminator
WHAT GOES WRONG
Games are unstable
Chasing. they circle instead of settling
Mode collapse. one fake that works, made over and over
No progress bar. neither loss tracks image quality
The solution comes out of the dynamics of the game, good and bad.
PROCESS 1 OF 5 · COMPETITION
Just enough reinforcement learning
Agent
policy network
World
a game, a robot, a task
action
new state + reward
THE UPDATE
  • The network outputs p̂ over actions
  • Sample an action, see the reward
  • Paid off: raise its p̂. Didn't: lower it
WHAT MAKES IT HARD
  • Credit: a win comes many moves later
  • Exploring: keep trying new moves
  • The data comes from the agent's own play
Cross-entropy toward the actions that won, instead of toward a label.
PROCESS 1 OF 5 · COMPETITION
Self-play: AlphaGo Zero
One network
p̂ over moves · v: who is winning
guesses
Tree search
look ahead using those guesses
better moves
Play itself
both sides, the same network
train on its own games: p̂ → the search's moves, v → who won
0
human games used
4.9 million
games against itself
3 days
to beat AlphaGo Lee, 100–0
Each version trains against the last: the opponent improves exactly as fast as you do.
Silver et al., 2017, Nature, “Mastering the game of Go without human knowledge”. AlphaGo Lee: the version that beat Lee Sedol in 2016.
PROCESS 2 OF 6 · SELF-PLAY
The intuition: play yourself
THE WORLD
  • Knows the rules
  • Three in a row: +1
  • Players get only the +1
WHAT HAPPENED
THE WORLD
WHAT IT LEARNS
1
Both play at random
X makes a line by accident
+1 to X
Moves that finish a line pay off
2
Both now aim for lines
O finishes one X left open
+1 to O
Block the other side's line
3
Both now block every line
X makes two threats at once
+1 to X
Fork: one threat is never enough
The rules arrive only as +1 from the world; each better copy forces the next lesson.
PROCESS 2 OF 6 · SELF-PLAY
Labeling a game: the idealised version
MOVE 1 · X
MOVE 2 · O
MOVE 3 · X
MOVE 4 · O
MOVE 5 · X
q = r − 0.95 × V(next state)
−: next state is the opponent's  ·  0.95: one move later
q5 = r = +1.00
q4 = 0 − 0.95 × 1.00 = −0.95
q3 = 0 − 0.95 × (−0.95) = +0.90
q2 = 0 − 0.95 × 0.90 = −0.86
q1 = 0 − 0.95 × (−0.86) = +0.81
Each label looks one move ahead, no further. Swept backward once, the +1 reaches every move.
Idealised, illustrative numbers.
PROCESS 2 OF 6 · SELF-PLAY
How DQN really labels: random order, many passes
MOVE 1 · X
X
MOVE 2 · O
X
O
MOVE 3 · X
X
O
X
MOVE 4 · O
X
O
O
X
MOVE 5 · X
X
O
X
O
X
PASS 1
draw 1 · q3 = 0 − 0.95 × 0 = 0
draw 2 · q1 = 0 − 0.95 × 0 = 0
draw 3 · q4 = 0 − 0.95 × 0 = 0
draw 4 · q5 = r = +1.00
draw 5 · q2 = 0 − 0.95 × 0 = 0
PASS 2
draw 1 · q3 = 0 − 0.95 × 0 = 0
draw 2 · q1 = 0 − 0.95 × 0 = 0
draw 3 · q2 = 0 − 0.95 × 0 = 0
draw 4 · q4 = 0 − 0.95 × 1.00 = −0.95
draw 5 · q5 = r = +1.00
PASS 3
draw 1 · q1 = 0 − 0.95 × 0 = 0
draw 2 · q4 = 0 − 0.95 × 1.00 = −0.95
draw 3 · q3 = 0 − 0.95 × (−0.95) = +0.90
draw 4 · q5 = r = +1.00
draw 5 · q2 = 0 − 0.95 × 0.90 = −0.86
Why label randomly? The value of a move is based on the current opponent. It will change.
Simplified: real DQN takes gradient steps on batches of 128, with a frozen copy.
PROCESS 2 OF 6 · SELF-PLAY
Self-play DQN: the structure
THE BOARD s
X to move
X: 9 numbers
+1 mine · −1 theirs
0 empty
Q-network
weights W
Linear 9 → 128
SiLU
Linear 128 → 128
SiLU
Linear 128 → 9
Q̂: 9 scores
Q̂: EXPECTED RESULT PER SQUARE
  • +1 win · 0 draw · −1 loss
  • Play the highest square
  • 10%: random, to explore
THE OPPONENT IS ITSELF
  • O's turn: flip signs, X × (−1)
  • Same network picks O's move
THE OBJECTIVE
q = r               game over
q = −γ · max Q̂(s′)  otherwise
L = (Q̂(s, a) − q)²
PROCESS 2 OF 6 · SELF-PLAY
The forward pass
PASS 1 · SCORE MY MOVE
s · X to move
Q-network
weights W
Q̂, X plays a
Q̂(s, a) = 0.29
a = bottom-left: the block
PASS 2 · SCORE THE OPPONENT'S BEST REPLY
s′ · O's view
Frozen copy
of W, held fixed
O's Q̂
max Q̂(s′) = −0.51
O's best reply
THE TARGET q
q = r − γ · max Q̂(s′)
  = 0 − 0.95 × (−0.51)
  = 0.48
  • r = 0: not over
  • −: O's best, my worst
  • γ = 0.95: one move later
LOSS · SQUARED ERROR
L = (Q̂(s, a) − q)² = (0.29 − 0.48)² = 0.04
The target is the network's own guess, one move later.
PROCESS 2 OF 6 · SELF-PLAY
The backward pass
X
Q-network
weights W
Q̂
pick square a
Q̂(s,a)
(· − q)²
L
q from the frozen copy: held fixed
∂L/∂Q̂(s,a)
∂Q̂(s,a)/∂Q̂
∂Q̂/∂W
∂L/∂W =
∂L/∂Q̂(s,a) · ∂Q̂(s,a)/∂Q̂
· ∂Q̂/∂W
W ← W − η ∂L/∂W
∂L/∂Q̂ ON OUR EXAMPLE
∂L/∂Q̂(s,a) = 2(Q̂(s, a) − q) = 2(0.29 − 0.48) = −0.38
  • Other eight squares: 0
  • The pick is a gate
Ordinary regression, except the target comes from its own next move.
PROCESS 2 OF 6 · SELF-PLAY
Results: a random player learns the game
0%25%50%75%100%02,0004,0006,0008,00010,000games played against itself
takes an open winblocks a threatdraws vs a perfect player
ITS SCORES Q̂ ON THE BLOCKING POSITION
game 0
game 30,000
outlined: the block
  • Wins first: 92% by game 200
  • Blocks next: 95% by game 700
  • vs random: wins 90%
  • vs perfect: draws 100%
  • AlphaGo Zero: + search
Train it,
then play it
Everything it knows came from games against itself.
Our DQN plays tic-tac-toe against itself (lecture-code/dqn_tictactoe.py). DQN: Mnih et al., 2015. AlphaGo Zero: Silver et al., 2017.
PROCESS 2 OF 6 · SELF-PLAY
What do they share?
?
A GAN and self-play DQN: what do they have in common, and what is different?
GAN
Self-play DQN
The opponent
the discriminator
a copy of itself
What it learns from
the opponent's gradient
who won, via its own guesses
The network inside
any differentiable network with the right input and output shapes
In common: no fixed target. The opponent is the curriculum, and it gets better with you.
PROCESS 3 OF 6 · ITERATIVE REFINEMENT
Diffusion: destroy a little at a time
add a little noise at every step
t = 0
image ×1.00
noise ×0.00
t = 50
image ×0.98
noise ×0.17
t = 150
image ×0.89
noise ×0.46
t = 300
image ×0.63
noise ×0.78
t = 600
image ×0.16
noise ×0.99
t = 1000
image ×0.01
noise ×1.00
ONE NOISING STEP, IN CLOSED FORM
xt = √ᾱt · x0 + √(1 − ᾱt) · ε
ε: fresh Gaussian noise · ᾱt shrinks from 1 toward 0
  • No learning in this direction
  • After 1,000 steps: pure noise
  • The hard part is going back
PROCESS 3 OF 6 · ITERATIVE REFINEMENT
Learn one step, then loop it
TRAINING · PREDICT THE NOISE IN xt (t = 400)
A noisy digit at step 400
xt
Denoiser
weights W
The noise the network predicts for this digit
ε predicted
vs
The noise that was actually added
ε true
  • Loss: ‖ε − ε‖²
  • Plain regression
ONE DENOISE STEP · SUBTRACT A LITTLE OF ε
(
The noisy digit x_t
−
0.009×
The predicted noise
)
÷ 0.996
=
x_(t-1): one step less noisy
xt
ε
xt−1
  • One step: only a sliver of noise
  • xt−1 looks almost like xt
GENERATING · LOOP THE STEP, t = 1000 → 0
A generated digit at step t = 999: pure noise
denoise
A generated digit at step t = 750
denoise
A generated digit at step t = 500
denoise
A generated digit at step t = 300
denoise
A generated digit at step t = 150
denoise
A generated digit at step t = 0: a finished 2
t = 999
t = 750
t = 500
t = 300
t = 150
t = 0
One easy step, learned once, repeated until noise becomes an image.
Top rows: our small MLP denoiser (step shown without σtz). Loop row: a small CNN denoiser trained in Colab.
PROCESS 3 OF 6 · ITERATIVE REFINEMENT
Same goal, two processes
Talk it over with a neighbour before we move on
?
Both turn noise into images. Which trains more reliably? Which makes an image faster?
GAN
Diffusion
The process
a game between two networks
one learned step, run in a loop
Training signal
an opponent's gradient
regression on the added noise
Training
unstable: chasing, mode collapse
stable
Making an image
one pass: fast
≈1,000 passes: slow
Same parts, same goal: the process decides how it trains and how it runs.
PROCESS 4 OF 6 · RENDERING
NeRF: the network is the scene
Classic volume rendering, with an MLP in place of the 3D model
Shoot a ray
from the camera through one pixel
Sample points
along the ray
MLP = the scene
position + view direction
→ colour, density
Add up along the ray
near, dense points hide far ones
pixel colour
camera
pixel
sample points
WHAT LEARNS, WHAT DOESN'T
  • The rendering math is fixed and decades old
  • Only the MLP learns: it stores the whole scene
  • 8 layers, 256 wide: a network you could write
Keep the renderer. Replace the 3D model with a network.
NeRF: Mildenhall et al., 2020, “Representing scenes as neural radiance fields for view synthesis”.
PROCESS 4 OF 6 · RENDERING
Train the scene by rendering it
The only data: photos of one scene, each with its camera position
Photos
one scene, many views
Render that view
from the MLP
Compare pixels
squared error
gradient back through the renderer
Then: render views no camera ever took
  • Every step of the rendering is differentiable: sums and products along the ray
  • So the loss on a photo reaches the MLP, just like backprop through any layer
  • About 100 photos per scene in the original paper
A differentiable process lets the gradient reach the network inside it.
Mildenhall et al., 2020. Its synthetic scenes used 100 training views each.
PROCESS 4 OF 6 · RENDERING
The intuition: a network that is the scene
A SCENE
  • What is where
  • What it looks like
AN IMAGE
  • The scene, seen from one spot
A photo of the scene: an orange sphere and a blue sphere on white The same scene from another camera
2 of our 24 photos
THE IDEA: THE NETWORK IS THE SCENE. ASK IT ABOUT ANY POINT
(x, y, z)
a point in space
MLP
weights W
colour c = (r, g, b)
density σ
DENSITY σ: HOW OPAQUE
  • σ = 0: empty air, see-through
  • σ large: solid surface
(−0.33, 0.18, 0.62) → σ = 15.4
on the orange sphere
(−0.21, 0.62, 1.78) → σ = 0.0 · see-through
empty air
Teach a network the scene, then ask it what is at any point.
Two real queries to our trained tiny NeRF. NeRF: Mildenhall et al., 2020.
PROCESS 4 OF 6 · RENDERING
Render a pixel, then a photo
cameraimage plane
σ
w = 0.98
1  One pixel → one ray
2  Ask the MLP at 16 points: ci, σi
3  Blend: ĉ = Σ wi ci · front solid points count most
4  Repeat for every pixel → a predicted photo
PREDICTED ĉ
REAL c · THE LABEL
The real photo from camera 1 of 24
LOSS · MEAN SQUARED ERROR
L = mean (ĉ − c)² = 0.0033
W ← W − η ∂L/∂W
every pixel's error flows back into the MLP
Points are only asked. The photo's pixels are the labels.
Our tiny NeRF after 300 training steps, camera 1 of 24 (lecture-code/nerf_render_demo.py). Side view not to scale.
PROCESS 4 OF 6 · RENDERING
NeRF: the structure
ray (o, d)
one pixel
16 points
xi = o + ti d
MLP = the scene
weights W · run on each point
γ(x): sin, cos · 6 freqs
Linear 39 → 128
SiLU
Linear 128 → 128
SiLU
Linear 128 → 128
SiLU
Linear 128 → 4
σi: density
ci: colour
per point
Renderer
ĉ = Σ wi ci
wi: from σ, not learned
LEARNS
  • Only W: the scene is in the MLP
  • One network per scene
WHY sin?
  • Input: a point (x, y, z)
  • γ(x): sin, cos at 1, 2, 4 … 32
  • Raw xyz: blurry edges
  • Ours: 25.7 dB raw vs 35.3 dB with γ
THE OBJECTIVE
L = ‖ĉ − c‖²
  • ĉ: rendered pixel
  • c: photo pixel
An ordinary MLP. The idea is the renderer around it.
Our MLP has 38,660 weights; the paper's: 8 layers × 256, 10 frequencies, plus view direction. No-γ run: lecture-code/nerf_no_encoding.py.
PROCESS 4 OF 6 · RENDERING
The forward pass
ti
2.12
2.38
2.62
2.88
3.12
3.38
3.62
3.88
4.12
4.38
4.62
4.88
5.12
5.38
5.62
5.88
THE RAY · CAMERA ON THE LEFT
σi
0.0
0.0
0.0
0.0
0.0
15.4
23.6
27.0
29.0
29.2
21.5
0.0
0.0
0.0
0.0
0.0
ci
wi
0.00
0.00
0.00
0.00
0.00
0.98
0.02
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
BLEND WEIGHTS · FROM σ, NOT LEARNED
αi = 1 − exp(−σi δi) · opaque here
Ti = Πj<i(1 − αj) · not yet blocked
wi = Ti αi
RENDERED PIXEL
ĉ = Σ wi ci + (1 − Σ wi) · white
Σ wi = 1.00
ĉ = (0.82, 0.42, 0.02)
ĉ
c
LOSS
L = ‖ĉ − c‖²
= 0.005
A pixel is a weighted sum along its ray.
Point colours ci far from the surface are meaningless: their weight wi is near 0. True c = (0.80, 0.39, 0.09).
PROCESS 4 OF 6 · RENDERING
The backward pass
xi
MLP
weights W
ci, σi
Renderer
Σ wi ci
ĉ
‖· − c‖²
L
∂L/∂ĉ
∂ĉ/∂ci = wi
∂ci/∂W
∂L/∂W = Σi
∂L/∂ĉ · wi · ∂ci/∂W
  + the σi path
W ← W − η ∂L/∂W
|∂L/∂ci| ON OUR RAY · ∂L/∂ĉ = 2(ĉ − c) = (0.03, 0.06, −0.12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
point along the ray, near → far
WHY IT WORKS
  • Point i gets wi of the error
  • The surface point gets most
  • Hard occlusion: no slope for σ
Soft rendering sends the pixel error to the points the ray sees.
Gradient sizes from our run after step 300.
PROCESS 4 OF 6 · RENDERING
Results: a view no camera took
Render of the held-out view after 0 steps
step 0
6.8 dB
Render of the held-out view after 100 steps
step 100
22.7 dB
Render of the held-out view after 300 steps
step 300
23.3 dB
Render of the held-out view after 1,000 steps
step 1,000
29.4 dB
Render of the held-out view after 3,000 steps
step 3,000
35.3 dB
The true view from the held-out camera
true view
  • No camera ever took this view
  • 24 photos, 38,660 weights, about 14 minutes on a CPU
  • Original NeRF: about 100 photos, about a day on a GPU
From 2D photos alone, a 3D scene that renders new views.
dB: PSNR against the true view, higher is better. Our tiny NeRF on a scene we rendered ourselves (lecture-code/nerf_tiny.py). NeRF: Mildenhall et al., 2020.
PROCESS 5 OF 6 · COMPUTING WITH MEMORY
A computer with neural parts
input
Controller
a network (an LSTM)
output
MEMORY · ROWS OF NUMBERS
write
read
  • Controller ≈ CPU
  • Memory ≈ RAM
  • Reads and writes are soft, so it all trains end to end
TRAINED FROM EXAMPLES, IT LEARNED TO
  • Find the shortest route between stations on the London Underground map
  • Answer family-tree questions it was never told directly ("who is my great-uncle?")
The von Neumann computer, made differentiable.
Neural Turing Machine: Graves et al., 2014. Differentiable neural computer: Graves et al., 2016, Nature.
PROCESS 5 OF 6 · COMPUTING WITH MEMORY
Reading memory is attention
?
“Read row 2” is not differentiable. How can the controller read memory softly?
MEMORY
MATCH WITH KEY
SOFTMAX WEIGHT
row 1
+0.1
0.08
row 2
+2.0
0.54
row 3
-0.5
0.04
row 4
+0.3
0.10
row 5
+1.2
0.24
THIS IS ATTENTION
  • Query: a key from the controller
  • Keys and values: the memory rows
  • Read = Σ weight × row
Writing uses the same soft weights: each row moves toward the new vector, by its weight.
You have seen this before: soft addressing is attention over memory.
Similarities are illustrative. The DNC also addresses memory by recency and by the order of writes (Graves et al., 2016).
PROCESS 6 OF 6 · COGNITION
Spaun: a quest for the holy grail
a neural cognitive model
A golden grail glowing in a ring of clouds
Vision
28 × 28 image → a concept
Working memory
holds a list in order
Transform
changes what is held
Action selection
basal ganglia: routes it all, picks what is next
Motor
moves an arm to write
IN
One image at a time: digits, and symbols that say which task to do
OUT
A simulated arm writes its answer as a handwritten digit
The process is a theory of how a brain is organized. Neurons implement every part of it.
A cognitive architecture, built entirely from neurons.
Eliasmith et al., 2012, Science, “A large-scale model of the functioning brain”. Built with the Semantic Pointer Architecture.
PROCESS 6 OF 6 · COGNITION
One network, eight tasks
The task is shown to it as symbols. No rewiring between tasks
Copy drawing
write a digit in the style it saw
Recognition
name the digit it sees
Reward learning
learn which of three choices pays
List memory
repeat back a list of digits
Counting
count up from a digit
Question answering
“which digit is in position 3?”
Rapid variables
learn a pattern from a few examples
Fluid reasoning
complete a Raven’s-style pattern
  • Its weights were mostly set by design (the Neural Engineering Framework), not learned end to end by backprop
  • So it is a theory of cognition, compiled into neurons: it can be tested against real brains
The process here is a theory of the mind; neurons implement every part.
Task list from Eliasmith et al., 2012. A later version, Spaun 2.0 (Choo, 2018), has 6.6 million neurons and 12 tasks.
Six processes, one question
PROCESS
THE IDEA
THE NETWORK LEARNS
Competition
two networks improve each other
generator and discriminator
Self-play
one network plays a copy of itself
a score for every move
Iterative refinement
improve a draft one small step at a time
one denoising step
Rendering
volume rendering along camera rays
the scene itself
Computing with memory
a CPU reading and writing RAM
the controller, and where to look
Cognition
see, remember, decide, act
every module (mostly set by design)
Designing neural processes: the final level of abstraction
Macro innovations: new processes  ·  Most others: better analysis and theory
The big leaps came from designing new processes.
Your turn: the invention of writing
?
THE PROCESS
1
Sees one animal
the carver: a mammoth, a deer or a sabre-tooth
2
Carves 3 marks
each one of 10 shapes:
|○△□✕∿∧⌒‖⋯
3
Reads the tablet
the reader never saw the animal
4
Names the animal
the tribe says only: right or wrong
5
Hunt after hunt
the marks start to mean something
Build the neural version.
One way to build it
picture of
the animal
Carver
CNN · weights W1
3 × softmax
over 10 shapes
argmax
top shape
△○∿
3 marks
Reader
MLP · weights W2
a score for
each animal
L = cross-entropy
error flows back … argmax has no slope
THE FIX · A SURROGATE GRADIENT
  • Forward: argmax picks the top shape
  • Backward: pretend it was the softmax: use the softmax's gradient
  • The carver learns through the reader
OUR RUN · HELD-OUT ACCURACY (CHANCE 10%)
argmax, no gradient
25%
surrogate gradient
96%
WORDS IT INVENTED
✕|⋯
digit 0
✕∧|
digit 2
|∧△
digit 3
||△
digit 5
|□⋯
digit 9
An autoencoder with a discrete bottleneck, trained with a surrogate gradient.
Course evaluations
OPEN THE LINK OR SCAN THE CODE
tntech.campuslabs.com/courseeval
  • Written comments help the most
  • What should I keep for next year?
  • What should I change?
Thank you. Your comments shape next year’s course.
Quiz 4 · Tuesday, December 1
1
Generalization
what an MLP really learned
2
Augmentation
teach the symmetry with data
3
Inductive bias
build the symmetry into the net
4
CNNs
shared weights, local windows, pooling
5
Transformers
attention: the context-informed gate