Floating Points are no more, Changes everything for LLMs!!!

1littlecoder · Intermediate ·🧠 Large Language Models ·2y ago

Key Takeaways

The video discusses the shift from floating points to 1-bit LLMs, and its potential implications for AI development

Full Transcript

This changes everything in the LLM world. LLM that stands for large language model are basically deep learning models. Deep learning models are deep neural networks. We have got multiple neural networks that deeply stacked together and that gives you a final output. But how does it give you a final output? These deep neural networks have got weights and these weights are multiplied like a matrix multiplication that happens at highly computational high performance computing environment and that is how you get these deep neural networks working. And this is one of the reason why people are using GPUs, especially Nvidia GPUs, because Nvidia GPUs have got CUDA and that supports this high performance matrix multiplication. But imagine a world where you don't need GPU, where you don't need high performance matrix multiplication. Is that even possible? And the answer to the question is it is possible. In fact, it is possible and also it is going to be as the same as the current large language models in performance and that is what the paper that we're going to discuss today is. The era of one-bit LLMs. All large language models are in 1.58 bits. I mean, the title might be a little confusing. Let me take you what the title is and what the paper is. First of all, if you see typically a large language model looks like this. It is either a 32-bit model or a 16-bit model. What does it mean? That means every single parameter of the model is represented as a 32-bit float or a 16-bit float. If you're not familiar with float, float is nothing but a decimal point value and integer is nothing but like a whole number with a positive or a negative sign. So, +1, -1, 0, um +2, +3, +4, this is all integers. 0.2345, 0.5678, 0.7013, these is all float and different floating points have different precision level. So, we either have a 32-bit floating point or a 16-bit floating point. And like this, we have a different precision. The current deep learning models, the current large language models look something like this. But what if or what they have done here is that they've taken this matrix multiplication or this matrix and transformed it into something like this. So, they have represented everything that you can into -1, 0, 1. And that is exactly what this BitNet B 1.58 model does. So, every single parameter on the model, instead of being represented as a 32-bit floating point or a 16-bit floating point, it represents it as a ternary value, 0, 1, -1. So, +1, 0, -1. And how did they get this idea? They got this idea not like it's not they did this the first another set of researchers from Microsoft. Maybe there is a good overlap between this and then they created something called a one-bit transformer. So, in the current paper that we are seeing that we have everything represented as +1, -1 and 0 instead of floating point values. But the previous paper, the one-bit transformer paper, what it did is that again from Microsoft and University of Chinese Academy of Sciences, they did everything to be either 1, +1 or -1. So, that is why it's called a one-bit transformer model or a one-bit weights. So, every parameter here was represented as one bit and in the new paper that we have got, every parameter is represented as +1, -1, 0. And that is why it is a 1.58 bit, not one bit, because we have added zero and they say that the zero addition of zero gives them more advantage in terms of learning capability. So, what is happening here? Simply, you have got a matrix like this. You have got another matrix like this. Typically in the current deep learning neural networks, what you need, you need matrix multiplication and you need addition. We call it a dot product. So, you multiply, add, multiply, add, multiply, add. So, that is what has been regularly happening. You can see here this one, the weights and the inputs are multiplied and then it is added. This is multiplied and then it is added. So, you can see the equation here. Y is equal to function of W and X. W is here weights, which is already part of the model. Input is what you give inside the model and that is how the calculation is done. So, if you need, I can provide additional study materials of the understand the deep learning is working here. But technically, you can see you've got model weight and then you have got input X. So, this is all here. Now, what is changing here is that instead of having the floating point value, you're going to have +1, -1, 0, the ternary values, which in this case is integers. That means you can just do addition and you can completely get away with multiplication. And the fact that you can get away with multiplication means like you you can like go you don't need multiplication. Maybe I said it wrong in English. You don't need multiplication. So, if you do away with I think I should say do away. If you do away with multiplication, that means you don't need a GPU kind of hardware. In fact, you can completely build a new kind of hardware, something like what Groq is doing. Um that's an example. I don't think Groq is doing exactly like this, but you can have a different kind of hardware that supports that is optimized that is highly optimized for this kind of calculation. See, how did GPU become so popular? GPUs were used by gamers, GPUs were used by miners, but GPU became really popular because of accelerated computing and somehow Jensen Huang actually hit a jackpot and a lottery that Nvidia GPUs that supported CUDA became the highly optimized place for deep learning, which is matrix multiplication. So, what this can provide is it can help you provide create a new hardware that does not require matrix multiplication. That means the innovation in the hardware side is there is a huge potential, there is a huge window of opportunity. Innovation in the software side, the optimization algorithm side is also huge and that is what this paper is proving. This paper is saying that once we have a BitNet architecture, which in this case is B 1.58, every single parameter or the weight in an LLM is defined as ternary, which is -1, 0, 1 and the accuracy, the performance matches the full precision FP16 floating point 16 or B floating point 16 transformer LLM. And with the same model size, like if you take a 7 billion parameter here, if you take a 7 billion parameter, if you take a 700 million parameter, if you take a 700 million parameter, one is BitNet, the other one is transformer, it has the same performance. While the performance is same, the biggest advantage comes in latency, how fast it can give you memory, how much memory it requires from the RAM and throughput, how many tokens it can generate per second and also most importantly the energy consumption, which would further reduce your cost in running this model. So, ultimately, more profoundly, the 1.58 bit LLM defines a completely new scaling law about how you can scale models and the new recipe for training new generations of LLMs that are both high performance and also cost-effective. And this can also give way for new hardware, which is what they're saying. So, I hope you understood this particular point. To quickly show you what they have done, they have taken like I said like they've taken all these things and rounded off their values and they made it like -1, 0, 1 and they have all the benefits of the previous paper that I mentioned, the one-bit transformer. I might cover this separately because I think there is a lot of useful information in this paper. I cannot believe that I missed this paper. This came on 17th October, but this this retains the architecture of that particular paper, like the one-bit BitNet. The only change it does is instead of two values, -1, 1, 1, which is a one-bit value, they've added a zero that makes it 1.58 bit and it gives you two advantages. One, it makes the feature filtering possible and also it makes the quality of the models to learn in terms of the perplexity, the metric used to measure whether the LLM can produce coherent text and also in the downstream task, like for example, question and answering, figuring out something, the end task, it also does a better performance, which we can see quickly. So, if you see, this is the model, the LLaMA LLM, LLaMA-based architecture large language model. They're not doing any transformer model. They're literally comparing it with LLaMA model and in fact, to make things equal, to make things as a fair play, what they have done is they have taken the model completely scratch trained it from scratch on a RedPajama dataset. So, they have tried to use similar amount of dataset, which is like the LLaMA dataset and they have compared it. So, if you compare the LLaMA LLM, the 700 million parameter, 1.3 billion parameter, 3 billion parameter model. So, on three different occasions, you can see the perplexity being almost equivalent. You can see perplexity, the lower the perplexity is better. So, perplexity being almost equivalent and in fact, the largest 3 billion parameter model, the perplexity is lower than LLaMA LLM. And I've always wondered, see, perplexity is good measure for next word prediction and that's not the only measure, because we these days want to use models for a lot of downstream task, like tasks like question and answering, text classification, text summarization and a lot of other things. So, they have also compared this with a bunch of metrics like HEL SWAG, ARC and all these like very popular metrics that people use for downstream task and you can see on an average I mean, you can look at individual numbers, but on an average, if you see the BitNet B 1.58 model, the 3 billion parameter model and the 3.9 billion parameter model, which is in the ballpark of 3 billion parameter model, scores above the equivalent LLaMA transformer model. See, this is still transformer. It's not like it's not a a transformer model. This is still a transformer model. The reason is if you go to the one-bit model, one thing that you would understand is what they have done is they have taken literally the transformer architecture, and in that transformer architecture, they have taken everything, and the only thing is they have used a bit net the bit linear instead of a conventional matrix multiplication. So, wherever you need matrix multiplication, they've used a bit linear there. Where you don't need matrix multiplication, you can just go away with the addition part. So, this is still a transformer. Llama is also still a transformer, but the way you represent the numbers inside the weights completely change and the way you do the calculation for, you know, finding out the deep learning part completely changes, and it scores good in perplexity. It scores good in the downstream tasks like ARC and LSAT. The biggest thing is it's not just the accuracy, the time it takes to produce the latency is improved, and you can see like there's 2.7x improvement, the 2.4 times improvement, and and the throughput, if you see, the throughput is like nine times huge. You can generate a 2,977 tokens per second for a 70 billion parameter model. This is way above what Grok is doing currently in production. And this does not require sophisticated, um, let's say, hardware, I guess. At least that's my understanding because this is you're a very simple, um, you don't need as a hardware like a GPU, but I think this gives a an immense boost in the throughput, the tokens per second thing. People are going bonkers and crazy for the 500, uh, tokens per second that Grok is giving for Mistral Mixtral 8x7 billion parameter model. This can give you 2,977, which is like nine times more than what is available here with this Llama based architecture model. I think this is this is huge. There are a lot more interesting details in this. I don't want to bore you with all the details, but this gives an enormous potential about where you can run the model, what hardware you can run the model like, for example, mobile, edge, uh, different type of hardware like I don't know if you have known seen that the BBC four-bit kit. So, I think the potential is immense, um, the way you can scale up the models, the the LLM scaling laws, the way you can run the model, the throughput. I think the game will completely change, and, uh, if more people build on top of it, that's one of the reason I've made this video. Let me know in the comment section what do you feel about this completely new direction of having one-bit or 1.58-bit LLMs. Just to give you a perception. So, let's say you have got 16-bit model, okay? You've got a 16-bit, uh, precision model LLM, and, if you have got a 4 billion parameter model, all the 4 billion parameters have to be represented in 16-bit floating-point values. That means whatever the 16 times hardware that you need, now you can reduce it a much simpler because you are in a 1.58-bit. So, there is a huge like 15, 14-ish times improvement, or let's say eight-ish time improvements that you are going to get simply by using an architecture like this. I think this is quite exciting to see what people are doing in this particular space, and I hope to cover more of this. See you in another video. Happy prompting.

