Beta

Sync to cloud

Uses your current signed-in YoolVi account. A Learn profile is not required.

Upload a snapshot of this browser’s saved lesson work across all subjects, including notes, experiments, journal and review history. Existing guest work is included only when you confirm below. This does not upload account credentials or award XP.

Sync uploads to your private account; it does not automatically merge or replace this device’s work. On another device, download the cloud copy and use My Learning’s backup import. The previous cloud snapshot is retained when a new one replaces it.

Export or import this device’s work

No background uploads. Edits made after a snapshot need another sync. On shared devices, work is bound to the first account observed by cloud sync; another account must use a separate browser profile. Keep your own downloaded backup too.

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Back to AI Engineering Deployment and Operations

AI Engineering Deployment and Operations · Lesson 3 of 3 in this module

Explain: Compute budgets

READ & CONNECT

Understand what changed.

Back to the experiment

A shorter explanation, with the original worked examples available below. Both explain the same experiment and its limits.

Same learning goal in both modes: Compare the work and storage different models need. Keep estimates separate from times measured on this computer.

The idea in everyday terms

A parameter is an adjustable stored number. A training token is a piece of input processed during training, including repeated visits. An arithmetic-operation count estimates work; operations per second measures a rate. Memory capacity is a different resource again.

What to watch in the experiment

Use the budget controls to compare the consequences of model size and data volume. Then distinguish those estimates from the optional matrix experiment, which actually times a small computation. CPU and GPU timings cover different stated steps, so read the timer boundaries before comparing them.

What this does not establish

The invented scaling curve is not a measured law for your model. A small browser benchmark does not predict full training performance, and GPU availability alone does not guarantee faster execution.

Open the full worked examples, calculations and limitations

This is the same reference used in Technical mode. Expand it whenever you need the exact numbers, assumptions or further explanation.

Work, speed, and memory are different quantities

A parameter is a stored, adjustable number such as a weight or bias. A training token is one token presented during training; passing over the same data again still counts work, even when it adds little new information. A FLOP is a floating-point arithmetic operation. FLOPs count work; FLOPs per second describe a processing rate. Neither is the amount of memory needed to hold the model.

For a conventional dense language model, a useful rough training estimate is:

C≈6NDC \approx 6ND

Here N is the parameter count and D is the number of training tokens. Forward predictions, gradient calculation, and updates all require work. The factor six is an approximation that leaves out some costs, including important attention and implementation overheads. It is not a universal formula for every neural architecture.

The source exercise uses N = 10⁹ and D = 10¹¹. The product is 6 × 10²⁰ FLOPs, or 600 EFLOPs. Doubling N while halving D preserves that estimate. It does not preserve accuracy, memory use, or deployment cost.

A fixed budget asks you to make a tradeoff

More parameters can represent more complicated functions. More varied, relevant training data can help select functions that generalize. Large models trained on too little useful data can be a poor use of a fixed budget. Smaller models trained longer may be attractive when deployment memory or repeated inference is expensive.

Empirical scaling laws describe measured relationships between quantities such as model size, data size, computation, and prediction loss. Many show diminishing returns: each additional unit of resource brings a smaller improvement. The lab uses an invented curve so you can see that shape. Its constants do not come from measurements and must not be used to plan a real training run.

A sensible allocation requires actual quality measurements on suitable validation data, then a final held-out evaluation. Data duplication, poor labels, distribution shift, and harmful shortcuts do not disappear just because a model is bigger. Model size is not a direct measure of intelligence.

Deployment has a different bill

At two bytes per weight, one billion weights require 2 decimal GB just for the weights. Training also needs gradients, optimizer state, activations, and temporary storage. Inference needs activations, working buffers, and—in a decoder—a KV cache. Lower-precision storage can save memory, but numerical accuracy and supported operations need checking.

During small-batch generation, reading weights from memory can take a large share of the time. Memory bandwidth measures how quickly bytes can be moved. Dividing bytes by bytes per second gives an ideal reading-time lower bound. Real latency includes arithmetic, caching, batching, scheduling, and communication as well. Do not turn the lab’s assumed bandwidth into a claim about your laptop’s speed.

Conditional computation does not make inactive weights disappear

A mixture-of-experts model routes a token through a subset of its expert parameters. This is conditional computation: choose which numerical paths to activate for each input.

The ebook’s example has 50B total parameters and 20B active parameters per token. At two bytes per parameter, all the weights need 100 GB of storage. The active subset represents 40 GB of weights, but the other 60 GB still exists. Storage can be distributed or moved between devices; that can introduce additional transfer costs. Router computation, shared layers, load balancing, and communication also matter. Fewer active weights do not guarantee lower latency than a smaller dense model.

Internal experts are parts of a model’s computation. They are distinct from independent specialist models that communicate through tool calls or typed interfaces, which we will study in Course 2.

Longer context invites different architectures

For L tokens, full attention compares L² query-key pairs per head. A causal mask permits only L(L+1)/2 pairs, which still grows quadratically. Doubling L roughly quadruples the pair count. Optimized attention kernels can reduce memory traffic and avoid storing a complete score matrix, so the conceptual pair count is not a claim about one implementation’s memory allocation.

A sliding window limits each token’s direct access to nearby positions. Recurrent and state-space models instead carry a state forward through the sequence. Their updates can grow linearly with sequence length when state size is fixed, but an update is not the same operation as an attention pair. Compressing history can change which information is preserved. Architecture comparisons need quality tests and real measurements, not just counts with different units.

Why the optional GPU experiment is small

Matrix multiplication contains many independent multiply-and-add calculations. A GPU can perform many such calculations concurrently, but setting up a device, compiling a shader, and transferring arrays also takes time. For a small job, the CPU can finish first.

The experiment actually multiplies bounded arrays in a browser worker. If you choose WebGPU, it also runs a compute shader and compares every result with the CPU reference. The CPU path remains usable when GPU initialization fails or a device is lost. Each run releases GPU buffers and its device; canceling or leaving the page terminates the worker.

The two timers have deliberately stated boundaries: CPU arithmetic versus GPU setup through readback and cleanup. They do not predict large-model training performance, prove which hardware is generally faster, or compare optimized libraries. Browser timing has noise; repeated runs can differ. A WebGPU adapter can also be a software implementation, so availability alone does not prove hardware acceleration. WebGPU API documentation explains the browser interface.

Notes, help and related ideas
My notes and reflection
CURIOSITY JOURNAL

What will you take away?

Keep a private reminder for yourself.

Loading your journal…

Add a short reflection

Open your journal or back it up.

Prerequisites and related ideas

Key terms: FLOPs Parameter Memory bandwidth Conditional computation Scaling law