Inside the LLM: Visualizing the Embeddings Layer of Mistral-7B and Gemma-2B

  Рет қаралды 5,323

Chris Hay

Chris Hay

3 ай бұрын

We look deep into the AI and look at how the embeddings layer of a Large Language Model such as Mistral-7B and Gemma-2B actually works.
You will learn how tokens and embeddings work and even extract out and load the embeddings layer from Gemma and Mistral into your own simple model, which we will use to visualize the model
You will see how an AI clusters terms together and how it can cluster similar words, build connections which cover not just similar words but also grouping of concepts such as colors, hotel chains, programming terms.
If you really want to understand how an LLM's works or even build your own LLM then starting with the first layer of a Generative AI model is the best place to start.
Github
-----------
github.com/chrishayuk/embeddings

Пікірлер: 32
@chrishayuk
@chrishayuk 3 ай бұрын
this is the github repo: github.com/chrishayuk/embeddings
@guaranamedia
@guaranamedia 2 күн бұрын
Excellent explanation. Thanks for making these examples.
@NERDDISCO
@NERDDISCO 3 ай бұрын
This came to the absolute right time! Thank you very much! I was just trying to understand this. Now I know how it works ❤
@chrishayuk
@chrishayuk 3 ай бұрын
Glad it was helpful!
@rajneesh31
@rajneesh31 10 күн бұрын
Damn, thank you KZfaq for recommending this channel. @chrishayuk is a gun. Thanks Chris
@chrishayuk
@chrishayuk 3 күн бұрын
Very kind, glad you like the channel
@sumandawnmobile
@sumandawnmobile 3 ай бұрын
Its an great video to understand the internals via the visualization. Thanks Chris.
@scitechtalktv9742
@scitechtalktv9742 2 ай бұрын
Fantastic video ! I am wondering: I think it would also be very interesting to also be able have a visualization of not only the static embeddings you already did, but also a visualization of the so-called contextualized embeddings in a later layer of the model! These are the embeddings that are exposed to the attention mechanism. That why they are also called dynamic embeddings. It adds another layer of abstraction, but are better embeddings because they are able to distinguish between homonyms: words that are the same but have completely other meanings if used in another context. A good example is the word “bank”, that has several different meanings when used in another context (for example financial institution or river bank and several other meanings! ). As a consequence the word “bank” will be represented by several different vectors in embedding space, depending on the context it is used in! This technique is called Word Sense Disambiguation (WSD). Would it be possible to visualize that too? I am curious….
@chrishayuk
@chrishayuk 2 ай бұрын
yep, you got what i'm doing... i'm literally walking the stack
@chrishayuk
@chrishayuk 2 ай бұрын
so those videos will be coming
@scitechtalktv9742
@scitechtalktv9742 2 ай бұрын
@@chrishayukFantastic ! Those embeddings are crucially important for the workings of Large Language Models !
@johntdavies
@johntdavies 3 ай бұрын
Great insight, thanks for posting this. It would be interesting to show how a fine-tuned model differs in similarities and "vocabulary". I'm also curious on the effects of quantisation, i.e. Q4, Q6, Q8, fp16 etc. on the internal "workings" of the LLM. Thanks again.
@chrishayuk
@chrishayuk 3 ай бұрын
It’s almost like you’re reading my roadmap
@kenchang3456
@kenchang3456 3 ай бұрын
Thanks the visualization really helped me.
@chrishayuk
@chrishayuk 3 ай бұрын
so glad, seeing it at a lower level really demystifies what's going on
@andypai
@andypai 2 ай бұрын
Thank you! Great video!
@chrishayuk
@chrishayuk 23 күн бұрын
thank you, glad it was useful
@khalilbenzineb
@khalilbenzineb 3 ай бұрын
I was playing a bit with finetuning to force an output schema for some 7B Models, but lately I discovered schema grammar, which is a way to dynamically play with the EOS tokens, by limiting them to a specific set of tokens, to generate the output you want, This is very stable and way efficient for many cases that we may think it requires finetuning, For me it felt like a new dimension to get the model intentions inline, I loved the unique and efficient way you create your videos, So I wanted to ask you if possible to create a video for us about this, I feel it's very important
@chrishayuk
@chrishayuk 3 ай бұрын
that's a good shout
@khalilbenzineb
@khalilbenzineb 3 ай бұрын
Thx@@chrishayuk
@Memes_uploader
@Memes_uploader 3 ай бұрын
Thank you so much! Thank you youtube algorithm for showing such a great video!
@chrishayuk
@chrishayuk 3 ай бұрын
Glad you enjoyed it!
@gregherringer7700
@gregherringer7700 3 ай бұрын
This helps thanks!
@chrishayuk
@chrishayuk 3 ай бұрын
Glad it helped! :)
@lfzuniga31
@lfzuniga31 3 ай бұрын
based
@enlightenment5d
@enlightenment5d 2 ай бұрын
Good! Where can I find your programs?
@chrishayuk
@chrishayuk 23 күн бұрын
in my github repo github.com/chrishayuk
What is Retrieval Augmented Generation (RAG) and JinaAI?
37:12
Miracle Doctor Saves Blind Girl ❤️
00:59
Alan Chikin Chow
Рет қаралды 76 МЛН
Increíble final 😱
00:37
Juan De Dios Pantoja 2
Рет қаралды 22 МЛН
How to bring sweets anywhere 😋🍰🍫
00:32
TooTool
Рет қаралды 28 МЛН
They RUINED Everything! 😢
00:31
Carter Sharer
Рет қаралды 23 МЛН
GraphRAG: LLM-Derived Knowledge Graphs for RAG
15:40
Alex Chao
Рет қаралды 69 М.
GraphRAG: Knowledge Graphs for AI Applications with Kirk Marple - 681
46:53
The TWIML AI Podcast with Sam Charrington
Рет қаралды 2,8 М.
How much faster has Mojo's dictionary gotten?
7:40
EKB PhD
Рет қаралды 370
The Most Important Algorithm in Machine Learning
40:08
Artem Kirsanov
Рет қаралды 256 М.
Generative AI in a Nutshell - how to survive and thrive in the age of AI
17:57
Semantic Chunking for RAG
29:56
James Briggs
Рет қаралды 16 М.
The Attention Mechanism in Large Language Models
21:02
Serrano.Academy
Рет қаралды 79 М.
RAG from the Ground Up with Python and Ollama
15:32
Decoder
Рет қаралды 22 М.
Ollama 0.1.26 Makes Embedding 100x Better
8:17
Matt Williams
Рет қаралды 42 М.
МОЩНЕЕ ТВОЕГО ПК - iPad Pro M4 (feat. Brickspacer)
28:01
ЗЕ МАККЕРС
Рет қаралды 44 М.
КОПИМ НА АЙФОН В ТГК АРСЕНИЙ СЭДГАПП🛒
0:59
Carregando telefone com carregador cortado
1:01
Andcarli
Рет қаралды 2,5 МЛН
Iphone or nokia
0:15
rishton vines😇
Рет қаралды 1,5 МЛН