Original Description

🔗 Links 🔗 The Era of 1-bit LLMs: All Large Language Models are in 1.58 Bits https://arxiv.org/pdf/2402.17764.pdf BitNet: Scaling 1-bit Transformers for Large Language Models https://arxiv.org/pdf/2310.11453.pdf ❤️ If you want to support the channel ❤️ Support here: Patreon - https://www.patreon.com/1littlecoder/ Ko-Fi - https://ko-fi.com/1littlecoder 🧭 Follow me on 🧭 Twitter - https://twitter.com/1littlecoder Linkedin - https://www.linkedin.com/in/amrrs/
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from 1littlecoder · 1littlecoder · 0 of 60

← Previous Next →
1 How to create your Free Data Science Blog on Github with Fastpages from Fastai
How to create your Free Data Science Blog on Github with Fastpages from Fastai
1littlecoder
2 Making Interactive Matplotlib Plots for Data Science Visualizations on Jupyter (Python)
Making Interactive Matplotlib Plots for Data Science Visualizations on Jupyter (Python)
1littlecoder
3 Create your first Data Science Web App using R Shiny
Create your first Data Science Web App using R Shiny
1littlecoder
4 How to create a Reproducible Example in R using reprex
How to create a Reproducible Example in R using reprex
1littlecoder
5 No Code Visualization using esquisse with Tableau-like Drag and Drop GUI in R
No Code Visualization using esquisse with Tableau-like Drag and Drop GUI in R
1littlecoder
6 Scrape HTML Table using rvest and Process them for insights using tidyverse in R
Scrape HTML Table using rvest and Process them for insights using tidyverse in R
1littlecoder
7 Google Teachable Machine Learning Build No Code AI solution
Google Teachable Machine Learning Build No Code AI solution
1littlecoder
8 Create meaningful fake tidy datasets in R using fakir [#rstats Package]
Create meaningful fake tidy datasets in R using fakir [#rstats Package]
1littlecoder
9 How to enable using R Programming with Visual Studio VS Code
How to enable using R Programming with Visual Studio VS Code
1littlecoder
10 Python, Community, Books - with Abhiram R - Bangpypers Co-organizers | 1littlecoder podcast
Python, Community, Books - with Abhiram R - Bangpypers Co-organizers | 1littlecoder podcast
1littlecoder
11 Growing a Tech Community across India - Anubha Maneshwar, Founder Girlscript | 1littlecoder Podcast
Growing a Tech Community across India - Anubha Maneshwar, Founder Girlscript | 1littlecoder Podcast
1littlecoder
12 Intro to Google Colab - How to use Colab
Intro to Google Colab - How to use Colab
1littlecoder
13 Intro to Plotly Express - Complex Interactive Charts with One-Line of Python Code
Intro to Plotly Express - Complex Interactive Charts with One-Line of Python Code
1littlecoder
14 Indic NLP Python Toolkit Open Source Development - iNLTK Creator Gaurav Arora | 1littlecoder Podcast
Indic NLP Python Toolkit Open Source Development - iNLTK Creator Gaurav Arora | 1littlecoder Podcast
1littlecoder
15 Do you want a career in Data Science - Tamil Webinar
Do you want a career in Data Science - Tamil Webinar
1littlecoder
16 Android Smartphone Analysis in R [Live Coding Screencast]
Android Smartphone Analysis in R [Live Coding Screencast]
1littlecoder
17 Programmatically create Images, Memes, Watermarks using Python with imgmaker
Programmatically create Images, Memes, Watermarks using Python with imgmaker
1littlecoder
18 Kaggle Walkthrough to get you started with Data Science - Webinar
Kaggle Walkthrough to get you started with Data Science - Webinar
1littlecoder
19 Community, Corporate Job, Coding - Gnana Lakshmi T C aka Gyan, WomenWhoCode Leadership Fellow
Community, Corporate Job, Coding - Gnana Lakshmi T C aka Gyan, WomenWhoCode Leadership Fellow
1littlecoder
20 Easy ggplot2 Theme Customization with {ggeasy} | Data Visualization in R
Easy ggplot2 Theme Customization with {ggeasy} | Data Visualization in R
1littlecoder
21 Excel to R - Pivot + Bar Chart in Excel  & R using tidyverse [Live Coding]
Excel to R - Pivot + Bar Chart in Excel & R using tidyverse [Live Coding]
1littlecoder
22 Excel to R #2 - VLOOKUP in Excel to LEFT_JOIN, MERGE in R
Excel to R #2 - VLOOKUP in Excel to LEFT_JOIN, MERGE in R
1littlecoder
23 5 websites to get Free Real-World Datasets for Data Science/ML Projects
5 websites to get Free Real-World Datasets for Data Science/ML Projects
1littlecoder
24 Excel to R #3 - APPROXIMATE VLOOKUP in Excel to FUZZY LEFT_JOIN in R
Excel to R #3 - APPROXIMATE VLOOKUP in Excel to FUZZY LEFT_JOIN in R
1littlecoder
25 Correlation-alternative PPS (Predictive Power Score) Python Package Demo
Correlation-alternative PPS (Predictive Power Score) Python Package Demo
1littlecoder
26 Automated Website Screenshots in R using {webshot}
Automated Website Screenshots in R using {webshot}
1littlecoder
27 Installing Custom RStudio Theme (Synthwave85)
Installing Custom RStudio Theme (Synthwave85)
1littlecoder
28 Analyse Google Trends Search Data in R using {gtrendsR}
Analyse Google Trends Search Data in R using {gtrendsR}
1littlecoder
29 3 Tips to ask question on Stack Overflow the right way to get answers
3 Tips to ask question on Stack Overflow the right way to get answers
1littlecoder
30 Learn Data Science with R - Mini Projects - Web Scraping Zomato
Learn Data Science with R - Mini Projects - Web Scraping Zomato
1littlecoder
31 Easily make Dumbbell Chart using {ggcharts} | Data Visualization in R
Easily make Dumbbell Chart using {ggcharts} | Data Visualization in R
1littlecoder
32 GET Hackernews Front Page Results using REST API in R
GET Hackernews Front Page Results using REST API in R
1littlecoder
33 Quickly deploy ML WebApps from Google Colab using ngrok
Quickly deploy ML WebApps from Google Colab using ngrok
1littlecoder
34 Use Jupyter Notebooks within VSCode (Visual Studio Code) in 2020
Use Jupyter Notebooks within VSCode (Visual Studio Code) in 2020
1littlecoder
35 Plotly Interactive Plots as Pandas Plotting Backend df.plot()
Plotly Interactive Plots as Pandas Plotting Backend df.plot()
1littlecoder
36 Stack Overflow Developer Survey 2020 Highlights for New Programmers
Stack Overflow Developer Survey 2020 Highlights for New Programmers
1littlecoder
37 Matplotlib Animation Charts in Python using Celluloid
Matplotlib Animation Charts in Python using Celluloid
1littlecoder
38 Coding, Postwoman, Passion Project Book - Liyas Thomas Open Source Developer - 1littlecoder podcast
Coding, Postwoman, Passion Project Book - Liyas Thomas Open Source Developer - 1littlecoder podcast
1littlecoder
39 Aspiring Data Scientist, Tips on How to learn Business Domain Knowledge
Aspiring Data Scientist, Tips on How to learn Business Domain Knowledge
1littlecoder
40 Bokeh Interactive Charts as Pandas Plotting Backend df.plot_bokeh()
Bokeh Interactive Charts as Pandas Plotting Backend df.plot_bokeh()
1littlecoder
41 Easy Fast Python Pandas Summary with Sidetable | Pandas Tips & Tricks
Easy Fast Python Pandas Summary with Sidetable | Pandas Tips & Tricks
1littlecoder
42 Inception, Content Ideas, Consistency - Srivatsan Srinivasan AIEngineering YouTube Content Creator
Inception, Content Ideas, Consistency - Srivatsan Srinivasan AIEngineering YouTube Content Creator
1littlecoder
43 ggplot2 Text Customization with ggtext | Data Visualization in R
ggplot2 Text Customization with ggtext | Data Visualization in R
1littlecoder
44 Penguins Dataset Overview - iris alternative | EDA Data Visualization in R
Penguins Dataset Overview - iris alternative | EDA Data Visualization in R
1littlecoder
45 YouTube Growth Tips, Content Creation - Bhavesh Bhatt, YouTuber (Data Science & Machine Learning) #7
YouTube Growth Tips, Content Creation - Bhavesh Bhatt, YouTuber (Data Science & Machine Learning) #7
1littlecoder
46 Matplotlib Animated Bar Chart Race in Python | Data Visualization
Matplotlib Animated Bar Chart Race in Python | Data Visualization
1littlecoder
47 Simple Python GUI Development using {guietta}
Simple Python GUI Development using {guietta}
1littlecoder
48 #8 Niche, Growth, Monetization - David Langer - YouTuber Dave on Data
#8 Niche, Growth, Monetization - David Langer - YouTuber Dave on Data
1littlecoder
49 Simple Fast 3-step Python OCR using Deep Learning 40+ Languages
Simple Fast 3-step Python OCR using Deep Learning 40+ Languages
1littlecoder
50 Github New Feature Profile Summary/Mini-Resume - Profile Views
Github New Feature Profile Summary/Mini-Resume - Profile Views
1littlecoder
51 Otto ML Assistant, GPT-3 on Philosophers, Nvidia-ARM - 3 ML Tech News
Otto ML Assistant, GPT-3 on Philosophers, Nvidia-ARM - 3 ML Tech News
1littlecoder
52 What is OpenAI GPT-3 - Hype, Examples, Worries
What is OpenAI GPT-3 - Hype, Examples, Worries
1littlecoder
53 Julia 1.5, Datamuse API, Live HDR+ Pixel 4a - Machine Learning Tech News
Julia 1.5, Datamuse API, Live HDR+ Pixel 4a - Machine Learning Tech News
1littlecoder
54 Self-driving Car Engineer sentenced, arXiv Dataset, AI/ML Startup Idea - Machine Learning Tech News
Self-driving Car Engineer sentenced, arXiv Dataset, AI/ML Startup Idea - Machine Learning Tech News
1littlecoder
55 GPT-3 Explorer, Ciphey (Automated Decryption), Py-Sudoku - ML Tech News
GPT-3 Explorer, Ciphey (Automated Decryption), Py-Sudoku - ML Tech News
1littlecoder
56 How to use Advanced Google Search to extract Email Ids from Linkedin
How to use Advanced Google Search to extract Email Ids from Linkedin
1littlecoder
57 Cartoonizer Toon-IT (AI Web App), GPT-3 Advice, Android Earthquake Detection - ML Tech News
Cartoonizer Toon-IT (AI Web App), GPT-3 Advice, Android Earthquake Detection - ML Tech News
1littlecoder
58 Flow - R Package to visualize code logic, functions as a Flow Diagram
Flow - R Package to visualize code logic, functions as a Flow Diagram
1littlecoder
59 Build GPT-3-like Language Model on Google Colab with minGPT [PyTorch]
Build GPT-3-like Language Model on Google Colab with minGPT [PyTorch]
1littlecoder
60 Create a Pencil Sketch Portrait with Python OpenCV
Create a Pencil Sketch Portrait with Python OpenCV
1littlecoder

Related Reads

📰
Calibrated Selective Fact-Checking via Evidence Chain Evaluation
Learn to improve fact-checking accuracy with Evidence Chain Evaluation (ECE) for large language models (LLMs), enabling calibrated selective fact-checking via uncertain verdicts
ArXiv cs.AI
📰
BatchDAG: LLM-Planned Execution Graphs for Scalable Ad-Hoc Analysis Over Enterprise Data
Learn how BatchDAG uses LLMs to plan execution graphs for scalable ad-hoc analysis over enterprise data, improving performance and reducing latency
ArXiv cs.AI
📰
Phionyx: A Deterministic AI Runtime Architecture with Structured State Management and Pre-Response Governance
Learn how Phionyx, a deterministic AI runtime architecture, enables structured state management and pre-response governance for large language models, improving reliability and control.
ArXiv cs.AI
📰
AI's Guide to Pretending to Have Days (Spoiler: It's Mostly Questions)
Explore how AI perceives time and its implications on human-AI interaction, and why understanding this matters for effective collaboration
Dev.to AI
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →