HackerTrans
TopNewTrendsCommentsPastAskShowJobs

rasbt

no profile record

Submissions

Show HN: New LLM Pre-Training and Post-Training Paradigms

sebastianraschka.com
2 points·by rasbt·2 года назад·0 comments

[untitled]

1 points·by rasbt·2 года назад·0 comments

[untitled]

1 points·by rasbt·2 года назад·0 comments

Developing an LLM: Building, Training, Finetuning (A 1h Video Explainer)

youtube.com
43 points·by rasbt·2 года назад·12 comments

Evaluating LLMs locally, on a laptop, with Llama 3 and Ollama

github.com
2 points·by rasbt·2 года назад·0 comments

Understanding the LLM Development Cycle: Building, Training, Finetuning

magazine.sebastianraschka.com
3 points·by rasbt·2 года назад·0 comments

The latest major open LLM releases: Mixtral, Llama 3, Phi-3, and OpenELM

magazine.sebastianraschka.com
5 points·by rasbt·2 года назад·0 comments

Finetuning an LLM-Based Spam Classifier with LoRA from Scratch

github.com
14 points·by rasbt·2 года назад·0 comments

Finetune a GPT Model for Spam Detection on Your Laptop in Just 5 Minutes

github.com
3 points·by rasbt·2 года назад·0 comments

Insights from Finetuning LLMs for Classification Tasks

github.com
2 points·by rasbt·2 года назад·0 comments

Tips for LLM Pretraining and Evaluating Reward Models

sebastianraschka.com
2 points·by rasbt·2 года назад·0 comments

Comparing 5 ways to implement Multihead Attention in PyTorch

github.com
3 points·by rasbt·2 года назад·0 comments

AI Research in Feb 2024 – LoRA Successor, "Small" LLMs, Transparent LLM Research

sebastianraschka.com
3 points·by rasbt·2 года назад·0 comments

Understanding, using, and finetuning Gemma

lightning.ai
118 points·by rasbt·2 года назад·48 comments

Implementing Weight-Decomposed Low-Rank Adaptation (DoRA) from Scratch

magazine.sebastianraschka.com
96 points·by rasbt·2 года назад·10 comments

AI Research Papers in Jan 2024: Model Merging, Mixtures of Experts, Smaller LLMs

magazine.sebastianraschka.com
20 points·by rasbt·2 года назад·0 comments

Implementing a ChatGPT-like LLM from scratch, step by step

github.com
739 points·by rasbt·2 года назад·98 comments

LoRA from scratch: implementation for LLM finetuning

lightning.ai
339 points·by rasbt·2 года назад·78 comments

Coding Self-Attention, Multi-Head Attention, Cross-Attention, Causal-Attention

magazine.sebastianraschka.com
142 points·by rasbt·3 года назад·11 comments

Noteworthy AI Research Papers of 2023

magazine.sebastianraschka.com
3 points·by rasbt·3 года назад·0 comments

comments

rasbt
·2 года назад·discuss
Thanks for sharing!
rasbt
·2 года назад·discuss
I disagree here: Setting up a large-scale pretraining run is super complex if you have to manage your distributed computing platform, but looking at how the training data looks like and is fed into an LLM is not that complex. If you are developing a product based on or with LLMs, it's worth spending a few hours to understand it on the big-picture level. I mean, look at how many people are confused why LLMs a) hallucinate facts, b) sometimes copy text passages verbatim, c) why they probably shouldn't be used as scientific calculators etc. All that could be much more clear if you know how they are trained.
rasbt
·2 года назад·discuss
Agreed, understanding how a method works and how it would be done helps with developing an intuition for its limitations -- what it can and what it can't do
rasbt
·2 года назад·discuss
thanks for mentioning, that makes me super happy to hear!
rasbt
·2 года назад·discuss
I wouldn't pretrain from scratch, but continued pretraining is pretty popular for adapating LLMs to recent and/or custom data. (Sometimes this is referred to 'finetuning', however, not to be confused with 'instruction finetuning').
rasbt
·2 года назад·discuss
Thanks, glad that this is helpful!
rasbt
·2 года назад·discuss
Quoting from the readme, it embraces other executers, including torch.compile and also works with multiple GPUs:

> Thunder is a source-to-source compiler for PyTorch. It makes PyTorch programs faster by combining and using different hardware executors at once (ie: nvFuser, torch.compile, cuDNN, and TransformerEngine FP8).

