PEFT LoRA Explained in Detail - Fine-Tune your LLM on your local GPU

Поделиться
HTML-код
  • Опубликовано: 19 дек 2024

Комментарии •

  • @Blessed-by-walking-show
    @Blessed-by-walking-show Год назад +11

    Most underrated channel on YT. Deserves a million subs. Thanks.

  • @Shionita
    @Shionita Год назад +1

    I'm having so many flashbacks from my PCA classes😅, you explain much better than my teacher btw...

  • @jett_royce
    @jett_royce 7 месяцев назад +1

    Great video that doesn't hand-wave away the mathematical and implementation details. Exactly the kind of content I love. Thank you!

  • @ad_academy
    @ad_academy 10 месяцев назад

    BEST video on PEFT and LORA..I was not able to undertsand the concepts from other videos, by searching more on YT I land up on this video and I understood whole concepts. JUST AWESOMEEEEEEE..

  • @uraskarg710
    @uraskarg710 Год назад

    Best video and explanation on LoRA, thank you for your efforts!

  • @suryanshsinghrawat961
    @suryanshsinghrawat961 Год назад

    Best video on LORA ever! Simply can't get better than this 🏆

    • @code4AI
      @code4AI  Год назад

      My subscriber are the best!

  • @ruchaapte5124
    @ruchaapte5124 5 месяцев назад

    Superb video :) Very clear and concise explanation. Thank you.

    • @code4AI
      @code4AI  5 месяцев назад

      Thank you for this comment. Appreciate it if people take time for a feedback.

  • @changtimwu
    @changtimwu Год назад

    Thank you for explaining. I previously believed that LoRa was a stable diffusion generating beauty,

  • @SandeepGupta1304
    @SandeepGupta1304 Год назад

    This is really awesome... you nailed it. Such explanation can only come from deep understanding. Thank you very much..

  • @sk8l8now
    @sk8l8now Год назад +21

    It doesn't get better than this ❤

  • @bhavulgauri7832
    @bhavulgauri7832 Год назад +3

    This is so well done. You inspired me to create similar content as well. Hats off!

  • @ianmatejka3533
    @ianmatejka3533 Год назад +7

    Outstanding video, the best one I have seen on LoRA!
    I have one question about the SVD decomposition procedure:
    A full fine tune of a large model such as LLaMa would require loading the entire model tensors onto the GPU and adjusting them by delta(phi) for all the parameters.
    In LoRA, delta(phi) is replaced with 2 smaller SVD matrices that are trained and then multiplied back into the full size and added to the original parameters.
    My question is this.
    When you generate the 2 smaller SVD matrices, you still need to load in the full size tensor to then decompose. In PEFT, are the 2 SVD matrices calculated once at the beginning for all the different tensors before fine tuning occurs? Also how is it possible to backpropagate through the 2 smaller matrices without combining them back together on the GPU?

    • @pumplove81
      @pumplove81 Год назад +5

      very thoughtful query.. forced me to read the paper :) .. basically you are right about loading the initial full sized matrices but then they are frozen for the rest of the fine tuning process and then the lower ranked / decomposed matrices kick in ..they DO NOT need to be recombined since the idea is NOT to create an exact replica of the information contained in the pre trained model. All we need is a close approximation which is provided by combining these 2 lower ranked johnnies ( U multiplied with top N ranked singular values AND Vt mult with top N ranked sv's)..and since they are both trainable , these are the weights that will then be used. So during inference, you will have the impact of both the pre trained LLM / LM and then the task specific representations of the LoRA ..this is what i have understood ..if there's a fallacy here, please do point out .. i love to be wrong ..helps better learnin

    • @auresdz701
      @auresdz701 10 месяцев назад

      @@pumplove81 Anyways we need to do feed-forward through the original model + BA. Maybe we will just have a gain not to store a lot of gradients during backprop.

  • @ricosrealm
    @ricosrealm Год назад

    Superb video. Excellent presentation of all the concepts and easy to understand. You have a great teaching style sir.

  • @steventan8416
    @steventan8416 Год назад

    very clear explaination on low-rank and LLM

  • @JuanUys
    @JuanUys Год назад

    I'm currently looking for a resource on how to pick `modules_to_save` for LoraConfig (and perhaps the other values too, although those just seem like accuracy trade-offs too). Will update here if I can answer my own question.

  • @R8man012
    @R8man012 4 месяца назад

    According to the study in the video, does Lora really achieve better results than full fine tuning of all parameters of the entire model? Does this mean that it is not only less demanding on computing resources, but also has better performance?

  • @Rise2Excel-wi3gy
    @Rise2Excel-wi3gy 9 месяцев назад

    Top notch explanation 💯🔥

  • @ArgenisLeon
    @ArgenisLeon Год назад

    This is Gold. Thanks for this amazing content.

    • @code4AI
      @code4AI  Год назад

      Great feedback. Thanks.

  • @ekbastu
    @ekbastu Год назад

    Subscribed!
    Champion explanation. Thank you

  • @BradleyKieser
    @BradleyKieser Год назад +2

    Absolutely brilliantly explained. Love this guy's style of teaching and his casual humour. Do we have to drop to int8 for PEFT?

  • @ko-Daegu
    @ko-Daegu Год назад

    what tool r u using for the presentation i love the smooth transitions

  • @wobblynl1742
    @wobblynl1742 Год назад

    Dude your explanations are 💯👌

  • @debashisghosh3133
    @debashisghosh3133 Год назад +3

    Beautiful...Beautiful...

    • @code4AI
      @code4AI  Год назад

      Appreciate your positive feedback! Thank you!

  • @Philip8888888
    @Philip8888888 Год назад

    This was an amazing explanation. Thank you.

  • @paturibharath7948
    @paturibharath7948 Год назад

    outstanding video. Brilliantly explained complex topics.. I have one question, Can we do Lora to multi modal architectures like Donut which is a combination of Swing transformer + Bard ? Any pointers to do this

    • @code4AI
      @code4AI  Год назад

      If you have access to Bard, to inject additional tensors, and then fine-tune Bard, on its compute infrastructure, you work for Google and know the answer to your question.

  • @johnosborne6175
    @johnosborne6175 Год назад +1

    Great presentation! A nomenclature question for you, in Figure 1 in the LoRA paper they have "B=0" and "A=Nu(0,sigma^2). I'm not sure how that relates to the description of A and B, can you give any insight?

    • @johnosborne6175
      @johnosborne6175 Год назад +1

      I'll answer my own question - it looks like the Figure 1 is just showing initialization. I had forgotten that N is the symbol for the Gaussian distribution, so it is just saying they are initializing A with a Gaussian distribution with a mean of 0 and initialization B = 0 since the initial delta for weights is zero at the start of training.

  • @wilfredomartel7781
    @wilfredomartel7781 Год назад

    Reaaallly amazing explanation👏👏👏

  • @proterotype
    @proterotype 10 месяцев назад

    Dude, you’re like a gift

  • @davidromero1373
    @davidromero1373 Год назад

    Hi a question, can we use lora to just reduce the size of a model and run inference, or we have to train it always?

  • @auresdz701
    @auresdz701 10 месяцев назад

    I still do not understand how LORA preserves previous information of the original dataset? Lets say our base model is a bert trained on wikipedia, when using LORA, lets consider the first block of attention, we feed forward the input features to the original weights and to the BA matrix, then we add the two results. In this way the next layer inputs are changed whereas the weights in the next layers expects something else. I still don't get it.

  • @aurko-c1d
    @aurko-c1d Год назад

    Every matrix can be represented as a product of matrices BA. Could this be used to compress models?

    • @krittaprottangkittikun4190
      @krittaprottangkittikun4190 11 месяцев назад +1

      Just my guess, I think you might be able to compress the models for storage but when you actually want to do inference you need to decompress it before use.

  • @gurudevilangovan
    @gurudevilangovan Год назад

    Thank you for the amazing video!

  • @cedricmanouan2333
    @cedricmanouan2333 Год назад

    Just Wow !!!
    This is a great video!

  • @siyuanma2323
    @siyuanma2323 Год назад +2

    Some hidden gem!

  • @gossipGirlMegan
    @gossipGirlMegan Год назад

    Love the speed of explaination!
    Clean and accurate!

  • @akashbhandari867
    @akashbhandari867 Год назад

    Great video again sir.
    I need some guidance from you.
    Let's say i have a very large text lines those are belongs to doctor's CMS dataset, their publication and clinical trials.
    I want to train a pretrained model with thses datasets.
    After request questions would looks like: who is the best urologist at New York?
    Can you guide to take a correct path to achieve this.
    Like with language model should I pick to fine tune on my data.
    My previous experience:
    1. Langchain interface, llm=openAI and chromadb.
    Result are too good but openai is not a open source.
    2. Same as above but this time i used llm = Dolly 2.0 12b/7b model. Result's are not accurate. They even can't count the number of paper published by doctor.
    So now I want to fine tune a pretrained model with my data.
    Can you suggest me how can achieve this.
    Or any better approach?

  • @hughding7433
    @hughding7433 Год назад

    讲得非常好,awesome impressive!

  • @avinashkaur1406
    @avinashkaur1406 Год назад

    Such great content! Is it possible to get the slides? Thanks!

  • @mohamedahmed-fn8qb
    @mohamedahmed-fn8qb Год назад +1

    Amazing explaining ❤️

  • @faisalq4092
    @faisalq4092 Год назад

    does it work on models i trained using tf? or just the models imported from the hugging face library?

  • @KA-kp1me
    @KA-kp1me Год назад

    hmm, so assuming I have a model X with multiple lora adapters trained on specific tasks. Is it possible to merge all those adapters back to single model? Just curious :)

  • @jakeh1829
    @jakeh1829 Год назад

    Hi boss, I have a question: If I finetune 4 LoRA models based on an LLM (e.g. Llama13b), each LoRA trained on a specific task. Can I deploy all the 5 models on the same GPU (includes the parameters of 4 LoRAs and the base model)? For example, let's suppose each adapter takes 0.5GB vram and the base model takes 26GB vram on the GPU; is it possible to deploy all sets of LoRAs and the base model on the same GPU with the usage of 28GB? (26+0.5*4=28GB)

    • @jaskiratsinghsodhi
      @jaskiratsinghsodhi Год назад

      The deployment framework needs to provide this support. technically saying this should be possible if the architecture supports switching instead of just sequentially calculating
      Not sure if such support exists in any framework. But then again I don't have knowledge of all frameworks.

  • @xidian2008
    @xidian2008 Год назад

    where can I download the PPTs

  • @BlueDopamine
    @BlueDopamine Год назад

    Nice Explanation Very Good

  • @toromanow
    @toromanow 11 месяцев назад

    Wunderbar. Vielen Dank.

  • @YiyunZhou-w4f
    @YiyunZhou-w4f Год назад +1

    Amazing explanation!!!!

    • @code4AI
      @code4AI  Год назад

      Glad you think so!

  • @chia-hsuanchang6609
    @chia-hsuanchang6609 Год назад

    Wonderful explanation!

  • @sayhellojoel
    @sayhellojoel Год назад

    Thanks for the great video! Is OpenAI using adapters or a similar technology for the fine-tuning they offer on GPT-3 base models?

    • @code4AI
      @code4AI  Год назад

      I have not seen any official documentation by the company about this ...

    • @digitalsoultech
      @digitalsoultech Год назад

      Open AI are not releasing how they are trained the AI

  • @GauravVirmani-d6t
    @GauravVirmani-d6t Год назад

    Absolute gem

  • @EkShunya
    @EkShunya Год назад

    WoW everytime, thank you

    • @code4AI
      @code4AI  Год назад

      Thank you for this feedback.

  • @oorcinus
    @oorcinus Год назад

    Quantification and quantization are two very different things.

    • @code4AI
      @code4AI  Год назад +1

      Quantization is the mapping of a k-bit integer to a real element in Domain D, or
      (1) Compute a normalization constant N that transforms the input tensor T into the range of the domain D of the target quantization data type Q, (2) for each element of T/N find the closest corresponding value q(i) in the domain D, (3) store the index i corresponding to q(i) in the quantized output tensor T(Q). That is so easy in information theory, that when I compare it to real physics, I smile and think of it as a singular quantification problem. And beliefs manifest themselves in language. Good point!

    • @oorcinus
      @oorcinus Год назад

      @@code4AI Well, FWIW, quantization sort of just happens in real physics, if you go far enough ;)

  • @snehotoshbanerjee1938
    @snehotoshbanerjee1938 Год назад

    Fantastic!!

  • @echofloripa
    @echofloripa Год назад

    You lost me at the linear algebra, I decided I will abstract that part 🤣

  • @riser9644
    @riser9644 Год назад

    Wow awesome videos ❤

  • @sourabharsh16
    @sourabharsh16 Год назад

    very well explained.

    • @code4AI
      @code4AI  Год назад

      Thank you for your feedback!

  • @supriyochakrabortybme
    @supriyochakrabortybme Год назад

    Thank You

    • @code4AI
      @code4AI  Год назад

      You are welcome.

  • @mohit0901
    @mohit0901 10 месяцев назад

    NICE !!!

  • @alealejandroooooo
    @alealejandroooooo Год назад

    Subscribed.

  • @666kaotik666
    @666kaotik666 Год назад

    kudos

  • @TL-fe9si
    @TL-fe9si Год назад

    Comment for the algorithm👏

  • @dyjiang1350
    @dyjiang1350 Год назад

    You spend a lot of time talk about SVD, how does it related to LoRA, does Lora use SVD in it algorithm?

    • @jaskiratsinghsodhi
      @jaskiratsinghsodhi Год назад

      Thats what he tried to show as far as I understood, the equations for decomposition are the same.

  • @efexzium
    @efexzium Год назад

    letters and voice is one of the best ways to confuse an audience. There is plenty of studies that prove this the brain can only do one thing at a time.

  • @keshav2136
    @keshav2136 Год назад

    👍🏻

  • @fire17102
    @fire17102 Год назад +2

    First 🦄