Loading video...

Video Failed to Load

Go Home

Full Fine-Tuning vs LoRA by hand ✍️ interactive diagram. Open Here's some T/F questions to test your knowledge: [ ] Growing the batch size grows the number of trainable parameters [ ] Both rows produce an output of the same shape [ ] LoRA's ΔW is a smaller matrix...

10,580 views • 14 days ago •via X (Twitter)

0 Comments

No comments available

Comments from the original post will appear here

Related Videos

How can you solve complex tasks using a Large Language Model? Here is a 2-minute introduction to everything you need to know to 10x the quality of your results. Let's talk about three techniques, in order of complexity, starting with the easiest one: • In-Context Learning • Indexing + In-Context Learning • Fine-tuning In-Context Learning The team that trained GPT-3 found something they couldn't explain: You can condition a model using examples of how you want it to behave. I included an example prompt in the attached video. You can "teach" the model how you want it to interpret questions, select the correct answers, and format the results by giving a few examples. You can also give specific knowledge to the model that will be helpful when formulating answers. We call this approach "grounding the model." There's another example in the video. Indexing + In-Context Learning Unfortunately, there is a limit to how much data you can include in a prompt. We call this the "context size." One version of GPT-4 supports a context of approximately 6,000 words, while the other supports 25,000 words. Although this sounds like a lot, many applications need more than that. Imagine you wrote a book and want to build an application to answer any questions about your story. What happens if your book is longer than the context? That's where Indexing comes in. Using a model, you can turn every book passage into an embedding. These are vectors, numbers that "encode" the passage's text. You can then store these embeddings in a particular database that supports fast retrieval of these vectors. You can then turn any question into an embedding and search the database for the list of passages that are similar to that query. Instead of using the entire book to ask the model, you can now use the relevant passages as in-context information, effectively working around the context size limitation. Fine-tuning Fine-tuning can give you an extra boost to get reliable outputs from your LLM. It is, however, the most complex approach on the list. There are different approaches to fine-tuning a model with your data. A popular technique is to process your data with your LLM and use the outputs to train a new classifier that solves your specific task. Notice that here you aren't modifying the LLM. Instead, you are chaining it with your trained classifier. Another approach is to modify the parameters of the LLM using your data. Think of this as "rewiring" the model in a way that solves your particular task. The results and costs will vary depending on how many layers you want to fine-tune from the original model. Many companies think that fine-tuning is the solution to their problems. In my experience, many will benefit from exploring the other two approaches. I love explaining Machine Learning and Artificial Intelligence ideas. If you enjoy in-depth content like this, follow me Santiago so you don't miss what comes next.

Santiago

384,510 views • 3 years ago

Small Language Models (SML) are the future of AI. "Small" (SML) instead of "Large" (LLM). These small models are highly specialized models with superhuman abilities on specific tasks. Here are two techniques to build these models: • Spectrum • Model Merging I give you a short introduction in the attached video, but here is a quick summary: Spectrum helps us identify the most relevant layers to solve one specific task. We can ignore everything else and focus on fine-tuning these layers. Using Spectrum, we can fine-tune models in a heartbeat. Model Merging combines multiple models into a unique, much better model than any of the individual input models. You can also combine models specialized in different tasks and get a model with multiple abilities. This is the state of the art of productizing models. It's what Arcee.ai's platform does behind the scenes. Arcee collaborated with me on this post and is sponsoring it. There are three main steps to produce a model for your particular use case: 1. You create a dataset by uploading your data. 2. You train a model. At this step, Arcee uses Spectrum and Model Merging to produce a highly specialized model for your task. 3. You can deploy that model to any environment you want. Three important notes: • Training process is 2x faster and 2x cheaper than regular fine-tuning. • Resultant models are smaller and have higher accuracy. • They create these specialized models from open-source models. Check this site so you can fully appreciate how this works: If you want to fine-tune an open-source model, consider Arcee's platform. This is the state of the art.

Santiago

164,162 views • 2 years ago

