Skip to main content

Lora

 LoRA Adapters are, to me, one of the smartest strategies used in Machine Learning in recent years! It is one of those things where I think, "Wait! How didn't we think about that before?"


LoRA adapters came as a very natural strategy for fine-tuning models. The idea is to realize that any matrix of model parameters in a neural network of a trained model is just a sum of the initial values and the following gradient descent updates learned on the training data mini-batches:


𝜃(trained model) = 𝜃(initial value) + gradient descent updates


From there, we can understand a fine-tuned model as a set of model parameters where we continued to aggregate the gradients further on some specialized dataset:


𝜃(fine-tuned) = 𝜃(trained model) + more gradient descent updates


When we realize that we can decompose the pretraining learning and the fine-tuning learning into those 2 terms:


𝜃(fine-tuned) = 𝜃(trained model) + ΔW


then we understand that we don't need that decomposition to happen into the same matrix; we could sum the output of 2 different matrices instead. That is the idea behind LoRA: we allocate new weight parameters that will specialize in learning the fine-tuning data, and we freeze the original weights. 


As such, it is not very interesting because new matrices of model parameters would just double the required memory allocated to the model. So, the trick is to use a low-rank matrix approximation to reduce the number of operations and required memory. We introduce 2 new matrices A and B to approximate ΔW:


ΔW ~ BA


It is important to realize that, typically, the amount of training data used for fine-tuning is much smaller than the data used for pretraining. As a consequence, it is unlikely that we could even have enough data to get good statistical convergence on the full matrix ΔW. The low-rank approximation acts as a regularization technique that will help the model generalize better on unseen data.


--


👉 Learn more about ML in my newsletter https://newsletter.TheAiEdge.io


--


Comments

Popular posts from this blog

Python Road map

 

Job site

 1. FlexJobs https://www.flexjobs.com 2. We Work Remotely https://weworkremotely.com 3. Remote.co https://remote.co 4. Remotive https://remotive.io 5. Indeed Remote Jobs https://www.indeed.com/q-Remote-jobs.html 6. LinkedIn Jobs https://www.linkedin.com/jobs 7. Glassdoor https://www.glassdoor.com/ 8. AngelList https://angel.co/jobs 9. Virtual Vocations https://www.virtualvocations.com 10. SkipTheDrive https://www.skipthedrive.com 11. Remote OK https://remoteok.io 12. Working Nomads https://www.workingnomads.co/jobs 13. Jobspresso https://jobspresso.co 14. Upwork https://www.upwork.com 15. Freelancer https://www.freelancer.com 16. Guru https://www.guru.com 17. PeoplePerHour https://www.peopleperhour.com 18. Fiverr https://www.fiverr.com 19. Toptal https://www.toptal.com 20. Dribbble Jobs https://dribbble.com/jobs 21. Behance Jobs https://www.behance.net/joblist 22. Stack Overflow Jobs https://stackoverflow.com/jobs 23. CyberCoders https://www.cybercoders.com 26. ZipRecruiter https:/...

Freelancing site

 Stop believing you can't land a remote job because you are not a U.S. citizen  Here are 30 sites to land a remote job that pays in USD worldwide: People Are Getting Paid in Dollars.Tap into 30 remote job websites and start cashing in. 1. Upwork – A massive freelance marketplace for writers, designers, developers, marketers, and more. https://www.upwork.com 2. Fiverr – Sell microservices starting at $5. Great for creatives, voiceovers, writing, and marketing. https://www.fiverr.com 3. Toptal – Premium platform for top freelancers in tech, design, and finance. Rigorously vetted. https://www.toptal.com 4. FlexJobs – Curated, scam-free listings of remote and flexible jobs across all industries. https://www.flexjobs.com 5. We Work Remotely – High-quality remote job board for devs, marketers, writers, and customer support. https://weworkremotely.com 6. Remote OK – Remote job listings for tech, design, marketing, and customer success. https://remoteok.com 7. PeoplePerHour – Connects...