§12.1.5–12.2Dynamic Structure · Specialized Hardware · Computer Vision

Part II DL pp. 448–453 · ~4 min read

  • conditional computation
  • cascade (of classifiers)
  • mixture of experts

§12.1.5 Dynamic structure

Another way to accelerate inference: give the computation dynamic structure, so a system runs only the part of the graph a given input needs. When this happens inside a network — computing only the hidden units that matter for the current input — it is called conditional computation . Many components are relevant only for a few inputs, so computing them on demand saves time.

Cascade of classifiers. A venerable trick for detecting a rare object: run a sequence of classifiers where cheap, high-recall early stages reject easy negatives, and only survivors reach an expensive, high-precision final stage. Abandon any example as soon as a stage rejects it. Since the object is rare, most inputs never reach the costly classifier. Drag the prevalence to see the savings:

Fig (interactive) — a cascade of classifiers (like the Viola-Jones face detector). Cheap high-recall stages reject most negatives; the rarer the object, the less often the expensive high-precision stage runs.
stage 1 · cost 1 · high recall100.0% reach↓ rejects 70.0% of negativesstage 2 · cost 5 · high recall31.4% reach↓ rejects 60.0% of negativesstage 3 · cost 25 · high precision13.8% reach
cascade cost / example
6.0
run big model on all
25
compute saved
76.0%

Because the object is rare (2.0%), the cheap early stages reject most of the 98.0% negatives, so only 13.8% of examples ever reach the expensive stage-3 classifier. Verifying with a high-capacity model then costs 6.0 per example instead of 25 — a 76.0% saving. The rarer the object, the bigger the win.

Early stages need high recall (never wrongly reject a true object); the final stage supplies high precision. A cascade reaches high capacity either by making the later stages individually powerful, or by combining many small models. Google’s Street View pipeline is a two-step cascade — locate the address number, then transcribe it.

Mixture of experts. A neural gater picks which of several expert networks handles the input:

Mixture of experts — a gater softmax-weights the experts. A SOFT mixture averages all experts (α-weighted); a HARD mixture picks a single expert per input to save computation.
inputgater (softmax)α1expert 1α2expert 2α3expert 3Σoutput

A soft mixture combines all experts by the α-weighted average — no compute saving. A hard mixture of experts picks a single expert per input, cutting cost (best when the gating choice is small, not combinatorial). A related idea, a switch routing a unit’s input by context, is an attention mechanism (§12.4.5). The catch across all of these: reduced parallelism — different inputs take different branches, so few operations stay as big matrix multiplies; CPUs lose cache coherence and GPUs must serialize divergent warps.

§12.1.6 Specialized hardware

Beyond CPUs and GPUs, hardware designers build ASICs and FPGAs (digital, analog, or hybrid) to push efficiency further — increasingly for low-power devices like phones. A key lever is precision: though general processors use 32/64-bit floats, 8–16 bits often suffice for deep nets (more is needed for training than inference), and dynamic fixed-point representations (sharing one exponent across a layer’s numbers) cut bits further. Fewer bits shrink the chip area, power, and time of the dominant operation — multiplication. Specialized hardware matters now that single-core speed has plateaued and gains come from parallelism.

§12.2 Computer vision

Vision is effortless for humans yet hard for computers, and it has long been deep learning’s flagship application. Most work is object recognition or detection in some form:

The main computer-vision task types — click a row for detail.
What the model outputs
Object recognitionwhich object class is present in the image
Detectiona bounding box around each object
Transcriptiona sequence of symbols read from the image
Segmentationa label for EVERY pixel (its object identity)
Synthesis / restorationgenerate new images or repair defects
Dotted-underlined cells have explanations — click one.

Vision needs relatively little preprocessing — mostly standardizing pixel range and size. The next section covers what preprocessing is used (contrast normalization, augmentation) and moves on to speech recognition: preprocessing and speech recognition.

Check yourself — dynamic structure, hardware, and computer vision

1.What is 'dynamic structure' / conditional computation?

2.How does a cascade of classifiers accelerate detection of a rare object? (See the CascadeLab.)

3.What is a mixture of experts, and what is the difference between the soft and hard versions?

4.What is a major obstacle to dynamically structured systems?

5.What does the book say about specialized hardware and numerical precision for deep networks?

6.What kinds of tasks does most deep-learning computer vision address?

6 questions