1786 lecture12 Dec1
Overview
Jonathan Rose closes ECE 1786 with final-project presentation guidance, then surveys techniques for making large language models cheaper and faster while preserving quality. He connects scaling laws and model evaluation to hardware limits, explaining quantization, attention optimizations, key-value caching, mixture of experts, speculative decoding, and agent memory compaction with examples including 100-billion-parameter models, 4-bit weights, and a 27-billion-parameter MoE model using 3 billion active parameters.
Key takeaways
- For pre-training, model size and training-token count must be scaled together: the Chinchilla example calls for about 1.4 trillion tokens for a 70-billion-parameter model.
- A 100-billion-parameter model needs about 400 GB just to store 32-bit weights, so 4-bit quantization can make local inference more feasible by sharply reducing weight memory.
- Long-context self-attention has quadratic sequence-length cost, making a one-million-token context impractical without attention optimizations such as sliding windows.
- Key-value caching saves repeated attention computation during token generation, but consumes memory, so its benefit depends on whether inference is compute-bound or memory-bound.
- Mixture of experts reduces active computation rather than total model storage: the lecture's 27-billion-parameter example uses about 3 billion active parameters per inference.
- Speculative decoding and agent memory compaction target different sources of latency and cost: batched verification speeds token generation, while summarizing context limits the input the agent must process.
Chapters
- Final presentation slides are due Monday at 9:00, followed by three presentation and critique sessions across Tuesday and Wednesday.
- Each final presentation lasts six minutes, so teams need to select essential ideas and practice to fit the time.
- Jonathan Rose encourages students to write and speak for human readers rather than relying on LLM-generated compression in progress reports.
- Course evaluations ask whether the material on LLM fundamentals and agentic project work should be split into separate courses.
- The lecture surveys methods for reducing LLM cost, while treating output quality as a necessary part of any efficiency comparison.
- Main memory holds active variables and instructions, while SSD storage holds files; a laptop's 256 GB storage figure is not its RAM capacity.
- LLM inference relies on CPUs, accelerators such as GPUs, and substantial memory to hold model parameters.
- Tokens become embeddings, pass through transformer blocks, and reach a language-modeling head that predicts probabilities for the next token.
- Autoregressive generation feeds each sampled token back into the model to produce the next one.
- LLMs range from cloud data centers with many GPUs to local computers and phones, with edge devices such as cameras offering opportunities to process data locally.
- The course assignment model used embedding size 48 and three transformer blocks, while GPT-1 used embedding size 768, 12 blocks, and 117 million parameters.
- GPT-2 reached 1.5 billion parameters, and GPT-3 reached 175 billion, illustrating the shift toward much larger models.
- Rose identifies post-trained GPT-3.5, released as ChatGPT in November 2022, as a major public turning point.
- GPT-4 is described as using mixture of experts, a technique now associated with large frontier models.
- The Chinchilla study found that earlier models were trained on too few tokens for their parameter counts.
- Its example recommends about 1.4 trillion training tokens for a 70-billion-parameter model, compared with roughly 300 billion tokens used for GPT-3.
- The empirical scaling relationship ties pre-training loss to both parameter count and training-token count, with compute estimated at roughly six times their product.
- As model size grows, training data should grow as well; improvements diminish rather than increasing linearly with added resources.
- Pre-training loss and perplexity measure next-token prediction on held-out text, but broad LLM abilities require varied benchmarks.
- Examples include Humanity's Last Exam, MMLU-Pro, AIME, SWE-bench for software tasks, and image-focused evaluations.
- Artificial Analysis publishes comparisons across frontier and open models, but benchmark saturation and possible training-data leakage can undermine scores.
- Increasing reasoning effort can improve answers while increasing response time, creating a quality-versus-latency tradeoff for project developers.
- The planned efficiency topics include parameter quantization, more efficient attention, caching, mixture of experts, speculative decoding, and agent memory.
- Main memory stores both data structures and machine instructions, while an SSD stores files and has much higher access latency.
- LLM parameters compete for scarce accelerator memory, making model size a hardware constraint as well as a compute constraint.
- A 100-billion-parameter model stored at 32 bits per parameter requires about 400 GB of memory just for its weights.
- Rose cites an NVIDIA B300 with 288 GB of memory as an example of why even a large GPU cannot hold that model's full-precision weights alone.
- Large models are distributed across multiple GPUs, which must communicate over high-speed interconnects.
- Training can require four to twelve times as much memory as inference because it also retains gradients and activations.
- Quantization reduces the bits used to represent model parameters, commonly moving from 32 bits to 16, 8, or 4 bits.
- Four bits encode 16 possible values, and 8 bits encode 256; reducing precision substantially cuts weight storage.
- A basic grouped method scales a block of about 128 parameters, quantizes each value, and stores a scale factor for later reconstruction.
- Quantization introduces approximation error, which can be reduced by further training with quantized weights; low-precision arithmetic can also improve accelerator throughput.
- Causal self-attention lets each output token use information from that position and all earlier positions.
- Computing attention across a sequence of length n has quadratic growth, making a context of one million tokens especially expensive.
- The query, key, and value calculations determine how earlier token representations contribute to each output.
- Sliding-window attention limits each token to a fixed number of recent tokens, reducing work compared with attending to all n positions.
- A fixed window can discard useful distant context, so some designs interleave local-attention layers with full-attention layers.
- Grouped-query attention shares keys and values across multiple attention heads while retaining distinct queries, reducing parameter and memory demands.
- Key-value caching retains previously computed keys and values during autoregressive generation instead of recomputing them for every new token.
- The cache trades additional memory use for less computation, which can help when a workload is compute-bound.
- Prompt processing can be compute-heavy, while generating tokens one at a time can become memory-bound as model weights and cached values must be supplied repeatedly.
- Rose describes Cerebras and AMD as pursuing complementary prompt-processing and token-generation hardware, a system approach called disaggregated computing.
- A mixture-of-experts model replaces a single feed-forward network with multiple expert networks and a learned router.
- The router processes each token's representation and selects one or more experts; outputs from multiple active experts can be combined using router weights.
- Routing happens within transformer layers, and training uses a load-balancing component so work does not collapse onto only a few experts.
- A 27-billion-parameter example activates about 3 billion parameters per inference, reducing computation but not the memory needed to store all experts.
- Autoregressive generation is sequential because each token normally must be produced before the next can be computed.
- Speculative decoding uses a smaller, faster draft model to propose several tokens, with eight given as an example.
- The larger model checks the proposed tokens together in a batch; accepted predictions can speed generation when the draft frequently matches.
- Agent harness software can decide what conversation or task information should be sent back to the LLM as context.
- When a conversation grows too long, the system can summarize it and replace the full history with the summary, a process called memory compaction.
- Reducing context size can save computation, time, and energy while helping agents stay within context limits.
Transcript excerpt
0:03 All right, good morning everyone. Welcome to ECE 1786 lecture number 12. Uh this is the last lecture. Uh it's a new lecture and I hope you enjoy it. Um the work you have in flight well the project. It's a big part of this course. The final presentations are due next Monday at 9:00. We're going to do the same process that you're now familiar with. You deliver slides at nine and then over the next two days in three sessions [snorts] you present your final presentation and you also critique uh someone else's presentation. Uh as a result uh you need to fill out the form by December 4th in which you say I can't make one of those three presentations
0:51 Tuesday morning, Tuesday evening or Wednesday evening. And you can only get out of one because you'll be presenting or reviewing in in in uh two presenting one and reviewing in the other one. We'll remind you that it's a six minute presentation and uh that's 50% more time than you got for the proposal, but you must get the essential ideas out in that in that presentation. It's kind of obvious when you're speaking and so you're going to have to do it. You're going to have to be selective in a very careful way. Uh part of the training that I think you get in this course is to learn what to write and talk about. I I've I've commented already that I feel like I'm suffering uh LLM based compression of words in the progress reports. And uh I really want
1:41 to emphasize how important it is for you humans to learn what the other humans can consume and not leave it to a model to compress into difficult to read language. And so you know I'm only
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Jonathan Rose.