{
  "source_file": "0930",
  "source_platform": "Medium",
  "author": "Maxime Labonne",
  "title_listed": "Quantize Llama models with GGUF and llama.cpp",
  "keywords": "量化,GGUF,llama.cpp",
  "domain": "大模型算法",
  "content_type": "深度技术解析",
  "is_paid_flag": "部分免费/会员墙",
  "url": "https://towardsdatascience.com/quantize-llama-models-with-ggml-and-llama-cpp-3612dfbcc172/",
  "publish_date": "2023-09",
  "corpus_stage": "预训练/SFT",
  "notes": "",
  "id": "fb2ec9bb2067",
  "collected_at": "2026-10-01T21:53:54",
  "title": "Quantize Llama models with GGUF and llama.cpp | Towards Data Science",
  "body_markdown": "![Revisit consent button](https://cdn-cookieyes.com/assets/images/revisit.svg)\nWe value your privacy\nWe use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking \"Accept All\", you consent to our use of cookies.\nCustomise Reject All Accept All\nCustomise Consent Preferences ![](https://cdn-cookieyes.com/assets/images/close.svg)\nWe use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.\nThe cookies that are categorised as \"Necessary\" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... Show more\nNecessaryAlways Active\nNecessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.\n  * Cookie\nBCTempID\n  * Duration\n10 minutes\n  * Description\nNo description available.\n\n\n  * Cookie\n__cf_bm\n  * Duration\n1 hour\n  * Description\nThis cookie, set by Cloudflare, is used to support Cloudflare Bot Management. \n\n\n  * Cookie\nAWSALBCORS\n  * Duration\n7 days\n  * Description\nAmazon Web Services set this cookie for load balancing.\n\n\n  * Cookie\n_cfuvid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to track users across sessions to optimize user experience by maintaining session consistency and providing personalized services\n\n\n  * Cookie\nli_gc\n  * Duration\n6 months\n  * Description\nLinkedin set this cookie for storing visitor's consent regarding using cookies for non-essential purposes.\n\n\n  * Cookie\n__hssrc\n  * Duration\nsession\n  * Description\nThis cookie is set by Hubspot whenever it changes the session cookie. The __hssrc cookie set to 1 indicates that the user has restarted the browser, and if the cookie does not exist, it is assumed to be a new session.\n\n\n  * Cookie\n__hssc\n  * Duration\n1 hour\n  * Description\nHubSpot sets this cookie to keep track of sessions and to determine if HubSpot should increment the session number and timestamps in the __hstc cookie.\n\n\n  * Cookie\nwpEmojiSettingsSupports\n  * Duration\nsession\n  * Description\nWordPress sets this cookie when a user interacts with emojis on a WordPress site. It helps determine if the user's browser can display emojis properly.\n\n\n  * Cookie\nBCSessionID\n  * Duration\n1 year 1 month 4 days\n  * Description\nBlueconic sets this cookie as a unique identifier for the BlueConic profile.\n\n\n  * Cookie\n_octo\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nlogged_in\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\n__Secure-YEC\n  * Duration\npast\n  * Description\nYouTube sets this cookie to stores the user's video player preferences using embedded YouTube video\n\n\n  * Cookie\n__eoi\n  * Duration\n6 months\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTGCORS\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\nlogin-status-p\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nAWSALBTG\n  * Duration\n7 days\n  * Description\nNo description available.\n\n\n  * Cookie\ncsrf_token\n  * Duration\nsession\n  * Description\nNo description available.\n\n\n  * Cookie\ntoken_v2\n  * Duration\n1 day\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nD\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nPHPSESSID\n  * Duration\nsession\n  * Description\nThis cookie is native to PHP applications. The cookie stores and identifies a user's unique session ID to manage user sessions on the website. The cookie is a session cookie and will be deleted when all the browser windows are closed.\n\n\n  * Cookie\nVISITOR_PRIVACY_METADATA\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to store the user's cookie consent state for the current domain. \n\n\n  * Cookie\ncookietest\n  * Duration\nsession\n  * Description\nThe cookietest cookie is typically used to determine whether the user's browser accepts cookies, essential for website functionality and user experience.\n\n\n  * Cookie\n__Host-airtable-session\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\n__Host-airtable-session.sig\n  * Duration\n1 year\n  * Description\nThis cookie is used to enable us to integrate the services of Airtable.\n\n\n  * Cookie\nm\n  * Duration\n1 year 1 month 4 days\n  * Description\nStripe sets this cookie for fraud prevention purposes. It identifies the device used to access the website, allowing the website to be formatted accordingly.\n\n\n  * Cookie\nBIGipServer*\n  * Duration\nsession\n  * Description\nMarketo sets this cookie to collect information about the user's online activity and build a profile about their interests to provide advertisements relevant to the user. \n\n\n  * Cookie\n__cfruid\n  * Duration\nsession\n  * Description\nCloudflare sets this cookie to identify trusted web traffic.\n\n\n  * Cookie\n_GRECAPTCHA\n  * Duration\n6 months\n  * Description\nGoogle Recaptcha service sets this cookie to identify bots to protect the website against malicious spam attacks.\n\n\n  * Cookie\n__Secure-YNID\n  * Duration\n6 months\n  * Description\nGoogle cookie used to protect user security and prevent fraud, especially during the login process.\n\n\n  * Cookie\ncookieyes-consent\n  * Duration\n1 year\n  * Description\nCookieYes sets this cookie to remember users' consent preferences so that their preferences are respected on subsequent visits to this site. It does not collect or store any personal information about the site visitors.\n\n\nFunctional\nFunctional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.\n  * Cookie\nlidc\n  * Duration\n1 day\n  * Description\nLinkedIn sets the lidc cookie to facilitate data center selection.\n\n\n  * Cookie\nbrw\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nbrwConsent\n  * Duration\n5 minutes\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nWMF-Uniq\n  * Duration\n1 year\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nloom_anon_comment\n  * Duration\n1 year\n  * Description\nNo description available.\n\n\n  * Cookie\nloom_referral_video\n  * Duration\nsession\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nVISITOR_INFO1_LIVE\n  * Duration\n6 months\n  * Description\nA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.\n\n\n  * Cookie\nyt-remote-connected-devices\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nytidb::LAST_RESULT_ENTRY_KEY\n  * Duration\nNever Expires\n  * Description\nThe cookie ytidb::LAST_RESULT_ENTRY_KEY is used by YouTube to store the last search result entry that was clicked by the user. This information is used to improve the user experience by providing more relevant search results in the future.\n\n\n  * Cookie\nyt-remote-device-id\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to store the user's video preferences using embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-name\n  * Duration\nsession\n  * Description\nThe yt-remote-session-name cookie is used by YouTube to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\nyt-remote-fast-check-period\n  * Duration\nsession\n  * Description\nThe yt-remote-fast-check-period cookie is used by YouTube to store the user's video player preferences for embedded YouTube videos.\n\n\n  * Cookie\nyt-remote-session-app\n  * Duration\nsession\n  * Description\nThe yt-remote-session-app cookie is used by YouTube to store user preferences and information about the interface of the embedded YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-available\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-available cookie is used to store the user's preferences regarding whether casting is available on their YouTube video player.\n\n\n  * Cookie\nyt-remote-cast-installed\n  * Duration\nsession\n  * Description\nThe yt-remote-cast-installed cookie is used to store the user's video player preferences using embedded YouTube video.\n\n\n  * Cookie\ncp_session\n  * Duration\n3 months\n  * Description\nCodepen sets this cookie for Help systems found in the website.\n\n\n  * Cookie\nloid\n  * Duration\n1 year 1 month 4 days\n  * Description\nThis cookie is set by the Reddit. The cookie enables the sharing of content from the website onto the social media platform.\n\n\nAnalytics\nAnalytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.\n  * Cookie\n__hstc\n  * Duration\n6 months\n  * Description\nHubspot set this main cookie for tracking visitors. It contains the domain, initial timestamp (first visit), last timestamp (last visit), current timestamp (this visit), and session number (increments for each subsequent session).\n\n\n  * Cookie\nhubspotutk\n  * Duration\n6 months\n  * Description\nHubSpot sets this cookie to keep track of the visitors to the website. This cookie is passed to HubSpot on form submission and used when deduplicating contacts.\n\n\n  * Cookie\n_ga\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to calculate visitor, session and campaign data and track site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognise unique visitors.\n\n\n  * Cookie\n_ga_*\n  * Duration\n1 year 1 month 4 days\n  * Description\nGoogle Analytics sets this cookie to store and count page views.\n\n\n  * Cookie\n__Host-psifi.analyticsTrace\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n__Host-psifi.analyticsTraceV2\n  * Duration\n6 hours\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\n_gh_sess\n  * Duration\nsession\n  * Description\nGitHub sets this cookie for temporary application and framework state between pages like what step the user is on in a multiple step form.\n\n\n  * Cookie\nYSC\n  * Duration\nsession\n  * Description\nYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.\n\n\n  * Cookie\najs_anonymous_id\n  * Duration\n1 year\n  * Description\nThis cookie is set by Segment to count the number of people who visit a certain site by tracking if they have visited before.\n\n\n  * Cookie\nvuid\n  * Duration\n1 year 1 month 4 days\n  * Description\nVimeo installs this cookie to collect tracking information by setting a unique ID to embed videos on the website. \n\n\nPerformance\nPerformance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.\n  * Cookie\nAWSALB\n  * Duration\n7 days\n  * Description\nAWSALB is an application load balancer cookie set by Amazon Web Services to map the session to the target.\n\n\n  * Cookie\nacq\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nacq.sig\n  * Duration\npast\n  * Description\nDescription is currently not available.\n\n\n  * Cookie\nptc\n  * Duration\n2 years\n  * Description\nNo description available.\n\n\nAdvertisement\nAdvertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.\n  * Cookie\nmuc_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to collect user behaviour and interaction data to optimize the website.\n\n\n  * Cookie\nguest_id_marketing\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\nguest_id_ads\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor.\n\n\n  * Cookie\npersonalization_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to integrate and share features for social media and also store information about how the user uses the website, for tracking and targeting.\n\n\n  * Cookie\nguest_id\n  * Duration\n1 year 1 month 4 days\n  * Description\nTwitter sets this cookie to identify and track the website visitor. It registers if a user is signed in to the Twitter platform and collects information about ad preferences.\n\n\n  * Cookie\nbcookie\n  * Duration\n1 year\n  * Description\nLinkedIn sets this cookie from LinkedIn share buttons and ad tags to recognize browser IDs.\n\n\n  * Cookie\n__Secure-ROLLOUT_TOKEN\n  * Duration\n6 months\n  * Description\nYouTube sets this cookie to manage feature rollout and experimentation. It helps Google control which new features or interface changes are shown to users as part of testing and staged rollouts, ensuring consistent experience for a given user during an experiment.\n\n\n  * Cookie\nyt.innertube::nextId\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nyt.innertube::requests\n  * Duration\nNever Expires\n  * Description\nYouTube sets this cookie to register a unique ID to store data on what videos from YouTube the user has seen.\n\n\n  * Cookie\nsession_tracker\n  * Duration\nsession\n  * Description\nThis cookie is set by the Reddit. This cookie is used to identify trusted web traffic. It also helps in adverstising on the website.\n\n\n  * Cookie\nedgebucket\n  * Duration\nsession\n  * Description\nReddit sets this cookie to save the information about a log-on Reddit user, for the purpose of advertisement recommendations and updating the content.\n\n\n  * Cookie\ndid\n  * Duration\n1 year\n  * Description\nArbor sets this cookie to show targeted ads to site visitors.This cookie expires after 2 months or 1 year.\n\n\nUncategorised\nOther uncategorised cookies are those that are being analysed and have not been classified into a category as yet.\nNo cookies to display.\nReject All Save My Preferences Accept All\nToggle Search[](https://towardsdatascience.com/)Toggle Mobile Navigation\n[](https://towardsdatascience.com/)\nPublish AI, ML & data-science insights to a global community of data professionals.\nSign in[Submit an Article](https://write.insightmediagroup.io)\n[Latest](https://towardsdatascience.com/latest/)[Editor's Picks](https://towardsdatascience.com/tag/editors-pick/)[Newsletter](https://towardsdatascience.com/tag/the-variable/)[ShipAI](https://towardsdatascience.com/shipai/)\n* * *\n[Write For TDS](https://towardsdatascience.com/submissions/)\n[LinkedIn](https://www.linkedin.com/company/towards-data-science/)[X](https://x.com/TDataScience)Toggle Search\n[Data Science](https://towardsdatascience.com/category/data-science/)\n# Quantize Llama models with GGUF and llama.cpp\nGGML vs. GPTQ vs. NF4\n[Maxime Labonne](https://towardsdatascience.com/author/mlabonne/)\nSeptember 4, 20239 min read\n![Image by author](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/09/18hOKzslGLcauIFuI0r1S-Q.png)\nImage by author\nDue to the massive size of Large Language Models (LLMs), quantization has become an essential technique to run them efficiently. By reducing the precision of their weights, you can save memory and speed up inference while preserving most of the model's performance. Recently, 8-bit and 4-bit quantization unlocked the possibility of **running LLMs on consumer hardware**. Coupled with the release of Llama models and parameter-efficient techniques to fine-tune them (LoRA, QLoRA), this created a rich ecosystem of local LLMs that are now competing with OpenAI's GPT-3.5 and GPT-4.\nBesides the naive approach covered [in this article](https://medium.com/towards-data-science/introduction-to-weight-quantization-2494701b9c0c), there are three main quantization techniques: [NF4](https://huggingface.co/blog/4bit-transformers-bitsandbytes), GPTQ, and GGML. NF4 is a static method used by QLoRA to load a model in 4-bit precision to perform fine-tuning. [In a previous article](https://medium.com/towards-data-science/4-bit-quantization-with-gptq-36b0f4f02c34), we explored the GPTQ method and quantized our own model to run it on a consumer GPU. In this article, we will introduce the GGML technique, see how to quantize Llama models, and provide tips and tricks to achieve the best results.\nYou can find the code on [Google Colab](https://colab.research.google.com/drive/1pL8k7m04mgE5jo2NrjGi8atB0j_37aDD?usp=sharing) and [GitHub](https://github.com/mlabonne/llm-course).\nLearn this step by step with the interactive [AI and Data Scientist](https://roadmap.sh/ai-data-scientist), [Computer Science](https://roadmap.sh/computer-science), [AI Engineer](https://roadmap.sh/ai-engineer) and [Machine Learning](https://roadmap.sh/machine-learning) roadmaps.\n## What is GGML?\nGGML is a C library focused on machine learning. It was created by Georgi Gerganov, which is what the initials \"GG\" stand for. This library not only provides foundational elements for machine learning, such as tensors, but also a **unique binary format** to distribute LLMs.\nThis format recently changed to **GGUF**. This new format is designed to be extensible, so that new features shouldn't break compatibility with existing models. It also centralizes all the metadata in one file, such as special tokens, RoPE scaling parameters, etc. In short, it answers a few historical pain points and should be future-proof. For more information, you can read the specification [at this address](https://github.com/philpax/ggml/blob/gguf-spec/docs/gguf.md). In the rest of the article, we will call \"GGML models\" all models that either use GGUF or previous formats.\nGGML was designed to be used in conjunction with the [llama.cpp](https://github.com/ggerganov/llama.cpp) library, also created by Georgi Gerganov. The library is written in C/C++ for efficient inference of Llama models. It can load GGML models and **run them on a CPU**. Originally, this was the main difference with GPTQ models, which are loaded and run on a GPU. However, you can now offload some layers of your LLM to the GPU with llama.cpp. To give you an example, there are 35 layers for a 7b parameter model. This drastically speeds up inference and allows you to run LLMs that don't fit in your VRAM.\n![Image by author](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/09/10UGhhiepQRjxnbHX1bR1Ow.gif)\nImage by author\nIf command-line tools are your thing, llama.cpp and GGUF support have been integrated into many GUIs, like oobabooga's [text-generation-web-ui](https://github.com/oobabooga/text-generation-webui), [koboldcpp](https://github.com/LostRuins/koboldcpp), [LM Studio](https://lmstudio.ai/), or [ctransformers](https://github.com/marella/ctransformers). You can simply load your GGML models with these tools and interact with them in a ChatGPT-like way. Fortunately, many quantized models are directly available on the [Hugging Face Hub](https://huggingface.co/models?search=gg). You'll quickly notice that most of them are quantized by [TheBloke](https://huggingface.co/TheBloke), a popular figure in the LLM community.\nIn the next section, we will see how to quantize our own models and run them on a consumer GPU.\n## How to quantize LLMs with GGML?\nLet's look at the files inside of [TheBloke/Llama-2–13B-chat-GGML](https://huggingface.co/TheBloke/Llama-2-13B-chat-GGML/tree/main) repo. We can see **14 different GGML models** , corresponding to different types of quantization. They follow a particular naming convention: \"q\" + the number of bits used to store the weights (precision) + a particular variant. Here is a list of all the possible quant methods and their corresponding use cases, based on model cards made by TheBloke:\n  * `q2_k`: Uses Q4_K for the attention.vw and feed_forward.w2 tensors, Q2_K for the other tensors.\n  * `q3_k_l`: Uses Q5_K for the attention.wv, attention.wo, and feed_forward.w2 tensors, else Q3_K\n  * `q3_k_m`: Uses Q4_K for the attention.wv, attention.wo, and feed_forward.w2 tensors, else Q3_K\n  * `q3_k_s`: Uses Q3_K for all tensors\n  * `q4_0`: Original quant method, 4-bit.\n  * `q4_1`: Higher accuracy than q4_0 but not as high as q5_0. However has quicker inference than q5 models.\n  * `q4_k_m`: Uses Q6_K for half of the attention.wv and feed_forward.w2 tensors, else Q4_K\n  * `q4_k_s`: Uses Q4_K for all tensors\n  * `q5_0`: Higher accuracy, higher resource usage and slower inference.\n  * `q5_1`: Even higher accuracy, resource usage and slower inference.\n  * `q5_k_m`: Uses Q6_K for half of the attention.wv and feed_forward.w2 tensors, else Q5_K\n  * `q5_k_s`: Uses Q5_K for all tensors\n  * `q6_k`: Uses Q8_K for all tensors\n  * `q8_0`: Almost indistinguishable from float16. High resource use and slow. Not recommended for most users.\n\n\nAs a rule of thumb, **I recommend using Q5_K_M** as it preserves most of the model's performance. Alternatively, you can use Q4_K_M if you want to save some memory. In general, K_M versions are better than K_S versions. I cannot recommend Q2 or Q3 versions, as they drastically decrease model performance.\nNow that we know more about the quantization types available, let's see how to use them on a real model. You can execute the following code on a **free T4 GPU** on [Google Colab](https://colab.research.google.com/drive/1pL8k7m04mgE5jo2NrjGi8atB0j_37aDD?usp=sharing). The first step consists of compiling llama.cpp and installing the required libraries in our Python environment.\nbash\n\n```\n# Install llama.cpp\n!git clone https://github.com/ggerganov/llama.cpp\n!cd llama.cpp &amp;&amp; git pull &amp;&amp; make clean &amp;&amp; LLAMA_CUBLAS=1 make\n!pip install -r llama.cpp/requirements.txt\n```\n\nNow we can download our model. We will use the model we fine-tuned [in the previous article](https://medium.com/towards-data-science/a-beginners-guide-to-llm-fine-tuning-4bae7d4da672), `[mlabonne/EvolCodeLlama-7b](https://huggingface.co/mlabonne/EvolCodeLlama-7b)`.\nbash\n\n```\nMODEL_ID = \"mlabonne/EvolCodeLlama-7b\"\n\n# Download model\n!git lfs install\n!git clone https://huggingface.co/{MODEL_ID}\n```\n\nThis step can take a while. Once it's done, we need to convert our weight to GGML FP16 format.\nbash\n\n```\nMODEL_NAME = MODEL_ID.split('/')[-1]\n\n# Convert to fp16\nfp16 = f\"{MODEL_NAME}/{MODEL_NAME.lower()}.fp16.bin\"\n!python llama.cpp/convert.py {MODEL_NAME} --outtype f16 --outfile {fp16}\n```\n\nFinally, we can quantize the model using one or several methods. In this case, we will use the Q4_K_M and Q5_K_M methods I recommended earlier. This is the only step that actually requires a GPU.\npython\n\n```\nQUANTIZATION_METHODS = [\"q4_k_m\", \"q5_k_m\"]\n\nfor method in QUANTIZATION_METHODS:\n    qtype = f\"{MODEL_NAME}/{MODEL_NAME.lower()}.{method.upper()}.gguf\"\n    !./llama.cpp/quantize {fp16} {qtype} {method}\n```\n\nOur two quantized models are now **ready for inference**. We can check the size of the bin files to see how much we compressed them. The FP16 model takes up 13.5 GB, while the Q4_K_M model takes up 4.08 GB (3.3 times smaller) and the Q5_K_M model takes up 4.78 GB (2.8 times smaller).\nLet's use llama.cpp to efficiently run them. Since we're using a GPU with 16 GB of VRAM, we can offload every layer to the GPU. In this case, it represents 35 layers (7b parameter model), so we'll use the `-ngl 35` parameter. In the following code block, we'll also input a prompt and the quantization method we want to use.\npython\n\n```\nimport os\n\nmodel_list = [file for file in os.listdir(MODEL_NAME) if \"gguf\" in file]\n\nprompt = input(\"Enter your prompt: \")\nchosen_method = input(\"Name of the model (options: \" + \", \".join(model_list) + \"): \")\n\n# Verify the chosen method is in the list\nif chosen_method not in model_list:\n    print(\"Invalid name\")\nelse:\n    qtype = f\"{MODEL_NAME}/{MODEL_NAME.lower()}.{method.upper()}.gguf\"\n    !./llama.cpp/main -m {qtype} -n 128 --color -ngl 35 -p \"{prompt}\"\n```\n\nLet's ask the model \"Write a Python function to print the nth Fibonacci numbers\" using the Q5_K_M method. If we look at the logs, we can confirm that we successfully offloaded our layers thanks to the line \"llm_load_tensors: offloaded 35/35 layers to GPU\". Here is the code the model generated:\npython\n\n```\ndef fib(n):\n    if n == 0 or n == 1:\n        return n\n    return fib(n - 2) + fib(n - 1)\n\nfor i in range(1, 10):\n    print(fib(i))\n```\n\nThis wasn't a very complex prompt, but it successfully produced a working piece of code in no time. With llama.cpp, you can use your local LLM as an assistant in a terminal using the interactive mode (`-i` flag). Note that this also works on Macbooks with Apple's Metal Performance Shaders (MPS), which is an excellent option to run LLMs.\nFinally, we can push our quantized model to a new repo on the Hugging Face Hub with the \"-GGUF\" suffix. First, let's log in and modify the following code block to match your username.\npython\n\n```\n!pip install -q huggingface_hub\n\nusername = \"mlabonne\"\n\nfrom huggingface_hub import notebook_login, create_repo, HfApi\nnotebook_login()\n```\n\nFinally, we can push our quantized model to a new repo on the Hugging Face Hub with the \"-GGUF\" suffix. First, let's log in and modify the following code block to match your username. You can enter your Hugging Face token (<https://huggingface.co/settings/tokens>) in Google Colab's \"Secrets\" tab. We use the `allow_patterns` parameter to only upload GGUF models and not the entirety of the directory.\npython\n\n```\n!pip install -q huggingface_hub\nfrom huggingface_hub import create_repo, HfApi\nfrom google.colab import userdata\n\n# Defined in the secrets tab in Google Colab\nhf_token = userdata.get('huggingface')\n\napi = HfApi()\nusername = \"mlabonne\"\n\n# Create empty repo\ncreate_repo(\n    repo_id = f\"{username}/{MODEL_NAME}-GGUF\",\n    repo_type=\"model\",\n    exist_ok=True,\n    token=hf_token\n)\n\n# Upload gguf files\napi.upload_folder(\n    folder_path=MODEL_NAME,\n    repo_id=f\"{username}/{MODEL_NAME}-GGUF\",\n    allow_patterns=f\"*.gguf\",\n    token=hf_token\n)\n```\n\nWe have successfully quantized, run, and pushed GGML models to the Hugging Face Hub! In the next section, we will explore how GGML actually quantize these models.\n## Quantization with GGML\nThe way GGML quantizes weights is not as sophisticated as GPTQ's. Basically, it groups blocks of values and rounds them to a lower precision. Some techniques, like Q4_K_M and Q5_K_M, implement a **higher precision for critical layers**. In this case, every weight is stored in 4-bit precision, with the exception of half of the attention.wv and feed_forward.w2 tensors. Experimentally, this mixed precision proves to be a good tradeoff between accuracy and resource usage.\nIf we look into the [ggml.c file](https://github.com/ggerganov/ggml/blob/master/src/ggml.c), we can see how the blocks are defined. For example, the `block_q4_0` structure is defined as:\ncpp\n\n```\n#define QK4_0 32\ntypedef struct {\n    ggml_fp16_t d;          // delta\n    uint8_t qs[QK4_0 / 2];  // nibbles / quants\n} block_q4_0;\n```\n\nIn GGML, weights are processed in blocks, each consisting of 32 values. For each block, a scale factor (delta) is derived from the largest weight value. All weights in the block are then scaled, quantized, and packed efficiently for storage (nibbles). This approach significantly reduces the storage requirements while allowing for a relatively simple and deterministic conversion between the original and quantized weights.\nNow that we know more about the quantization process, we can compare the results with NF4 and GPTQ.\n## NF4 vs. GGML vs. GPTQ\nWhich technique is better for 4-bit quantization? To answer this question, we need to introduce the different backends that run these quantized LLMs. For GGML models, llama.cpp with Q4_K_M models is the way to go. For GPTQ models, we have two options: [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) or [ExLlama](https://github.com/turboderp/exllama). Finally, NF4 models can directly be run in transformers with the `--load-in-4bit` flag.\nOobabooga ran multiple experiments in an excellent [blog post](https://oobabooga.github.io/blog/posts/perplexities/) that compare different models in terms of perplexity (lower is better):\n![](https://assets.insightmediagroup.io/media/wp-content/uploads/2023/09/1yz7rSvjKtukVXdVHwxGfAQ.png)\nBased on these results, we can say that GGML models have a slight advantage in terms of perplexity. The difference is not particularly significant, which is why it is better to focus on the generation speed in terms of tokens/second. The best technique depends on your GPU: if you have enough VRAM to fit the entire quantized model, **GPTQ with ExLlama** will be the fastest. If that's not the case, you can offload some layers and use **GGML models with llama.cpp** to run your LLM.\n## Conclusion\nIn this article, we introduced the GGML library and the new GGUF format to efficiently store these quantized models. We used it to **quantize our own Llama model** in different formats (Q4_K_M and Q5_K_M). We then ran the GGML model and pushed our bin files to the Hugging Face Hub. Finally, we delved deeper into GGML's code to understand how it actually quantizes the weights and compared it to NF4 and GPTQ.\nQuantization is a formidable vector to democratize LLMs by lowering the cost of running them. In the future, mixed precision and other techniques will keep improving the performance we can achieve with quantized weights. Until then, I hope you enjoyed reading this article and learned something new.\nIf you're interested in more technical content around LLMs, [follow me on Medium](https://medium.com/@mlabonne).\n## Articles about quantization\n> [**Part 1: Introduction to Weight Quantization**](https://towardsdatascience.com/introduction-to-weight-quantization-2494701b9c0c)\n> [**Part 2: 4-bit Quantization with GPTQ**](https://towardsdatascience.com/4-bit-quantization-with-gptq-36b0f4f02c34)\n* * *\n_Learn more about machine learning and support my work with one click - become a Medium member here:_\n> [**Join Medium with my referral link - Maxime Labonne**](https://medium.com/@mlabonne/membership)\n## Register Now to Continue Reading\n### Unlock Towards Data Science with a Free Account\nAll articles on Towards Data Science are available to registered users. Create a free account today to access this article and thousands more.\nRegister for freeSign in to your account\n* * *\n![](https://assets.insightmediagroup.io/media/1787657499317_sxy3ci.png)\nWritten By\n## [Maxime Labonne](https://towardsdatascience.com/author/mlabonne/)\n[See all from Maxime Labonne](https://towardsdatascience.com/author/mlabonne/)\n[Data Science](https://towardsdatascience.com/tag/data-science/)[Large Language Models](https://towardsdatascience.com/tag/large-language-models/)[Machine Learning](https://towardsdatascience.com/tag/machine-learning/)[Programming](https://towardsdatascience.com/tag/programming/)[Quantization](https://towardsdatascience.com/tag/quantization/)\nShare This Article\n  * [](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Ftowardsdatascience.com%2Fquantize-llama-models-with-ggml-and-llama-cpp-3612dfbcc172%2F&title=Quantize%20Llama%20models%20with%20GGUF%20and%20llama.cpp)\n  * [](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Ftowardsdatascience.com%2Fquantize-llama-models-with-ggml-and-llama-cpp-3612dfbcc172%2F&title=Quantize%20Llama%20models%20with%20GGUF%20and%20llama.cpp)\n  * [](https://x.com/share?url=https%3A%2F%2Ftowardsdatascience.com%2Fquantize-llama-models-with-ggml-and-llama-cpp-3612dfbcc172%2F&text=Quantize%20Llama%20models%20with%20GGUF%20and%20llama.cpp)\n\n\nTowards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.\n[Write for TDS](https://towardsdatascience.com/submissions/)\n## Related Articles\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/10/1C-OHZ__xsiJeY7fzXA0OTg.png)](https://towardsdatascience.com/metrics-matter-b282c20d5eab/)\n## [Metrics Matter](https://towardsdatascience.com/metrics-matter-b282c20d5eab/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nEvaluation Metrics for Supervised Classification Models\n[Jamil Mirabito](https://towardsdatascience.com/author/jamilmirabito/)\nOctober 6, 20207 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/05/1m9zX3GyK0ZJu6lhiFS1wtw-scaled.jpeg)](https://towardsdatascience.com/does-machine-learning-know-when-im-scared-anomaly-detection-in-wearable-health-data-72f537dd4370/)\n## [Does Machine Learning know when I'm scared? Anomaly detection in wearable health data](https://towardsdatascience.com/does-machine-learning-know-when-im-scared-anomaly-detection-in-wearable-health-data-72f537dd4370/)\n[Machine Learning](https://towardsdatascience.com/category/artificial-intelligence/machine-learning/)\nAn opportunity to build autoencoders in Keras using real-life Fitbit measurements. Wearable health devices like...\n[Elliot Humphrey](https://towardsdatascience.com/author/elz1582/)\nMay 2, 202112 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2022/05/1heGyzAlvvMg8aQYNbUVN1w.jpeg)](https://towardsdatascience.com/closing-the-gap-between-machine-learning-and-human-learning-536720af00cd/)\n## [Closing the Gap between Machine Learning and Human Learning](https://towardsdatascience.com/closing-the-gap-between-machine-learning-and-human-learning-536720af00cd/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nAdvances in Large Language Modeling\n[Poornachandra Sarang](https://towardsdatascience.com/author/profsarang/)\nMay 5, 20226 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/04/1DPeAwb512PBBKkgX4ilmyA.jpeg)](https://towardsdatascience.com/strings-and-text-in-python-50be0452e0d3/)\n## [Strings and Text in Python](https://towardsdatascience.com/strings-and-text-in-python-50be0452e0d3/)\n[Programming](https://towardsdatascience.com/category/programming/)\nSplitting Strings and Matching Texts\n[Sadrach Pierre, Ph.D.](https://towardsdatascience.com/author/spierre91/)\nApril 13, 20203 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2020/09/1OtzhATqOP3YleD2h1rV17A.jpeg)](https://towardsdatascience.com/compare-amazon-textract-with-tesseract-ocr-ocr-nlp-use-case-43ad7cd48748/)\n## [Compare Amazon Textract with Tesseract OCR - OCR & NLP Use Case](https://towardsdatascience.com/compare-amazon-textract-with-tesseract-ocr-ocr-nlp-use-case-43ad7cd48748/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nComparison of two known engines for optical character recognition (OCR) and Naturtal Language Processing\n[Manoj Kukreja](https://towardsdatascience.com/author/mkukreja1/)\nSeptember 17, 20205 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2025/07/0_oV1aB_5Q7gVWkdM_.webp)](https://towardsdatascience.com/are-you-being-unfair-to-llms/)\n## [Are You Being Unfair to LLMs?](https://towardsdatascience.com/are-you-being-unfair-to-llms/)\n[Large Language Models](https://towardsdatascience.com/category/artificial-intelligence/large-language-models/)\nThey may deserve better.\n[Julian von Mendel](https://towardsdatascience.com/author/julian.mendel/)\nJuly 11, 20258 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2019/06/14XgZSEjQ1qC9eK1XBAYlzw.jpeg)](https://towardsdatascience.com/basics-of-bash-for-beginners-92e53a4c117a/)\n## [Basics of BASH for Beginners.](https://towardsdatascience.com/basics-of-bash-for-beginners-92e53a4c117a/)\n[Programming](https://towardsdatascience.com/category/programming/)\nLearn about some of the most useful BASH commands and the utility they offer.\n[Parul Pandey](https://towardsdatascience.com/author/pandeyparul/)\nJune 29, 201911 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/07/0-HzBnvRt8KVJkLGc-scaled.jpg)](https://towardsdatascience.com/defeating-big-brother-with-glasses-an-attack-on-facial-recognition-neural-networks-1b0ccbd94fa2/)\n## [Defeating Big Brother with Glasses: An Attack on Facial Recognition Neural Networks](https://towardsdatascience.com/defeating-big-brother-with-glasses-an-attack-on-facial-recognition-neural-networks-1b0ccbd94fa2/)\n[Artificial Intelligence](https://towardsdatascience.com/category/artificial-intelligence/)\nRead on to learn about an innovative approach to combat deep learning-based facial recognition.\n[Wilson Wang](https://towardsdatascience.com/author/wilson-wang/)\nJuly 9, 20216 min read\n  * [![](https://assets.insightmediagroup.io/media/wp-content/uploads/2021/11/1secLL0ZugwixCN_PeBrO2w-scaled.jpeg)](https://towardsdatascience.com/speech-recognition-python-assemblyai-bb5024d322d8/)\n## [How to Perform Speech Recognition with Python](https://towardsdatascience.com/speech-recognition-python-assemblyai-bb5024d322d8/)\n[Deep Learning](https://towardsdatascience.com/category/artificial-intelligence/deep-learning/)\nPerforming Speech-to-Text with AssemblyAI API in Python\n[Giorgos Myrianthous](https://towardsdatascience.com/author/gmyrianthous/)\nNovember 12, 20214 min read\n\n\n  * [YouTube](https://www.youtube.com/c/TowardsDataScience)\n  * [X](https://x.com/TDataScience)\n  * [LinkedIn](https://www.linkedin.com/company/towards-data-science/)\n  * [Threads](https://www.threads.net/@towardsdatascience)\n  * [Bluesky](https://bsky.app/profile/towardsdatascience.com)\n\n\n[](https://towardsdatascience.com/)\nYour home for data science and AI. The world's leading publication for data science, data analytics, data engineering, machine learning, and artificial intelligence professionals.\nSubscribe to Our Newsletter[Write For TDS](https://towardsdatascience.com/submissions/)•[About](https://towardsdatascience.com/about-towards-data-science-d691af11cc2f/)•[Advertise](https://contact.towardsdatascience.com/advertise-with-towards-data-science)•[Privacy Policy](https://towardsdatascience.com/privacy-policy/)•[Terms of Use](https://towardsdatascience.com/website-terms-of-use/)\n© Insight Media Group, LLC 2026•[The New Stack](https://thenewstack.io)•[roadmap.sh](https://roadmap.sh)•[Creator Network](https://insightmediagroup.io/creator-network)\n####  Recommended Articles \nClose\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3642/image?etag=1780830904480&width=500&height=500) Check Your Biases ](https://towardsdatascience.com/check-your-biases-ba2685a7f799/ \"Check Your Biases\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/607930/image?etag=1782124566054&width=500&height=500) The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs ](https://towardsdatascience.com/subset-sum-problem-solved-in-linear-time-for-dense-enough-inputs/ \"The Subset Sum Problem Solved in Linear Time for Dense Enough Inputs\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/3660/image?etag=1780176246070&width=500&height=500) Does Your Company Have a Data Strategy? ](https://towardsdatascience.com/does-your-company-have-a-data-strategy-e8944dbec4ae/ \"Does Your Company Have a Data Strategy?\")\n  * [ ![](https://h030.towardsdatascience.com/rest/v2/contentStores/d7d3a4ab-7caf-4383-bbd2-fbf7fb4f1787/items/4973/image?etag=1782232567105&width=500&height=500) Machine Learning Tricks, Learning with ChatGPT, and Other Recent Must-Reads ](https://towardsdatascience.com/machine-learning-tricks-learning-with-chatgpt-and-other-recent-must-reads-f277648a1921/ \"Machine Learning Tricks, Learning with ChatGPT, and Other Recent Must-Reads\")\n\n\nword word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word\n  \nmmMwWLliI0fiflO&1  \nmmMwWLliI0fiflO&1  \nmmMwWLliI0fiflO&1  \nmmMwWLliI0fiflO&1  \nmmMwWLliI0fiflO&1  \nmmMwWLliI0fiflO&1  \nmmMwWLliI0fiflO&1\n",
  "metadata": {
    "title": "Quantize Llama models with GGUF and llama.cpp | Towards Data Science",
    "description": "GGML vs. GPTQ vs. NF4",
    "keywords": null,
    "author": "Maxime Labonne",
    "og:locale": "en_US",
    "og:type": "article",
    "og:title": "Quantize Llama models with GGUF and llama.cpp",
    "og:description": "GGML vs. GPTQ vs. NF4",
    "og:url": "https://towardsdatascience.com/quantize-llama-models-with-ggml-and-llama-cpp-3612dfbcc172/",
    "og:site_name": "Towards Data Science",
    "og:image": "https://assets.insightmediagroup.io/media/wp-content/uploads/2023/09/18hOKzslGLcauIFuI0r1S-Q.png",
    "og:image:width": "1920",
    "og:image:height": "1080",
    "og:image:type": "image/png",
    "twitter:card": "summary_large_image",
    "twitter:site": "@TDataScience",
    "twitter:creator": "@TDataScience",
    "twitter:label1": "Written by",
    "twitter:data1": "Maxime Labonne",
    "twitter:label2": "Est. reading time",
    "twitter:data2": "9 min read",
    "article:published_time": "2023-09-04T14:02:03.000Z",
    "article:modified_time": "2023-09-04T14:02:03.000Z",
    "article:author": "https://towardsdatascience.com/author/mlabonne/"
  },
  "paywall": {
    "listed_paid": true,
    "detected": false,
    "marker": "",
    "public_only": true,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": "",
    "retried": true
  },
  "code_blocks": [
    {
      "language": "txt",
      "file": "attachments/fb2ec9bb2067/code/block_000.txt",
      "chars": 200
    },
    {
      "language": "txt",
      "file": "attachments/fb2ec9bb2067/code/block_001.txt",
      "chars": 119
    },
    {
      "language": "txt",
      "file": "attachments/fb2ec9bb2067/code/block_002.txt",
      "chars": 182
    },
    {
      "language": "txt",
      "file": "attachments/fb2ec9bb2067/code/block_003.txt",
      "chars": 202
    },
    {
      "language": "txt",
      "file": "attachments/fb2ec9bb2067/code/block_004.txt",
      "chars": 461
    },
    {
      "language": "txt",
      "file": "attachments/fb2ec9bb2067/code/block_005.txt",
      "chars": 131
    },
    {
      "language": "txt",
      "file": "attachments/fb2ec9bb2067/code/block_006.txt",
      "chars": 136
    },
    {
      "language": "txt",
      "file": "attachments/fb2ec9bb2067/code/block_007.txt",
      "chars": 543
    },
    {
      "language": "txt",
      "file": "attachments/fb2ec9bb2067/code/block_008.txt",
      "chars": 133
    }
  ],
  "images": [
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2023/09/18hOKzslGLcauIFuI0r1S-Q.png",
      "alt": "Image by author",
      "local_path": "attachments/fb2ec9bb2067/images/000.png",
      "bytes": 2578171,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2023/09/10UGhhiepQRjxnbHX1bR1Ow.gif",
      "alt": "Image by author",
      "local_path": "attachments/fb2ec9bb2067/images/001.gif",
      "bytes": 470400,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2020/10/1C-OHZ__xsiJeY7fzXA0OTg.png",
      "alt": "",
      "local_path": "attachments/fb2ec9bb2067/images/002.png",
      "bytes": 19950,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/05/1m9zX3GyK0ZJu6lhiFS1wtw-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/fb2ec9bb2067/images/003.jpeg",
      "bytes": 645974,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2022/05/1heGyzAlvvMg8aQYNbUVN1w.jpeg",
      "alt": "",
      "local_path": "attachments/fb2ec9bb2067/images/004.jpeg",
      "bytes": 312761,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2020/04/1DPeAwb512PBBKkgX4ilmyA.jpeg",
      "alt": "",
      "local_path": "attachments/fb2ec9bb2067/images/005.jpeg",
      "bytes": 113210,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2020/09/1OtzhATqOP3YleD2h1rV17A.jpeg",
      "alt": "",
      "local_path": "attachments/fb2ec9bb2067/images/006.jpeg",
      "bytes": 374823,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2025/07/0_oV1aB_5Q7gVWkdM_.webp",
      "alt": "",
      "local_path": "attachments/fb2ec9bb2067/images/007.webp",
      "bytes": 29338,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2019/06/14XgZSEjQ1qC9eK1XBAYlzw.jpeg",
      "alt": "",
      "local_path": "attachments/fb2ec9bb2067/images/008.jpeg",
      "bytes": 87437,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/07/0-HzBnvRt8KVJkLGc-scaled.jpg",
      "alt": "",
      "local_path": "attachments/fb2ec9bb2067/images/009.jpg",
      "bytes": 871301,
      "downloaded": true
    },
    {
      "src": "https://assets.insightmediagroup.io/media/wp-content/uploads/2021/11/1secLL0ZugwixCN_PeBrO2w-scaled.jpeg",
      "alt": "",
      "local_path": "attachments/fb2ec9bb2067/images/010.jpeg",
      "bytes": 160523,
      "downloaded": true
    }
  ],
  "audio": [],
  "videos": [],
  "links": [],
  "retry_at": "2026-10-03T07:59:21",
  "repair_version": 2,
  "repaired_at": "2026-10-14T11:11:48Z",
  "source_url": "https://towardsdatascience.com/quantize-llama-models-with-ggml-and-llama-cpp-3612dfbcc172/",
  "delivery_status": "excluded_paid",
  "discovery_status": "excluded_paid",
  "missing_reason": "按原约定排除付费/会员全文"
}