Understanding: AI Model Quantization, GGML vs GPTQ!
Key Takeaways
This video teaches AI model quantization using GGML and GPTQ techniques
Full Transcript
there is so much about quantization do you understand it what is ggml gptq this video is going to explain let's learn about weights and neural networks weights are the parameters and neural network that determine how the network learns and makes prediction they are actually real numbers that are associated with each connection between neurons in the network the weights are what a love the neural network to learn the relationships between input data and the desired output data so in in a neural network if you take a neural network each neuron receives input from another neuron and the input from each neuron is multiplied by the weight and the sum of all the weighted inputs is then passed through an activation function and the activation function ultimately decides or determines whether the neuron will fire or not initially the weights are randomly initialized but as the training process goes on the weights are optimized and adjusted based on the optimization that you have selected and this is kind of the foundation of a technique called back propagation back propagation lets you optimize and change the weights in such a way that you can minimize the error now how are weights related to quantization now when these weights are stored in the neural network that's what the model is you call it a model weight so now when these weights are stored in the neural network it can be with different precisions so you could store these weights as a 32-bit floating point or you could store this weight as a 16-bit floating point or even could be an 8-bit floating point or 8-bit integer or a four bit integer so when we talk about weights as numbers we generally call it a number but this number under the hood in computers could be of different precision and could be of different data type and based on the data type or based on the Precision a lot of things change including the amount of time this neural network takes for inference and also the size of the neural network ultimately the model in itself so just to back it up if we say something is a model the model is nothing but a neural network with its weights so the model is going to be huge when the weights are stored in a higher Precision or you know the most Precision like you know the most accurate number representation of that floating point value but the model's weight will come down as you reduce the Precision that is where you have got a very interesting technique that comes in that is called quantization quantization in neural networks is the process of reducing the Precision of the weights biases and activations of a neural network in order to reduce the size and computational requirements of the model this can be done without significantly impacting the accuracy of the model in many cases I mean when I say quantization that's the first thing that might come to your mind Hey like you are going to reduce the Precision of the weights what kind of impact it is going to have with the model accuracy that's a very good question and also quantization happens at two different places one it could be a post training quantization or the other one could be a quantization of wet training what we do mostly these days like the bloke with ggml and the gptq models or post training quantization what is a post training quantization post training quantization is the process of quantizing a pre-trained neural network and this can be simply done by rounding of weights or activations to a lower Precision but this can also lead to some kind of accuracy so in the post training quantization you might take a model that has got let's say floating Point 16 accurate precision and you can convert into a 4-bit or an 8-bit integer by doing this you are quantizing the model you are quantizing the model in such a way that the weight of the model reduces the size of the model reduces and it also improves the performance of the model in terms of you know the hardware that is required to run it but this can also lead to loss in accuracy so now the quantization part is clear again just to back it up a neural network is a bunch of numbers stored here and there and it matrix multiplication numbers are stored the form of Weights biases and activations and when these numbers are stored with higher Precision floating Point like 32-bit floating Point these models take a lot of size and these models also require more computation when the models have to predict that's what we call inference so by reducing the size of the model or by reducing the Precision of the model We Are One reducing the size of the model improving the model more performant in lower computation and the model is also going to require less compute under lesser power to do the matrix multiplication and all the this can also lead to accuracy loss now with all these things in mind the two popular model types that we see post trained quantized models are ggml and gptq models now what are these models so ggml and gptq models are quantized models in a way to reduce the models and also reduce the computation requirements of the model by reducing the model weights to a lower Precision now what are the key differences between GG ML and gptq ggml models are optimized for CPU while gptq models are optimized for GPU that means ggml model runs faster the inference speed is faster on CPUs and gptq or faster on GPU the inference quality is said to be similar but I read a blog post or I read a hugging face Community article where the blog said the during their experiment with ggml and gptq gptq scored a little bit lower than gcml but I don't have any benchmarks to prove that but anyways just keep in mind that ggml and gptq are ideally supposed to have a similar inference quality the model size the ggml is supposed to be slightly larger than gptq models and both of these models are compatible with hugging phase Transformers which means you know you have got like easy way to run these models in general the thumb rule is if you have got a CPU without any Nvidia GPU use the ggml model or if you have got an Nvidia GPU even if it is not like most powerful mission in the world you can use gptq model and I guess this helps you in understanding all these things that people are discussing these days about gptq ggml quantization reducing the model size if you have got any questions let me know in the comment section otherwise see you in another video Happy prompting
Original Description
Learning Resources:
TheBloke Quantized Models - https://huggingface.co/TheBloke
Quantization from Hugging Face (Optimum) - https://huggingface.co/docs/optimum/concept_guides/quantization
Programming a Neural Network - https://www.mql5.com/en/articles/5486
Deep Neural Network Simplified - https://towardsai.net/p/deep-learning/deep-learning-simplified-feel-and-talk-like-an-expert-in-neural-networks
INT8 Quantization Basics - https://randxie.github.io/writing/2020/10/15/int8-quantization/
❤️ If you want to support the channel ❤️
Support here:
Patreon - https://www.patreon.com/1littlecoder/
Ko-Fi - https://ko-fi.com/1littlecoder
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
How to create your Free Data Science Blog on Github with Fastpages from Fastai
1littlecoder
Making Interactive Matplotlib Plots for Data Science Visualizations on Jupyter (Python)
1littlecoder
Create your first Data Science Web App using R Shiny
1littlecoder
How to create a Reproducible Example in R using reprex
1littlecoder
No Code Visualization using esquisse with Tableau-like Drag and Drop GUI in R
1littlecoder
Scrape HTML Table using rvest and Process them for insights using tidyverse in R
1littlecoder
Google Teachable Machine Learning Build No Code AI solution
1littlecoder
Create meaningful fake tidy datasets in R using fakir [#rstats Package]
1littlecoder
How to enable using R Programming with Visual Studio VS Code
1littlecoder
Python, Community, Books - with Abhiram R - Bangpypers Co-organizers | 1littlecoder podcast
1littlecoder
Growing a Tech Community across India - Anubha Maneshwar, Founder Girlscript | 1littlecoder Podcast
1littlecoder
Intro to Google Colab - How to use Colab
1littlecoder
Intro to Plotly Express - Complex Interactive Charts with One-Line of Python Code
1littlecoder
Indic NLP Python Toolkit Open Source Development - iNLTK Creator Gaurav Arora | 1littlecoder Podcast
1littlecoder
Do you want a career in Data Science - Tamil Webinar
1littlecoder
Android Smartphone Analysis in R [Live Coding Screencast]
1littlecoder
Programmatically create Images, Memes, Watermarks using Python with imgmaker
1littlecoder
Kaggle Walkthrough to get you started with Data Science - Webinar
1littlecoder
Community, Corporate Job, Coding - Gnana Lakshmi T C aka Gyan, WomenWhoCode Leadership Fellow
1littlecoder
Easy ggplot2 Theme Customization with {ggeasy} | Data Visualization in R
1littlecoder
Excel to R - Pivot + Bar Chart in Excel & R using tidyverse [Live Coding]
1littlecoder
Excel to R #2 - VLOOKUP in Excel to LEFT_JOIN, MERGE in R
1littlecoder
5 websites to get Free Real-World Datasets for Data Science/ML Projects
1littlecoder
Excel to R #3 - APPROXIMATE VLOOKUP in Excel to FUZZY LEFT_JOIN in R
1littlecoder
Correlation-alternative PPS (Predictive Power Score) Python Package Demo
1littlecoder
Automated Website Screenshots in R using {webshot}
1littlecoder
Installing Custom RStudio Theme (Synthwave85)
1littlecoder
Analyse Google Trends Search Data in R using {gtrendsR}
1littlecoder
3 Tips to ask question on Stack Overflow the right way to get answers
1littlecoder
Learn Data Science with R - Mini Projects - Web Scraping Zomato
1littlecoder
Easily make Dumbbell Chart using {ggcharts} | Data Visualization in R
1littlecoder
GET Hackernews Front Page Results using REST API in R
1littlecoder
Quickly deploy ML WebApps from Google Colab using ngrok
1littlecoder
Use Jupyter Notebooks within VSCode (Visual Studio Code) in 2020
1littlecoder
Plotly Interactive Plots as Pandas Plotting Backend df.plot()
1littlecoder
Stack Overflow Developer Survey 2020 Highlights for New Programmers
1littlecoder
Matplotlib Animation Charts in Python using Celluloid
1littlecoder
Coding, Postwoman, Passion Project Book - Liyas Thomas Open Source Developer - 1littlecoder podcast
1littlecoder
Aspiring Data Scientist, Tips on How to learn Business Domain Knowledge
1littlecoder
Bokeh Interactive Charts as Pandas Plotting Backend df.plot_bokeh()
1littlecoder
Easy Fast Python Pandas Summary with Sidetable | Pandas Tips & Tricks
1littlecoder
Inception, Content Ideas, Consistency - Srivatsan Srinivasan AIEngineering YouTube Content Creator
1littlecoder
ggplot2 Text Customization with ggtext | Data Visualization in R
1littlecoder
Penguins Dataset Overview - iris alternative | EDA Data Visualization in R
1littlecoder
YouTube Growth Tips, Content Creation - Bhavesh Bhatt, YouTuber (Data Science & Machine Learning) #7
1littlecoder
Matplotlib Animated Bar Chart Race in Python | Data Visualization
1littlecoder
Simple Python GUI Development using {guietta}
1littlecoder
#8 Niche, Growth, Monetization - David Langer - YouTuber Dave on Data
1littlecoder
Simple Fast 3-step Python OCR using Deep Learning 40+ Languages
1littlecoder
Github New Feature Profile Summary/Mini-Resume - Profile Views
1littlecoder
Otto ML Assistant, GPT-3 on Philosophers, Nvidia-ARM - 3 ML Tech News
1littlecoder
What is OpenAI GPT-3 - Hype, Examples, Worries
1littlecoder
Julia 1.5, Datamuse API, Live HDR+ Pixel 4a - Machine Learning Tech News
1littlecoder
Self-driving Car Engineer sentenced, arXiv Dataset, AI/ML Startup Idea - Machine Learning Tech News
1littlecoder
GPT-3 Explorer, Ciphey (Automated Decryption), Py-Sudoku - ML Tech News
1littlecoder
How to use Advanced Google Search to extract Email Ids from Linkedin
1littlecoder
Cartoonizer Toon-IT (AI Web App), GPT-3 Advice, Android Earthquake Detection - ML Tech News
1littlecoder
Flow - R Package to visualize code logic, functions as a Flow Diagram
1littlecoder
Build GPT-3-like Language Model on Google Colab with minGPT [PyTorch]
1littlecoder
Create a Pencil Sketch Portrait with Python OpenCV
1littlecoder
Related Reads
📰
📰
📰
📰
Building a Custom GPT / Chatbot for Your Own Use Case
Medium · Python
Building a Custom GPT / Chatbot for Your Own Use Case
Medium · RAG
Open-Weight LLM API Integration: A Developer Guide to Building with Transparent AI
Dev.to AI
Stop Writing Boilerplate: How I Automated My Entire Workflow with LLM APIs
Dev.to AI
🎓
Tutor Explanation
DeepCamp AI