New Course: Reinforcement Fine-Tuning LLMs with GRPO! Learn to use reinforcement learning to improve your LLM performance in this short course, built in collaboration with Predibase by Rubrik, and taught by Travis Addair, its Co-Founder and CTO, and Arnav Garg, its Senior Engineer and Machine Learning Lead. Reasoning models have been one of the most important developments in LLMs. Reinforcement Fine-Tuning (RFT) uses rewards to encourage LLMs to find solutions to multi-step reasoning tasks such as solving math problems and debugging code - without needing pre-existing training examples like in traditional supervised fine-tuning. Group Relative Policy Optimization (GRPO) is a reinforcement fine-tuning algorithm gaining rapid adoption. Developed by the DeepSeek team and used to train the R1 reasoning model, GRPO uses reward functions that you can write in Python to assign rewards to model responses. It’s beneficial for tasks with verifiable outcomes and can work well even with fewer than 100 training examples. It can also significantly improve the reasoning ability of smaller LLMs, making applications faster and more cost effective. In this course, you’ll take a technical deep dive into RFT with GRPO. You’ll learn to build reward functions that you can use in the GRPO training process to guide an LLM toward better performance on multi-step reasoning tasks. In detail, you’ll: - Learn when reinforcement fine-tuning is a better fit than supervised fine-tuning, especially for tasks involving multi-step reasoning or limited labeled data. - Understand how GRPO uses programmable reward functions as a more scalable alternative to the human feedback required for other reinforcement learning algorithms, such as RLHF and DPO. - Frame the Wordle game as a reinforcement fine-tuning problem and see how an LLM can learn to plan, analyze feedback, and improve its strategy over time. - Design reward functions that power the reinforcement fine-tuning process. - Learn techniques for evaluating more subjective tasks, such as rating the quality of a text summary, using an LLM as a judge. - Understand why reward hacking happens and how to avoid it by adding penalty functions to discourage undesirable behaviors. - Learn the four key components of the loss calculation in the GRPO algorithm: token probability distribution ratios, advantages, clipping, and KL-divergence. - Launch reinforcement fine-tuning jobs using Predibase’s hosted training services. By the end of this course, you’ll be able to build and fine-tune LLMs using reinforcement learning to improve reasoning without relying on large labeled datasets or subjective human feedback. Please sign up here:

Andrew Ng

86,672 views • 1 year ago

Final Lecture of our Statistical Mechanics Series. Lecture 2 showed how we move from the Full Phase-Space Density ρ(q₁, …, qₙ, p₁, …, pₙ, t) to smaller statistical objects by integrating out variables we do not want to keep. That gives reduced descriptions like the One-Particle Density f₁(q₁,p₁,t) and the Two-Particle Density f₂(q₁,p₁,q₂,p₂,t) This was the simplification. Now comes the catch. If the Full Density obeys Liouville’s Equation, the reduced densities do not evolve independently. The equation for one level depends on the next one and this is referred to as the BBGKY hierarchy. The One-Particle Density depends on the Two-Particle Density. The Two-Particle Density depends on the Three-Particle Density. And the chain keeps going. That happens because particles interact. Once one particle feels the rest, one-particle information is no longer enough. Correlations enter, and the lower level is fed from above. If the full Hamiltonian is H = Σᵢ pᵢ²/(2m) + Σᵢ U(qᵢ) + (1/2) Σᵢ Σⱼ≠ᵢ Φ(qᵢ − qⱼ) then reducing the full density does not make the interaction terms disappear. It leaves behind coupling to higher-order reduced densities. So, schematically, ∂f₁/∂t + transport of one particle = interaction term involving f₂ and more generally the heirarchy is such that ∂fₛ/∂t + s-particle transport = interaction term involving fₛ₊₁ Therefore, Lecture 3 is really about the price of reduction. We simplify the description, but the information we remove comes back as coupling to higher-order correlations. So, how do you actually compute anything if every level depends on the next one? This is the so-called Closure Problem. To make the hierarchy usable, you need an extra assumption that cuts the chain. You replace the exact higher-order object by an approximation in terms of lower-order ones. The most basic example is a factorized closure at the pair level, where the exact correlated Two-Particle Density is replaced schematically by a product of One-Particle Densities: f₂(q₁,p₁,q₂,p₂,t) ≈ f₁(q₁,p₁,t) f₁(q₂,p₂,t) That approximation is not exact. It throws away part of the correlation structure. But it gives you something the raw hierarchy does not... a closed equation for the lower-level description. That is why closure matters so much. Without it, the hierarchy is exact but open. With it, the theory becomes approximate but usable. Thus, the combined point of this final Statistical Mechanics post is simple. First, reduced descriptions are not closed because interactions generate correlations across levels. Second, if you want a workable Kinetic Theory, you must close the hierarchy by approximating those higher-order correlations. It is the bridge from formal many-body mechanics to equations people can actually solve. In the render, that is exactly the story you are seeing. The first part shows the hierarchy itself: one reduced level feeding the next, with lower descriptions inheriting structure from higher ones. The second part shows the closure step where the exact correlated pair level is replaced by a factorized ansatz, and that approximation gives back a closed one-particle description. That is, the animation moves from dependence to approximation, and from approximation to solvability. #StatisticalMechanics #BBGKY #ClosureProblem #KineticTheory #PhaseSpace #ReducedDistribution #HamiltonianMechanics #MathematicalPhysics #Mathematics #Physics

Mathelirium

10,970 views • 4 months ago