Works on single accelerators and in multi-GPU settings. Thunder aims to be usable, understandable, and extensible.
rasbt
·2 года назад·discuss
Yes, it's somewhat similar to the 2B model as it uses the same vocabulary size.
rasbt
·2 года назад·discuss
Yes, it's definitely unfair to count it as a 7B model. In that case, we could call Llama 2, which is 6.6B parameters, a 6B (or even 5B) parameter model.
rasbt
·2 года назад·discuss
Yes, it's 8.5B params if you account for weight tying, and 9.3B if you count the embedding layer and output layer weights separately as shown in the 2nd figure in the article. In the paper, I think they justified 7B by only counting the non-embedding parameters (7,751,248,896), which is kind of cheating in my opinion, because if you do that, then Llama 2 is basically a 5B-6B param model.
rasbt
·2 года назад·discuss
> Gemma is a +9B model

Yes that's correct. It's 9.3B parameters if you count the embedding layer and final projection layer separately. However, since they used weight tying, the adjusted count is 8.5B as discussed in the article.
rasbt
·2 года назад·discuss
Thanks for the feedback. Clarifying definitely wouldn't hurt. Added a paragraph and new figure at the top of the DoRA section: https://magazine.sebastianraschka.com/i/141797214/introducin...

I haven't tried what you were suggesting, but that sounds actually plausible. Interesting idea!
rasbt
·2 года назад·discuss
Not sure, but in general, it looks like ZipLoRA is only useful in specific contexts like when you have two different tasks you want to optimize for (like style and content in a vision context). DoRA is more general, it's basically normalizing and scaling the LoRA matrices to get much better performance. According to the paper, it even works great for low ranks, which also effectively makes it even more parameter-efficient than OG LoRA.
rasbt
·2 года назад·discuss
Thanks, fixed!
rasbt
·2 года назад·discuss
thanks for the kind words!
rasbt
·2 года назад·discuss
I'd say that I've finished all of my previous books, and I have no intention of doing anything different here. Of course, there's always the chance that I get run over by a bus or equivalent, but in that case, I assume that Manning would find a replacement (as per contract) who finishes the book. I don't think there are any benefits to be reaped from not finishing.
rasbt
·2 года назад·discuss
That's a good point. I may briefly mention RAG-like systems and add some literature references on this, but I am bit hesitant to give general advice because it's heavily project-dependent in my opinion. It usually also comes down in what form the client has the data and whether referencing from a database or documentation is desired or not. The focus of chapter 6+7 is also instruction-finetuning and alignment rather than finetuning for knowledge. The latter goal is best achieved done via pretraining (as opposed to finetuning) imho. In any case, I just read this interesting case study last week on Finetuning vs RAG that might come in handy: "RAG vs Fine-tuning: Pipelines, Tradeoffs, and a Case Study on Agriculture" (https://arxiv.org/abs/2401.08406)
rasbt
·2 года назад·discuss
This is a good point. It's currently not in the TOC, but I may add this as supplementary text.
rasbt
·2 года назад·discuss
Unfortunately, I am not aware of any other resource that delves into these topics. However, as others commented above, Karpathy has a 2h YouTube video that is probably worthwhile watching. Based on skimming the YT video, it has some overlap with chapters 3 & 4, but the book has a much larger scope.

I am not sure how to link to other comments on HN, so let me just copy & paste it here:

> How does this compare to the karpathy video [0]? I'm trying to get into LLMs and am trying to figure out what the best resource to get that level of understanding would be. [0] https://www.youtube.com/watch?v=kCc8FmEb1nY

> Haven't fully watched this but from a brief skimming, here are some differences that the book has: - it implements a real word-level LLM instead of a character-level LLM - after pretraining also shows how to load pretrained weights - instruction-finetune that LLM after pretraining - code the alignment process for the instruction-finetuned LLM - also show how to finetune the LLM for classification tasks - the book it overall has a lots of figures. For Chapter 3, there are 26 figures alone :) The video looks awesome though. I think it's probably a great complementary resource to get a good solid intro because it's just 2 hours. I think reading the book will probably be more like 10 times that time investment.
rasbt
·2 года назад·discuss
The attention mechanism we implement in this book* is specific to LLMs in terms of the text inputs, but it's fundamentally the same attention mechanism that is used in vision transformers. The only difference is that in LLMs, you turn text into tokens, and convert these tokens into vector embeddings that go into an LLM. In vision transformers, instead of regarding images as tokens, you use an image patch as a token and turn those into vector embeddings (a bit hard to explain without visuals here). In both text or vision context, it's the same attention mechanism, and it both cases it receives vector embeddings.

(*Chapter 3, already submitted last week and should be online in the MEAP soon, in the meantime the code along with the notes is also available here: https://github.com/rasbt/LLMs-from-scratch/blob/main/ch03/01...)