<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Learning AI – Victor Grösser</title><link>https://victorgrosser.nl/blog/category/learning-ai/</link><description>Courses, explainers and notes from learning modern AI hands-on.</description><language>en</language><atom:link href="https://victorgrosser.nl/blog/category/learning-ai/rss.xml" rel="self" type="application/rss+xml"/><lastBuildDate>Tue, 20 Oct 2026 09:00:00 +0000</lastBuildDate><item><title>What I Learned from the Free Hugging Face LLM Course (and How to Start)</title><link>https://victorgrosser.nl/blog/hugging-face-llm-course-what-i-learned/</link><guid isPermaLink="true">https://victorgrosser.nl/blog/hugging-face-llm-course-what-i-learned/</guid><pubDate>Tue, 20 Oct 2026 09:00:00 +0000</pubDate><description>A hands-on look at the free Hugging Face LLM course: Transformers, tokenizers, fine-tuning with the Trainer API, inference, and how to get started.</description><category>Learning AI</category><category>hugging-face</category><category>llm</category><category>transformers</category><category>fine-tuning</category><category>tokenizers</category><category>free-ai-courses</category><content:encoded><![CDATA[<p>Most of my work involves building on top of large language models, so it's easy to treat them as a black box behind an API. I wanted to go one layer down. The free <a href="https://huggingface.co/learn/llm-course" rel="noopener">Hugging Face LLM Course</a> seemed like the right place to do that. I've worked through the first three chapters: Transformer models, using 🤗 Transformers, and fine-tuning a pretrained model. Here is what stuck with me and how I would approach it if I were starting again.</p>
<h3 id="what-the-course-is">What the course is</h3>
<p>The course is free and built around the Hugging Face ecosystem: 🤗 Transformers, Datasets, Tokenizers, Accelerate and the Hub. Chapters 1–4 cover the basics of Transformers. After that it moves on to datasets and tokenizers, then classical NLP tasks, and finally more advanced LLM topics. The stated prerequisites are Python and some basic deep learning knowledge. You don't need a GPU to get value from the early chapters.</p>
<p>Each chapter ends with an ungraded quiz. Chapter 1 also has a short certification exam, hosted in a Hugging Face Space. You need to sign in to take it.</p>
<h3 id="chapter-1-transformer-models-demystified">Chapter 1: Transformer models, demystified</h3>
<p>The first chapter starts at the highest level: <code>pipeline()</code>. One call wraps preprocessing, the model and postprocessing. With it you can run sentiment analysis, zero-shot classification, text generation, fill-mask, named entity recognition, extractive question answering, summarization and translation. Small details turn out to matter. For example, the mask token depends on the model: <code>[MASK]</code> for BERT and <code>&lt;mask&gt;</code> for RoBERTa. Zero-shot classification also needs <code>candidate_labels</code>.</p>
<p>Then the chapter explains <em>why</em> it works. The ideas that clarified the most for me:</p>
<ul><li><strong>Self-supervised pretraining.</strong> Language models learn without human labels, either by predicting the next token (causal LM) or by filling in masked tokens (masked LM).</li><li><strong>Transfer learning.</strong> Pretraining is expensive in both compute and environmental cost. So you start from pretrained weights and fine-tune on a smaller, task-specific dataset.</li><li><strong>Three architecture families.</strong> Encoder-only models (BERT, RoBERTa, ModernBERT) use bidirectional attention and suit classification, NER and extractive QA. Decoder-only models (GPT, Llama, Gemma, SmolLM) generate auto-regressively and are the base of modern LLMs. Encoder-decoder models (BART, T5, Marian) handle summarization and translation.</li><li><strong>Architecture vs. checkpoint.</strong> The architecture is the blueprint. The checkpoint is the trained weights. That distinction removes a lot of confusion when you browse the Hub.</li></ul>
<p>The section on <strong>inference</strong> was the most useful part for practical work. Generation has two phases. <em>Prefill</em> processes the prompt and is compute-bound. <em>Decode</em> produces tokens one at a time and is memory-bound. That split explains why time to first token and time per output token behave so differently. It also explains why the KV cache matters: it avoids recomputing past keys and values. The chapter also covers sampling controls (temperature, top-k, top-p, repetition penalties) and why long contexts are costly.</p>
<p>There is also an honest section on <strong>bias and limitations</strong>. A fill-mask demo suggests gendered professions, and the course notes that fine-tuning does not remove bias inherited from pretraining. That is worth remembering in any domain where fairness matters, such as legal or educational applications.</p>
<h3 id="chapter-2-behind-the-pipeline">Chapter 2: Behind the pipeline</h3>
<p>Chapter 2 takes <code>pipeline()</code> apart: tokenizer → model (logits) → postprocessing (SoftMax → labels). Key takeaways:</p>
<ul><li>The <strong>tokenizer must match the checkpoint</strong>. <code>AutoTokenizer.from_pretrained(checkpoint)</code> and <code>AutoModel.from_pretrained(checkpoint)</code> should point to the same model.</li><li>Models in the library are plain PyTorch <code>nn.Module</code>s. <code>save_pretrained</code> writes a <code>config.json</code> plus <code>model.safetensors</code>.</li><li><strong>Tokenization strategies</strong>: word-based (huge vocabularies), character-based, and subword methods (WordPiece, BPE, Unigram). Subword tokenization is the practical compromise.</li><li><strong>Batching</strong> needs padding, attention masks and truncation. A model expects a batch dimension, and forgetting it is a classic first error.</li></ul>
<p>The chapter closes with deployment options: TGI (continuous batching, Flash Attention), vLLM (PagedAttention) and llama.cpp for smaller local models. If you run models yourself on a homelab or a VPS, this short section is a good map of the options.</p>
<h3 id="chapter-3-fine-tuning-a-pretrained-model">Chapter 3: Fine-tuning a pretrained model</h3>
<p>Chapter 3 is where it becomes concrete. You fine-tune a BERT classifier on MRPC from the GLUE benchmark, which asks whether two sentences are paraphrases. Along the way you learn:</p>
<ul><li><code>load_dataset(&quot;glue&quot;, &quot;mrpc&quot;)</code> and <code>Dataset.map(batched=True)</code> for fast tokenization of sentence pairs.</li><li><code>DataCollatorWithPadding</code> for <strong>dynamic padding</strong> per batch instead of padding everything to the maximum length.</li><li>The <strong>Trainer API</strong>. <code>TrainingArguments</code> needs only an <code>output_dir</code>. For accuracy you add an evaluation strategy and a <code>compute_metrics</code> function. <code>fp16=True</code> turns on mixed precision.</li><li>A <strong>manual training loop</strong> with AdamW, a linear scheduler and Accelerate, which shows what <code>Trainer</code> hides.</li><li><strong>Reading learning curves.</strong> Loss falls and then converges, while accuracy moves in steps. A large gap between training and validation means overfitting. Two curves that both plateau point to underfitting.</li></ul>
<p>One small detail I liked: when you load a model with a new classification head, you get a warning that some weights are randomly initialised. That is expected. The head hasn't been trained yet.</p>
<h3 id="how-i-d-recommend-starting">How I'd recommend starting</h3>
<ol><li><strong>Read Chapter 1 end to end, even if you know the basics.</strong> The architecture overview and the inference section give you shared vocabulary for everything after.</li><li><strong>Run the code.</strong> The notebooks open in Colab. Typing <code>pipeline(&quot;sentiment-analysis&quot;)</code> and then taking it apart in Chapter 2 builds intuition faster than reading.</li><li><strong>Do the quizzes.</strong> They're short and they catch the subtle misunderstandings. One question made me double-check that SoftMax outputs are between 0 and 1 <em>and</em> sum to 1.</li><li><strong>Fine-tune something small.</strong> Chapter 3's MRPC example runs on a free GPU. Once it works, swap in your own dataset.</li><li><strong>Treat it as a map, not a finish line.</strong> Later chapters cover datasets, tokenizers and more advanced LLM topics. I'm continuing with those.</li></ol>
<h3 id="closing-thought">Closing thought</h3>
<p>The course doesn't sell you anything. It explains what's going on under the hood clearly and gives you working code. For anyone building with LLMs, whether you're shipping products or advising on how AI is used responsibly, that grounding pays off quickly.</p>
<p><strong>Course link:</strong> <a href="https://huggingface.co/learn/llm-course" rel="noopener">Hugging Face LLM Course</a> · <a href="https://huggingface.co/learn/llm-course/chapter1/1" rel="noopener">Chapter 1</a> · <a href="https://huggingface.co/learn/llm-course/chapter2/1" rel="noopener">Chapter 2</a> · <a href="https://huggingface.co/learn/llm-course/chapter3/1" rel="noopener">Chapter 3</a></p>]]></content:encoded></item></channel></rss>
