<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Intel(R) Neural Compressor &amp; AutoRound on Medium]]></title>
        <description><![CDATA[Stories by Intel(R) Neural Compressor &amp; AutoRound on Medium]]></description>
        <link>https://medium.com/@NeuralCompressor?source=rss-6d8c9480b0b9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LJFjUvKrfxuI8yPLkLK3gg.png</url>
            <title>Stories by Intel(R) Neural Compressor &amp;amp; AutoRound on Medium</title>
            <link>https://medium.com/@NeuralCompressor?source=rss-6d8c9480b0b9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 15:09:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@NeuralCompressor/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Diffusion in AutoRound: Low‑Bit Quantization for Video and Image Generation Models]]></title>
            <link>https://medium.com/@NeuralCompressor/diffusion-in-autoround-low-bit-quantization-for-video-and-image-generation-models-952d00b064d0?source=rss-6d8c9480b0b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/952d00b064d0</guid>
            <category><![CDATA[mxfp8]]></category>
            <category><![CDATA[intel-neural-compressor]]></category>
            <category><![CDATA[vllm]]></category>
            <category><![CDATA[mxfp]]></category>
            <category><![CDATA[diffusion-models]]></category>
            <dc:creator><![CDATA[Intel(R) Neural Compressor & AutoRound]]></dc:creator>
            <pubDate>Sun, 28 Dec 2025 00:47:19 GMT</pubDate>
            <atom:updated>2025-12-28T00:51:18.895Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*G-_ZEHBlxmdl2BWO" /><figcaption>Photo by <a href="https://unsplash.com/@jupp?utm_source=medium&amp;utm_medium=referral">Jonathan Kemper</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Overview</strong></p><p>Following continuous iterations and development, we are delighted to share that quantization for diffusion models is now supported in AutoRound v0.9.3, which breaks through the previous model scope of AutoRound.</p><p><strong>What is AutoRound?</strong></p><p>AutoRound is an advanced post-training quantization (PTQ) toolkit designed for Large Language Models (LLMs), Vision-Language Models (VLMs) as well as diffusion models. It uses signed gradient descent to optimize rounding values and weight clipping, delivering exceptional results across 2 to 4 bits.</p><p>For more details, please refer to the paper <a href="https://arxiv.org/abs/2309.05516">https://arxiv.org/abs/2309.05516</a> and the github repository <a href="https://github.com/intel/auto-round">https://github.com/intel/auto-round</a>.</p><p><strong>Why Diffusion in AutoRound?</strong></p><p>Diffusion models have advanced generative AI by delivering state-of-the-art performance in image synthesis, video generation, and multimodal content creation. However, compared to previous LLMs and VLMs, the structure of diffusion models has undergone changes that are hard to overlook. Diffusion models typically consist of several components, which makes previous quantization procedure unsuitable for direct application to them. Supporting diffusion models in AutoRound can:</p><p>· Provides a toolkit that can validate the accuracy of diffusion models with different data types easily, e.g., MXFP8, MXFP4 and NVFP4</p><p>· Expand AutoRound’s compatibility and support scope for diverse models</p><p><strong>Diffusion Support Overview</strong></p><p><strong>1. Model Support</strong></p><p>Currently, we have successfully validated the quantization functionality for two generative models: the text-to-image model Flux​ and the image-to-video model Framepack.</p><p>For Flux, there is a comprehensive pipeline class that orchestrates all components end-to-end, and we support both Round-To-Nearest (RTN) quantization​ and accuracy tuning methods.</p><p>In contrast, Framepack​ requires independent loading of its components and users need to manually perform inference on each module sequentially. Due to this decentralized architecture, support is currently limited to RTN quantization.</p><p><strong>2. Usage</strong></p><p>2.1 Load diffusion pipeline or transformer component</p><pre>from diffusers import AutoPipelineForText2Image<br># load pipeline<br>pipe = AutoPipelineForText2Image.from_pretrained(model_name, torch_dtype=torch.bfloat16)<br><br># or load backbone<br>from diffusers_helper.models.hunyuan_video_packed import HunyuanVideoTransformer3DModelPacked<br>transformer = HunyuanVideoTransformer3DModelPacked.from_pretrained(<br>&#39;lllyasviel/FramePackI2V_HY&#39;, torch_dtype=torch.bfloat16)<br>setattr(transformer, &quot;name_or_path&quot;, &quot;lllyasviel/FramePackI2V_HY&quot;)</pre><p>2.2 Quantize and save model with AutoRound</p><pre>from auto_round import AutoRoundDiffusion, AutoRound<br># tuning<br>autoround = AutoRoundDiffusion(<br>pipe, layer_config=layer_config, batch_size=1, iters=200, nsamples=2, guidance_scale=7.5, num_inference_steps=3, scheme=&quot;MXFP8&quot;, dataset=&quot;captions_source.tsv&quot;)<br>autoround.quantize_and_save(format=&quot;fake&quot;, output_dir=&quot;ar_tuning_model&quot;)<br><br># RTN for backbone<br>autoround = AutoRound(transformer, tokenizer=None, batch_size=1, iters=0, scheme=&quot;MXFP8&quot;)<br>autoround.quantize_and_save(format=&quot;fake&quot;, output_dir=&quot;ar_rtn_model&quot;)</pre><p>2.3 Validate the output with quantized model</p><pre>from auto_round import AutoRoundDiffusion<br>autoround = AutoRoundDiffusion(<br>pipe, layer_config=layer_config, batch_size=1, iters=200, nsamples=2, guidance_scale=7.5, num_inference_steps=3, scheme=&quot;MXFP8&quot;, dataset=&quot;captions_source.tsv&quot;)<br>autoround.quantize()<br>prompt = &quot;A cat holding a sign that says hello world&quot;<br>image = pipe(<br>    prompt,<br>    height=1024,<br>    width=1024,<br>    guidance_scale=3.5,<br>    num_inference_steps=50,<br>    max_sequence_length=512,<br>).images[0]</pre><p><strong>3. Validated results</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ab0wuDGiFx_NByzL59-CUg.png" /><figcaption>Accuracy of Fluxand FramePack</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6uTN47Q07w5G7iFaF3FEIw.png" /><figcaption>Images generated by BF16 Flux.1-dev</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3c8khkM5YmPAXR6tpwuS6A.png" /><figcaption>Images generated by MXFP8 Flux.1-dev</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e9n4xGsMzJzaVce4y2eHDQ.png" /><figcaption>Images generated by MXFP4 Flux.1-dev</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lcUsBDen9YdyOko0Al7yuQ.png" /><figcaption>Images generated by NVFP4 Flux.1-dev</figcaption></figure><p><strong>Conclusion</strong></p><p>AutoRound now provides preliminary support for quantizing diffusion models. However, this implementation remains in its early stages with some constraints:</p><p>· Deployment Limitations: Quantized models currently require inference through SW emulation. We plan to add the kernel support and integrate with mainstream deployment frameworks.</p><p>· Limited Model Support: Currently, the validated model list is limited and only a subset of diffusion architecture is supported.</p><p><strong>Future Roadmap​</strong></p><p>To make the support of diffusion models in AutoRound more robust, our team is actively addressing the challenges through:</p><p>· Standardized API Development: Designing a high compatibility interface for seamless quantized model loading and deployment.</p><p>· Model Expansion: Prioritizing high-demand architectures (e.g., Wan) and optimizing support for diffusion models without a comprehensive pipeline.</p><p>Welcome contributions to AutoRound — whether in diffusion, or any other area you’re passionate about!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=952d00b064d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Accelerating vLLM and SGLang Deployment using AutoRound]]></title>
            <link>https://medium.com/intel-analytics-software/accelerating-vllm-and-sglang-deployment-using-autoround-45fdc0b2683e?source=rss-6d8c9480b0b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/45fdc0b2683e</guid>
            <dc:creator><![CDATA[Intel(R) Neural Compressor & AutoRound]]></dc:creator>
            <pubDate>Fri, 31 Oct 2025 10:02:59 GMT</pubDate>
            <atom:updated>2025-11-03T01:41:24.701Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pAWrOj_G5YnUYrrujBf0yg.jpeg" /></figure><h4>AutoRound: A Leading Quantization Algorithm for LLMs/VLMs</h4><blockquote>Team Intel Neural Compressor, Intel Corporation</blockquote><p><strong>Project Homepage:</strong> <a href="https://github.com/intel/auto-round">https://github.com/intel/auto-round</a></p><p><strong>Installation:</strong> pip install auto-round</p><p><strong>Demo Usage:</strong></p><pre>auto-round \<br>    --model Qwen/Qwen3-0.6B \<br>    --scheme &quot;W4A16&quot; \<br>    --format &quot;auto_round&quot; \<br>    --output_dir Qwen3-0.6B-AutoRound</pre><p>AutoRound is an advanced quantization algorithm library for Large Language Models (LLMs) and Vision-Language Models (VLMs), supporting <strong>CPU</strong>, <strong>Intel GPU</strong>, <strong>CUDA</strong>, and <strong>HPU</strong> hardware. Throughout 2025, AutoRound continuously released innovative features, focusing on ultra-low bit quantization (2–4 bits) and high-accuracy inference, while integrating seamlessly with major AI ecosystems. This review covers key progress in engineering, algorithms, and ecosystem expansion, and includes representative demo code.</p><p><strong>1. Engineering Innovations</strong></p><p><strong>1.1 GGUF Format Support</strong></p><p>AutoRound now supports the next-generation GGUF model format, enabling efficient cross-platform migration and deployment. Example quantized models can be found on Hugging Face, such as <a href="https://huggingface.co/Intel/Qwen3-Coder-30B-A3B-Instruct-gguf-q2ks-mixed-AutoRound">Qwen3-Coder-30B-A3B-Instruct-gguf-q2ks-mixed-AutoRound</a>.</p><pre>./llama-cli -hf Intel/Qwen3-Coder-30B-A3B-Instruct-gguf-q2ks-mixed-AutoRound</pre><p><strong>1.2 MXFP4 and NVFP4 Quantization</strong></p><p>AutoRound introduced experimental support for mxfp4 and nvfp4 floating-point quantization formats, targeting modern general-purpose and NVIDIA GPU hardware, respectively. These formats achieve extremely low memory consumption and high inference performance.</p><p><strong>2. Algorithmic Breakthroughs</strong></p><p><strong>2.1 INT2 Quantization Algorithm</strong></p><p>AutoRound implemented a more accurate 2-bit integer quantization (INT2) algorithm, using innovative calibration and optimization strategies to significantly improve model usability. This can be enabled via the ` — enable_alg_ext` command-line option. See [<a href="https://github.com/intel/auto-round/blob/main/docs/alg_202508.md">documentation</a>] for more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ogOQlWRS77Tpl48eXD4Q6A.png" /><figcaption>Fig 2. INT2 Accuracy improvement w/o and w/ alg_ext</figcaption></figure><p><strong>2.2 Extended GGUF: Enhanced Precision and Flexibility</strong></p><ul><li><strong>Enhanced Model Accuracy:</strong> We’ve refined the core quantization algorithm in llamacpp to deliver higher precision. As observed by the community, these improvements yield notably better accuracy for specific model families. A further enhanced algorithm is currently in development and will be released soon.</li><li><strong>Granular Bit-Width Control:</strong> Move beyond fixed configurations. AutoRound now supports per-layer bit-width settings, giving you precise control over the quantization process to balance model size and performance for your specific needs.</li><li><strong>Optimized Performance &amp; Efficiency:</strong> Leveraging advanced block-wise packing and imatrix-based computation, AutoRound now achieves superior memory efficiency during the quantization process. This optimization is particularly impactful when working with ultra-large models.</li></ul><p><strong>2.3 MXFP4 and NVFP4 Quantization Algorithm</strong></p><p>AutoRound significantly improves accuracy without affecting the representation of MXFP4 and NVFP4 data. See [<a href="https://github.com/intel/auto-round/blob/main/docs/mxnv_acc.md">documentation</a>] for details.</p><figure><img alt="Fig 1. MXFP4 and NVFP4 accuracy improvement" src="https://cdn-images-1.medium.com/max/800/1*QzKIOfZ5EJAfru_ym97kGw.png" /><figcaption>Fig 1. MXFP4 and NVFP4 accuracy improvement w/o and w/ alg_ext</figcaption></figure><p><strong>3. Ecosystem Expansion</strong></p><p><strong>3.1 Hugging Face Integration</strong></p><p>AutoRound is deeply integrated with the <a href="https://huggingface.co/blog/autoround">Hugging Face ecosystem</a>. Quantization tools and models are available for one-click use on the HF platform, with extensive documentation and resources for the community.</p><pre>from transformers import AutoModelForCausalLM, AutoTokenizer<br>quantized_model_dir = &quot;Intel/DeepSeek-R1-0528-Qwen3-8B-int4-AutoRound&quot;<br>model = AutoModelForCausalLM.from_pretrained(<br>    quantized_model_dir,<br>    torch_dtype=&quot;auto&quot;,<br>    device_map=&quot;auto&quot;,<br>)</pre><p><strong>3.2 vLLM Compatibility</strong></p><p>With the rise of high-performance inference frameworks like VLLM and VLLMS, AutoRound has implemented compatible interfaces, supporting a variety of hardware and distributed inference scenarios.</p><pre>from vllm import LLM, SamplingParams<br>model_name = &quot;Intel/DeepSeek-R1-0528-Qwen3-8B-int4-AutoRound&quot;<br>llm = LLM(model=model_name)</pre><p><strong>3.2 SGLang Compatibility</strong></p><p>With the rise of high-performance inference frameworks like VLLM and VLLMS, AutoRound has implemented compatible interfaces, supporting a variety of hardware and distributed inference scenarios.</p><pre>import sglang as sgl<br>model_name = &quot;Intel/DeepSeek-R1-0528-Qwen3-8B-int4-AutoRound&quot;<br>llm = sgl.Engine(model_path=model_name)</pre><p><strong>Conclusion</strong></p><p>In 2025, AutoRound achieved remarkable results in engineering, algorithm innovation, and ecosystem integration. Looking ahead, AutoRound will continue to optimize quantization algorithms and expand ecosystem interfaces, enabling large models to be deployed in more real-world scenarios. Visit the [<a href="https://github.com/intel/auto-round">project homepage</a>] or [<a href="https://huggingface.co/Intel">Hugging Face Model Hub</a>] to experience the latest features and models!</p><p>Appreciate ⭐ starring⭐ the project if you find it’s helpful for your LLM deployment.</p><p><strong>Acknowledgements</strong></p><p>Special thanks to open-source community including frameworks like vLLM, SGLang, PyTorch TorchAO, and HuggingFace Transformers for providing the integration support, and low precision libraries such as AutoGPTQ, AutoAWQ, GPTQModel, Triton, Marlin, and ExLLaMAV2 for providing the low-precision kernels.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45fdc0b2683e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intel-analytics-software/accelerating-vllm-and-sglang-deployment-using-autoround-45fdc0b2683e">Accelerating vLLM and SGLang Deployment using AutoRound</a> was originally published in <a href="https://medium.com/intel-analytics-software">Intel Analytics Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 Tips for Quantizing LLMs and VLMs with AutoRound]]></title>
            <link>https://medium.com/intel-analytics-software/10-tips-for-quantizing-llms-and-vlms-with-autoround-923e733879a7?source=rss-6d8c9480b0b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/923e733879a7</guid>
            <category><![CDATA[quantization]]></category>
            <category><![CDATA[compression]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[vlm]]></category>
            <dc:creator><![CDATA[Intel(R) Neural Compressor & AutoRound]]></dc:creator>
            <pubDate>Fri, 22 Nov 2024 13:38:38 GMT</pubDate>
            <atom:updated>2024-12-24T08:13:20.032Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://github.com/intel/auto-round">AutoRound</a> V0.4 has been released, featuring major updates to experimentally support Vision-Language Models (VLMs), and many quantized models have been unstreamed in <a href="https://huggingface.co/OPEA">OPEA HF space</a>. in In this article, we will introduce this key feature, share tips and tricks for quantizing both LLMs and VLMs, and explain how to use AutoRound in torchao.</p><p>We recommend users refer to the detailed <a href="https://github.com/intel/auto-round/blob/main/auto_round/mllm/README.md">README</a> for guidance on quantizing VLMs. In most cases, the process is straightforward if the model could be supported by transformers, <em>but you may need to install specific libraries to run the original model.</em></p><pre>from auto_round import AutoRoundMLLM <br>from transformers import Qwen2VLForConditionalGeneration, AutoProcessor, AutoTokenizer <br> <br>##load the model<br>model_name = &quot;Qwen/Qwen2-VL-2B-Instruct&quot; <br>tokenizer = AutoTokenizer.from_pretrained(model_name) <br>processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=trust_remote_code) <br>model = Qwen2VLForConditionalGeneration.from_pretrained( <br>    model_name, trust_remote_code=True)  <br> <br>##quantize the model <br>bits, group_size = 4, 128 <br>autoround = AutoRoundMLLM(model, tokenizer, processor, bits=bits, group_size=group_size) <br>autoround.quantize() <br><br>##save the quantized model, set format=&#39;auto_gptq&#39; to use AutoGPTQ format<br>output_dir = &quot;./tmp_autoround&quot; <br>autoround.save_quantized(output_dir, format=&#39;auto_round&#39;, inplace=True) </pre><p>Besides, we provide a command usage for five model families, they are Qwen/Qwen2-VL-Instruct, meta-llama/Llama-3.2-Vision-Instruct, microsoft/Phi-3.5-vision-instruct,liuhaotian/llava-v1.5, THUDM/cogvlm2-llama3-chat. <strong>Due to the limited support, we recommend using the API.</strong></p><pre>auto-round-mllm --model Qwen/Qwen2-VL-2B-Instruct --format &quot;auto_gptq,auto_round&quot; --output_dir &quot;./tmp_autoround&quot;</pre><p>For model-specific accuracy data/inference/quantization, please refer to our recipes for these models</p><p><a href="https://github.com/intel/auto-round/blob/main/docs/Qwen2-VL-7B-Instruct_sym.md">Qwen/Qwen2-VL-7B-Instruct-Recipe</a></p><p><a href="https://github.com/intel/auto-round/blob/main/docs/cogvlm2-llama3-chat-19B_sym.md">THUDM/cogvlm2-llama3-chat-19B-Recipe</a></p><p><a href="http://meta-llama/Llama-3.2-Vision">meta-llama/Llama-3.2–11B-Vision-Recipe</a></p><p><a href="https://github.com/intel/auto-round/blob/main/docs/Phi-3.5-vision-instruct_sym.md">microsoft/Phi-3.5-vision-instruct-Recipe</a></p><p><a href="https://github.com/intel/auto-round/blob/main/docs/llava-v1.5-7b_sym.md">liuhaotian/llava-v1.5–7B-Recipe</a></p><h3>Tips and Tricks</h3><p>In the following, we present tips and tricks for quantizing VLMs and LLMs. Please note that due to the limited scope of our experiments, these tips may not always be applicable.</p><h3>1. VLM Quantization and Calibration Dataset Choice</h3><p><strong>Suggestion: Prioritize quantizing only the language component and use a language-only dataset for calibration</strong>. AutoRound sets this as the default, but users can opt for other configurations for certain models.</p><p><strong>Background:</strong> VLM models typically consist of two main components: a language model and a vision model. This raises two key questions:</p><ul><li>Should all components be quantized?</li><li>Should the calibration dataset include visual data?</li></ul><p><strong>Reason 1: </strong>Language module dominates the parameters numbers and quantizing the vision module leads to greater accuracy loss , making it less cost-effective to quantize. Our experiments on Qwen1 and LLaVA revealed that quantizing the vision module caused significant accuracy degradation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N5ZwMJyJFCFYEXhjZMKlnQ.png" /></figure><p><strong>Reason 2</strong>:Quantizing the vision module involves more complex engineering and slower speed. Calibration requires datasets with image data, and each model has its own preprocessing methods for organizing image and text data, which can be complex. Additionally, because these models support images of varying sizes, calibration samples must be processed with a batch size of 1 and gradient accumulation steps, which is both slow and prone to precision risks. For more details, you can refer to <a href="https://unsloth.ai/blog/gradient">this blog</a>. We’ve incorporated fixes from their approach into AutoRound.</p><p><strong>Reason 3:</strong> Quantizing the language module using only text data for calibration yields similar results to using image-text paired datasets in our experiments. However, for some models (such as MLLama), quantizing only the language module may still require image-text paired datasets for calibration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3BM6xwIoO-Y8k9C2tTwFVg.png" /></figure><h3>2. Symmetric vs. Asymmetric Quantization</h3><p><strong>Suggestion:</strong> <strong>we recommend using full-range symmetric quantization</strong>, which AutoRound has set as the default.</p><p><strong>Background:</strong> While asymmetric quantization is often considered to provide better precision than symmetric quantization, it comes with performance trade-offs. In weight quantization scenarios, symmetric quantization can leverage optimized kernels like the Marlin kernel, resulting in significant performance improvements. Consequently, choosing between symmetric and asymmetric quantization can be challenging.</p><p><strong>Reasoning: To my beset knowledge, full-range symmetric quantization was first introduced by the LlamaCPP community.</strong> Based on our experiments, its precision is comparable to asymmetric quantization, and it outperforms other symmetric quantization variants, particularly in low-bit scenarios like 2-bit quantization. Average accuracy across 10 tasks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NDPM-c_PGCEpwe02WJBmvw.png" /></figure><p><strong>Further Explanation:</strong> One key benefit of full-range symmetric quantization is its broader mapping range. For example, in 2-bit quantization, the range extends from -2 to 2, which is then clipped to the range (-2, 1). This behavior is similar to data types like NF4 or FP4, where the sampling density is higher in the lower value ranges and lower in the higher ranges. In contrast, traditional symmetric quantization maps values to the range (-1, 1). Additionally, full-range symmetric quantization avoids rounding errors for the zero point, as there is no zero-point offset to account for. Special thanks to Luo Yu for the insightful discussion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*qBV_S2vPgOFuIHt-VYHK4Q.png" /><figcaption>An illustration of full range symmetric</figcaption></figure><h3>3. Should the LM-head Be Quantized?</h3><p><strong>Suggestion: It can be used for models with parameters≥ 7B and ≤14B </strong>. In AutoRound, simply use auto-round --model xxx --quant_lm_head.</p><p><strong>Background:</strong> As large language models (LLMs) have evolved, the vocabulary size has significantly increased, leading to a larger proportion of parameters being allocated to the LM-head. However, quantizing the LM-head may result in some accuracy loss, raising the question of whether it should be quantized.</p><p><strong>Reasoning:</strong> For models with 7B or more parameters, quantizing the LM-head has a minimal impact on accuracy and provides a reasonable compression rate. However, we observed that LM-head quantization could cause a significant accuracy drop on the IFEVAL task for Qwen2.5–14B-Instruct. Therefore, it’s recommended to verify the accuracy on your specific model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XcDbRLbnUhuDKs5dbRj0NQ.png" /></figure><h3>4. Be Cautious of Overflow Caused by Chat Templates</h3><p><strong>Suggestion: It is recommended not to quantize layers with large output values</strong>. In AutoRound, you can use --fp_layers &quot;xxx,xxx&quot; to exclude these layers.</p><p><strong>Background: </strong>When quantizing certain instruction-based models, we observed that accuracy was fine when evaluated with<strong> </strong>lm-eval-harness. However, when running with the chat template, the results were poor, with outputs like “!!!!”. Upon investigation, we discovered that intermediate results in the quantized model were producing INF values. This issue arises because many of the quantization kernels are in FP16, while the latest models typically use BF16, which has a significantly larger representable range than FP16. For example, we observed the following:</p><ul><li><strong>Qwen2–57B-A14B-Instruct</strong>: model.layers.3.mlp.shared_expert.down_proj goes from 30464 (without chat template) to 48128 (with chat template).</li><li><strong>Qwen2.5–32B-Instruct</strong>: model.layers.5.mlp.down_proj goes from 5952 (without chat template) to 14,000 (with chat template).</li></ul><p>Although these values fall within the FP16 range, during INT4 tuning, weight adjustments and matrix multiplication could cause the outputs to become excessively large. Even when a fake QDQ model runs fine, issues can still arise when using the INT4 kernel.</p><p><strong>Reasoning: </strong>While adjusting the quantization configuration (e.g., symmetric/asymmetric) or using clamp_to_range might solve this issue in some scenarios, fine-tuning configurations can be tedious, and clamp_to_range is not always effective. Therefore, it is often more efficient to revert to the original precision for these layers (and potentially their neighboring layers), as the number of outlier layers is typically small.</p><h3>5. Be Cautious of Underflow caused by Quantization Scales</h3><p><strong>Suggestion:</strong> <strong>clip the scale with a small threshold, such as 1e-5</strong>, this has been set as the default in AutoRound</p><p><strong>Background:</strong> When quantizing LLaMA 3.1 70B, we found that the accuracy was unstable across tasks — some tasks performed very well, while others performed poorly</p><p><strong>Reasoning</strong>: As mentioned earlier, since CUDA kernels are typically in FP16, the quantization scale is also converted to FP16. However, the precision of small numbers in FP16 is low, which makes it important to apply a protection to the low scale to avoid accuracy instability.</p><h3>6. Whether to enable fast norm/bias tuning</h3><p><strong>Suggestion: enable fast norm/bias tuning for W2 and MXFP W4A4</strong>, but the support is limited, we only support Llama, Qwen2, mistral,phi3. In AutoRound, simply use — enable_norm_bias_tuning`</p><p>Background: we proposed a fast tuning of linear bias and norm parameters within quantization space, you could find the details in the <a href="https://github.com/intel/auto-round/blob/main/docs/tuning_norm_bias.md">document</a>.</p><p><strong>Reasoning</strong>: we found it could improve the accuracy for W2 and MXFP W4A4.</p><h3>7. Model Data Type for Quantization</h3><p><strong>Background:</strong> Most modern models are in BF16, while many INT4 kernels support FP16. The question is whether to cast the data type before or after quantization.</p><p><strong>Suggestion:</strong> Follow the kernel and cast the model to FP16 before quantization. In AutoRound, you can use --model_dtype &quot;fp16&quot;.</p><p>Note: Data type cast could be device specific, for example, Intel Gaudi accelerator has better performance and kernel support for BF16, even for FP16 model, it is suggested to cast to BF16 before quantization.</p><p><strong>Reasoning:</strong> We found that this approach resulted in better accuracy for smaller models.</p><h3>8. Using torch.compile</h3><p><strong>Suggestion: Use </strong><strong>torch.compile if possible, but be aware that it may throw exceptions for some models, especially with lower versions of PyTorch</strong>. Starting from PyTorch 2.6, we have set using torch.compile as the default.</p><p><strong>Reasoning:</strong> torch.compile is useful to reduce tuning cost. Thanks Liu Yi for kind discussion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rlP0DK5mQiOJEAsUxoD6tw.png" /></figure><h3>9. Evaluation Tasks</h3><p><strong>Suggestions:</strong></p><ol><li><strong>Better not relying solely on PPL (Perplexity) for evaluation.</strong></li><li><strong>Incorporate tasks that use chat templates for instruct/chat models.</strong></li></ol><p><strong>Reasoning:</strong></p><ol><li>PPL is sensitive to outliers, as discussed in our paper. This can skew evaluation results, especially when extreme values are present.</li><li>PPL tends to overfit when the same dataset is used for calibrations, as demonstrated by multiple studies</li><li>To some extent, PPL is NOT “lower is better”</li><li>Using chat templates for evaluation (as mentioned in Tip 4) can verify whether the quantized model perform well with chat template.</li></ol><h3><strong>10. Tradeoff Between Tuning Resources and Accuracy</strong></h3><p><strong>Suggestion: </strong>We provide the auto-round, auto-round-fast, and auto-round-best commands for your convenience. <strong>For optimal accuracy, we recommend using </strong><strong>auto-round-best.</strong> Additionally, the --low_gpu_mem_usage flag can be helpful in some insufficient gpu memory scenarios.</p><h3>Integration to torchao</h3><p>AutoRound has been integrated into Torch. Its usage follows torchao’s calibration-based algorithm workflow, as outlined below. For more details, refer <a href="https://github.com/pytorch/ao/tree/main/torchao/prototype/autoround">here.</a></p><p>Due to implementation differences, we recommend setting batch_size=4 and gradient_accumulate_steps=2 to enhance sample randomness during tuning.</p><pre># Step 1: Prepare the Model<br>model = ...  # Load your model<br># Define a function to identify target modules for quantization.<br># For example, to apply Auto-Round to all decoder layers and the `lm-head` in a Llama model:<br>decoder_cls = transformers.models.llama.modeling_llama.LlamaDecoderLayer<br>is_target_module = lambda mod, fqn: isinstance(mod, decoder_cls) or &quot;lm_head&quot; in fqn<br># Prepare the model for Auto-Round<br>from torchao.prototype.autoround.core import prepare_model_for_applying_auto_round_<br><br>prepare_model_for_applying_auto_round_(<br>    model,<br>    is_target_module=is_target_module,<br>    bits=4,<br>    group_size=128,<br>    iters=200,<br>    device=device,<br>)<br><br># Step 2: Apply Optimization<br>input_ids_lst = []<br>for data in dataloader:<br>    input_ids_lst.append(data[&quot;input_ids&quot;].to(model_device))<br><br>multi_t_input_ids = MultiTensor(input_ids_lst)<br># The optimization is applied during the forward pass<br>out = model(multi_t_input_ids)<br><br># Step 3, Finalize Quantization<br>from torchao.prototype.autoround.core import apply_auto_round<br>quantize_(model, apply_auto_round(), is_target_module)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=923e733879a7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intel-analytics-software/10-tips-for-quantizing-llms-and-vlms-with-autoround-923e733879a7">10 Tips for Quantizing LLMs and VLMs with AutoRound</a> was originally published in <a href="https://medium.com/intel-analytics-software">Intel Analytics Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quantization on Intel Gaudi Series AI Accelerators]]></title>
            <link>https://medium.com/intel-analytics-software/intel-neural-compressor-v3-0-a-quantization-tool-across-intel-hardware-9856adee6f11?source=rss-6d8c9480b0b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/9856adee6f11</guid>
            <category><![CDATA[gaudi]]></category>
            <category><![CDATA[intel-neural-compressor]]></category>
            <category><![CDATA[model-quantization]]></category>
            <dc:creator><![CDATA[Intel(R) Neural Compressor & AutoRound]]></dc:creator>
            <pubDate>Fri, 16 Aug 2024 02:13:29 GMT</pubDate>
            <atom:updated>2024-08-27T13:22:06.380Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zBnm9ynpFIwlWJ2M" /><figcaption>Photo by <a href="https://unsplash.com/@omilaev?utm_source=medium&amp;utm_medium=referral">Igor Omilaev</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Intel Neural Compressor v3.0 Supports Quantization across Intel Hardware</h4><blockquote>Tai Huang, Wenhua Cheng, Xin He, Suyue Chen, and Haihao Shen, Intel Corporation</blockquote><p>We are proud to announce the release of <a href="https://github.com/intel/neural-compressor/releases/tag/v3.0">Intel Neural Compressor v3.0</a>. As a major release, it includes several key features, including support for Intel CPUs, GPUs, and AI accelerators based on a new framework extension API.</p><h3><strong>FP8 Quantization</strong></h3><p>As Intel Neural Compressor becomes the official quantization tool for Intel Gaudi series AI accelerators, FP8 quantization has been added to v3.0. This offers significant performance and accuracy improvement for model inference, especially on popular large language models (LLMs). You can refer to this <a href="https://github.com/intel/neural-compressor?tab=readme-ov-file#fp8-quantization">example code</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*fTD_fpVjHUiyVpMtInbQMA.png" /><figcaption>Table 1. FP8 accuracy in Llama2/Llama3</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*PCm41835A8Fhjwd9NQrl4A.png" /><figcaption>Table 2. FP8 performance in Llama2/Llama3</figcaption></figure><h3>INT4 Model Loading</h3><p>INT4 weight-only quantization (WOQ) is another popular compression technique for LLMs. Intel Neural Compressor already supported several state-of-the-art WOQ approaches. Many INT4 WOQ models are available at Hugging Face. In v3.0, INT4 WOQ models can be loaded locally or from Hugging Face model hub for inference on Gaudi. The tool is built into the official Gaudi v1.17 docker image for easy model quantization and measurement.</p><h3><strong>Framework Extension API</strong></h3><p>Intel Neural Compressor v3.0 introduces a new framework extension API for quantization, mixed precision, and benchmarking. The new API provides separate interfaces for mainstream deep learning frameworks like PyTorch and TensorFlow and brings better usability and native experience to AI developers who are already familiar with a particular framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*qM_ZpoojmZ9inE9JlVjW4g.png" /><figcaption>Figure 1. Architecture overview</figcaption></figure><p>Also in this version, a separate installation package for each framework is offered to new API users and its dependencies can be automatically installed with the package.</p><h3><strong>Accuracy-Aware FP16 Mixed Precision on Intel Xeon 6 Processors</strong></h3><p>In 2.x version, Intel Neural Compressor supported BF16 mixed precision on Xeon series processors and provided an accuracy-driven tuning function to reduce accuracy loss by fallback to FP32 when needed. The Intel Xeon 6 processor (codename Granite Rapids) supports the FP16 instruction set architecture (ISA) for Intel Advanced Matrix Extensions (Intel® AMX-FP16), so Intel Neural Compressor v3.0 expands mixed precision support to FP16 so that users can easily benefit from this new hardware acceleration on model inference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*3xGDSOGRoV9ZlxIBsAOKeg.png" /><figcaption>Table 3. FP16 mixed precision performance comparison on resnet18 (benchmark on one NUMA node)</figcaption></figure><h3><strong>Client-Side Quantization</strong></h3><p>The 4-bit WOQ model is especially useful for client-side LLM because model inference is heavily constrained by system memory and compute capability. However, WOQ on the client faces the same problem. In v3.0, WOQ is accelerated using a more efficient packing method. The memory footprint is also optimized with layer-wise/block-wise quantization. Furthermore, client-side quantization usability was improved by auto-detecting the system type and adopting a lightweight configuration, e.g.:</p><pre>from neural_compressor.torch.quantization import get_default_rtn_config, convert, prepare<br>from neural_compressor.torch import load_empty_model<br>model_state_dict_path = &quot;/path/to/model/state/dict&quot;<br>float_model = load_empty_model(model_state_dict_path)<br>quant_config = get_default_rtn_config()<br>prepared_model = prepare(float_model, quant_config)<br>quantized_model = convert(prepared_model)</pre><p>You can find more details in this <a href="https://github.com/intel/neural-compressor/blob/master/docs/source/3x/client_quant.md">guide</a>, which provides different quantization options as well as example code, rough quantization times, and peak memory consumption for typical models.</p><h3><strong>AutoRound v0.3</strong></h3><p>We also included the latest version of AutoRound in this release, which adds the following:</p><ul><li><em>Broader Device Support:</em> Expanded support for CPU, HPU, and CUDA inference in the AutoRound format. Previous 2-bit accuracy issues are also resolved.</li><li><em>New Recipes and Model Releases:</em> Published numerous recipes on the <a href="https://huggingface.co/spaces/Intel/low_bit_open_llm_leaderboard">Low Bit Open LLM Leaderboard</a> showcasing impressive results on Llama 3.1 and other leading models.</li><li><em>Experimental Features:</em> Introduced several experimental features, including activation quantization and mx_fp with promising accuracy.</li><li><em>Multi-modal Model Support</em>: Extended capabilities for tuning and inference across several multi-modal models.</li></ul><h3><strong>Summary</strong></h3><p>We are delighted to make Intel Neural Compressor v3.0 available to public. Especially for new FP8 quantization, we encourage you to try it out on Intel Gaudi series AI accelerator. You are also welcome to create pull requests or submit issues through <a href="https://github.com/intel/neural-compressor">Intel Neural Compressor GitHub</a>. We look forward to your feedback and contributions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9856adee6f11" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intel-analytics-software/intel-neural-compressor-v3-0-a-quantization-tool-across-intel-hardware-9856adee6f11">Quantization on Intel Gaudi Series AI Accelerators</a> was originally published in <a href="https://medium.com/intel-analytics-software">Intel Analytics Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Accelerating Qwen2 Models with Intel Extension for Transformers]]></title>
            <link>https://medium.com/intel-analytics-software/accelerating-qwen2-models-with-intel-extension-for-transformers-99403de82f68?source=rss-6d8c9480b0b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/99403de82f68</guid>
            <category><![CDATA[intel-neural-compressor]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[qwen]]></category>
            <dc:creator><![CDATA[Intel(R) Neural Compressor & AutoRound]]></dc:creator>
            <pubDate>Thu, 06 Jun 2024 23:22:24 GMT</pubDate>
            <atom:updated>2024-06-10T16:25:24.549Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yn0a-puuuGGM6BF1" /><figcaption>Photo by <a href="https://unsplash.com/@mcarsience_photography?utm_source=medium&amp;utm_medium=referral">Meagan Carsience</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>High Performance WOQ INT4 Inference on Intel Xeon Processors</h4><blockquote>Bo Dong, Jun Lin, Zhenzhong Xu, Yu Luo, Wenhua Cheng, Hanwen Chang, and Haihao Shen, Intel Corporation</blockquote><p><a href="https://qwenlm.github.io/blog/qwen2/">Qwen2</a> is the new series of large language models (LLM). For Qwen2, Alibaba released a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters, including a mixture-of-experts model. In this article, we will deploy the <a href="https://github.com/intel/intel-extension-for-transformers/">Intel Extension for Transformers</a> to accelerate low-bit Qwen2 inference on Intel Xeon Processors. First, we use the <a href="https://github.com/intel/intel-extension-for-transformers/">Intel Extension for Transformers</a> to do 4-bit compression of the model. We use the innovative <a href="https://github.com/intel/auto-round.git">AutoRound</a> algorithm for Qwen2–1.5B and Qwen2–7B to generate an INT4, weight-only quantization model.</p><p><a href="https://medium.com/intel-analytics-software/autoround-sota-weight-only-quantization-algorithm-for-llms-across-hardware-platforms-99fe6eac2861">The AutoRound Quantization Algorithm</a></p><p>Table 1 shows the accuracy comparison of the two models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*alb0Qvo8mHrp2OfjNo2weA.png" /><figcaption>Table 1. Qwen2 1.5B/7B AutoRound BF16/INT4 accuracy comparison</figcaption></figure><p>You can access the INT4 models directly from Hugging Face:</p><ul><li><a href="https://huggingface.co/Intel/Qwen2-0.5B-Instuct-int4-inc">Qwen2–0.5B-instuct-int4-inc</a></li><li><a href="https://huggingface.co/Intel/Qwen2-1.5B-Instuct-int4-inc">Qwen2–1.5B-instuct-int4-inc</a></li><li><a href="https://huggingface.co/Intel/Qwen2-7B-int4-inc">Qwen2–7B-int4-inc</a></li></ul><p>The following sample codes show how to do quantization and inference using the <a href="https://github.com/intel/intel-extension-for-transformers/">Intel Extension for Transformers</a> backend <a href="https://github.com/intel/neural-speed">Neural Speed</a>:</p><pre>##pip install auto-round<br>from transformers import AutoModelForCausalLM, AutoTokenizer<br><br>model_name = &quot;Qwen/Qwen2-1.5B&quot;<br>model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=&quot;auto&quot;, trust_remote_code=True)<br>tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)<br><br>from auto_round import AutoRound<br>bits, group_size, sym = 4, 128, True<br>device=&quot;cpu&quot;<br>autoround = AutoRound(model, tokenizer, bits=bits, group_size=group_size, sym=sym, device=None)<br>autoround.quantize()<br>output_dir = &quot;./qwen2_7b_autoround&quot;<br>autoround.save_quantized(output_dir)</pre><pre>from transformers import AutoTokenizer<br>from intel_extension_for_transformers.transformers import AutoModelForCausalLM, GPTQConfig<br><br># Auto Round quantized model<br>model_name = &quot;./qwen2_7b_autoround&quot;<br>prompt = &quot;Once upon a time, a little girl&quot;<br><br>tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)<br>inputs = tokenizer(prompt, return_tensors=&quot;pt&quot;).input_ids<br>model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)<br>outputs = model.generate(inputs)</pre><p>In Qwen2, all instruction-tuned models have been trained on 32K length contexts, and extrapolated to longer context lengths using techniques like <a href="https://arxiv.org/abs/2309.00071">YARN</a> or <a href="https://arxiv.org/abs/2402.17463">Dual Chunk Attention</a>. <a href="https://github.com/intel/intel-extension-for-transformers">Intel Extension for Transformers</a> achieves less than 50ms next token latency up to 32K input length:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yK0OeZ8LkukQ6j8BkzIgsw.png" /></figure><p><a href="https://github.com/intel/intel-extension-for-transformers">Intel Extension for Transformers</a> provides several ways to minimize token latency while maintaining acceptable accuracy. The user-friendly Transformers-like API requires only minimal code changes. There are also more advanced features like streaming LLM, tensor parallelism, and low-bit compression (as low as 1 bit), so we encourage you to take a look at <a href="https://github.com/intel/intel-extension-for-transformers/">Intel Extension for Transformers</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99403de82f68" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intel-analytics-software/accelerating-qwen2-models-with-intel-extension-for-transformers-99403de82f68">Accelerating Qwen2 Models with Intel Extension for Transformers</a> was originally published in <a href="https://medium.com/intel-analytics-software">Intel Analytics Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Accelerating GGUF Models with Transformers]]></title>
            <link>https://medium.com/intel-analytics-software/accelerating-gguf-models-with-transformers-on-intel-platforms-17fae5978b53?source=rss-6d8c9480b0b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/17fae5978b53</guid>
            <category><![CDATA[int4-inference]]></category>
            <category><![CDATA[itrex]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[gguf]]></category>
            <category><![CDATA[inc]]></category>
            <dc:creator><![CDATA[Intel(R) Neural Compressor & AutoRound]]></dc:creator>
            <pubDate>Fri, 31 May 2024 03:31:37 GMT</pubDate>
            <atom:updated>2024-06-04T21:41:11.950Z</atom:updated>
            <content:encoded><![CDATA[<h4>Improving Performance and Memory Usage on Intel Platforms</h4><blockquote>Bo Dong, Jun Lin, Zhentao Yu, Zhenzhong Xu, Yu Luo, Hanwen Chang, and Haihao Shen, Intel Corporation</blockquote><p>GGUF (GPT-Generated Unified Format) is a new binary format that allows quick inspection of tensors and metadata within the file (Figure 1). It represents a substantial leap in language model file formats, optimizing the efficiency of storing and processing large language models (LLM) like GPT. Converting a PyTorch model to the GGUF format is straightforward.</p><figure><img alt="Figure1 GGUF format (source: https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/gguf-spec.png)" src="https://cdn-images-1.medium.com/max/975/1*gfZB6GLg_U0E5-fNWIp-3g.png" /><figcaption>Figure 1. GGUF format (<a href="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/gguf-spec.png">source</a>)</figcaption></figure><p>HuggingFace Transformers recently added support for GGUF with <a href="https://github.com/huggingface/transformers/pull/30391">Transformers PR</a>. Transformers performs dequantization of GGUF models to FP32 before conducting inference using PyTorch. It’s easy to use; just specify the gguf_file parameter in from_pretrained, as shown in Figure 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*TL7f5X5vdHp_xM-YbsM8JA.png" /><figcaption>Figure 2. Using GGUF models in HuggingFace Transformers</figcaption></figure><p>The <a href="https://github.com/intel/intel-extension-for-transformers/tree/main/intel_extension_for_transformers/neural_chat/docker/finetuning">Intel Extension for Transformers</a> accelerates low-bit LLM inference. It extends HuggingFace Transformers and enhances performance on Intel platforms. It supports GGUF inference on a broad range of models. Its usage is also straightforward (Figure 3).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*dN4VThvKMcl85-zCTlsQcg.png" /><figcaption>Figure 3. Using GGUF models in <a href="https://github.com/intel/intel-extension-for-transformers/tree/main/intel_extension_for_transformers/neural_chat/docker/finetuning">Intel Extension for Transformers</a></figcaption></figure><p>Currently, Transformer only supports Llama and Mistral, but we support over 50 popular LLMs (Table 1):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*G2cE4wX9niVU8vqM8icuEg.png" /><figcaption>Table 1. Supported LLMs</figcaption></figure><p>Setup is easy. First, install Neural Speed:</p><pre>git clone https://github.com/intel/neural-speed.git<br>cd neural_speed<br>python setup.py install</pre><p>Second, install <a href="https://github.com/intel/intel-extension-for-transformers/tree/main/intel_extension_for_transformers/neural_chat/docker/finetuning">Intel Extension for Transformers</a>:</p><pre>git clone https://github.com/intel/intel-extension-for-transformers.git<br>cd intel_extension_for_transformers<br>python setup.py install</pre><p>Finally, install Transformers:</p><pre>pip install transformers</pre><p>The code snippet in Figure 4 can be used to easily generate text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*6w260kBz6Q-Gz1Tz4KZ9pA.png" /><figcaption>Figure 4. Example code to generate text</figcaption></figure><p>We conducted a performance comparison with Transformers on an Intel Xeon Platinum Intel Core Ultra 5 125H system (CPU max MHz: 4400.0000, CPU min MHz: 400.0000, Total Memory 32 GB (8 x 4 GB LPDDR5, [7467 MT/s]), Ubuntu 13.2.0–9ubuntu1). Our comparison was limited to <a href="https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF">TinyLlama-1.1B-Chat</a> because of the small memory. Intel Extension for Transformers provided superior latency and memory usage compared to Transformers (Table 2).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*utBgeQVmzXor8tbjOfa1vw.png" /><figcaption>Table 2. Performance, memory usage, and accuracy comparisons</figcaption></figure><p><a href="https://github.com/intel/intel-extension-for-transformers/tree/main/intel_extension_for_transformers/neural_chat/docker/finetuning">Intel Extension for Transformers</a> is a great way to minimize token latency on memory-constrained systems, while requiring only small code changes. Kernel support ranges from 1 to 8 bits. There are also more advanced features like StreamingLLM and Tensor Parallelism, so we encourage you to take a look at <a href="https://github.com/intel/intel-extension-for-transformers/tree/main/intel_extension_for_transformers/neural_chat/docker/finetuning">Intel Extension for Transformers</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17fae5978b53" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intel-analytics-software/accelerating-gguf-models-with-transformers-on-intel-platforms-17fae5978b53">Accelerating GGUF Models with Transformers</a> was originally published in <a href="https://medium.com/intel-analytics-software">Intel Analytics Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Low-Bit Quantized Open LLM Leaderboard]]></title>
            <link>https://medium.com/intel-analytics-software/low-bit-quantized-open-llm-leaderboard-748169e6a004?source=rss-6d8c9480b0b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/748169e6a004</guid>
            <category><![CDATA[int4-inference]]></category>
            <category><![CDATA[llm-evaluation]]></category>
            <category><![CDATA[intel-neural-compressor]]></category>
            <category><![CDATA[ai-pc]]></category>
            <dc:creator><![CDATA[Intel(R) Neural Compressor & AutoRound]]></dc:creator>
            <pubDate>Sat, 11 May 2024 05:32:10 GMT</pubDate>
            <atom:updated>2024-05-14T13:31:04.646Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T9vWfFdckamrzDAT" /><figcaption>Photo by <a href="https://unsplash.com/@joshgmit?utm_source=medium&amp;utm_medium=referral">Joshua Golde</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>A New Tool to Find High-Quality Models for a Given Client</h4><blockquote>Kaokao Lv, Wenjiao Yue, Wenhua Cheng, Jun Lin, Hanwen Chang, Tai Huang, and Haihao Shen, Intel Corporation</blockquote><p>Hugging Face already hosts a <a href="https://huggingface.co/open-llm-leaderboard">leaderboard</a>, so why did we create a new one? Because comparing quantization results is not straightforward. The primary issue is the lack of accuracy results for most quantized models. Another issue is that searching for specific model names in the Hugging Face leaderboard yields numerous models, so a lot of manual effort is required to determine whether they are merged, fine-tuned, in FP16, quantized, or mixed. This poses challenges for model deployment.</p><p>Therefore, we are pleased to introduce the <a href="https://huggingface.co/spaces/Intel/low_bit_open_llm_leaderboard">low-precision quantized leaderboard</a>, which addresses these issues by focusing on quantized LLM models and enhancing the search engine. Users can now instantly search quantized LLMs by algorithm (<a href="https://arxiv.org/abs/2309.05516">AutoRound</a>, <a href="https://arxiv.org/abs/2210.17323">GPTQ</a>, <a href="https://arxiv.org/abs/2306.00978">AWQ</a>, <a href="https://github.com/TimDettmers/bitsandbytes">BitsAndBytes</a>, and <a href="https://github.com/ggerganov/llama.cpp">GGUF</a>), computing data type (int8, fp16, bf16, etc.), weight data type (fp4, int4, nf4, etc.), model size, and whether or not double quantization is enabled. The low-bit quantized open LLM leaderboard is a valuable tool for finding high-quality models that can be deployed efficiently on a given client.</p><h3><strong>Quantization Approaches</strong></h3><p>A robust quantization tool is needed to effectively benchmark LLM models across diverse quantization methods and varied weight and computing data types. Our leaderboard leverages <a href="https://github.com/intel/intel-extension-for-transformers">Intel Extension for Transformers</a> for LLM quantization support. This solution offers a Transformer-like API with a unified interface that seamlessly integrates well-known weight-only quantization methods such as <a href="https://arxiv.org/abs/2210.17323">GPTQ</a>, <a href="https://arxiv.org/abs/2306.00978">AWQ</a>, etc. Additionally, the tool incorporates Intel’s AutoRound algorithm for low-bit LLM inference:</p><p><a href="https://medium.com/intel-analytics-software/autoround-sota-weight-only-quantization-algorithm-for-llms-across-hardware-platforms-99fe6eac2861">The AutoRound Quantization Algorithm</a></p><p>The quantization functionality of Intel Extension for Transformers is built on top of <a href="https://github.com/intel/neural-compressor">Intel Neural Compressor</a>, an open-source model compression tool.</p><h3><strong>Low-Bit Quantized Open LLM Leaderboard</strong></h3><p>The leaderboard encompasses ten distinct benchmarks: ARC-c, ARC-e, Boolq, HellaSwag, Lambada_openai, MMLU, Openbookqa, Piqa, Truthfulqa_mc1, and Winogrande. Rankings are determined by the average score across these benchmarks, with the option to prioritize specific benchmarks for reranking.</p><p>Our evaluation shows that AutoRound approaches near-lossless compression for a range of popular models. It consistently outperforms other methods such as GPTQ and AWQ, and shows better accuracy than GGUF. Llama2–7b-chat and Mistral-7b-instrut comparisons are shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*vaEvUwJ5134R6QEzNPQ9Zg.png" /><figcaption>Average accuracy (higher is better) of int4 Llama2–7B-chat</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*vhHADveEdD6KnNmujyGxsQ.png" /><figcaption>Average accuracy (higher is better) of int4 Mistral-7B-instruct-v0.2</figcaption></figure><p>We also compared the 13B AutoRound and fp16 7B models, which showed AutoRound consistently outperforming the fp16 7B in all individual metrics as well as on average. This gives users the option of low-bit, quantized middle-sized LLMs that outperform half-precision, small-sized LLMs even though their model size is smaller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jHSC0-tkS6wW9kbqsLI4JQ.png" /><figcaption>Accuracy (higher is better) of Fp16 7B vs 13B AutoRound models</figcaption></figure><p>Moreover, AutoRound can accommodate the majority of popular models, whereas other quantization algorithms have limitations. This is why AutoRound models are readily accessible, as demonstrated below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qITnsaMr-YEpOj0wqv_sVg.png" /><figcaption>Low-Bit Quantized Open LLM Leaderboard (as of May 11, 2024)</figcaption></figure><p>Additionally, AutoRound offers support for quantizing the lm_head, a feature overlooked by algorithms like AWQ. Unlike GPTQ and AWQ, AutoRound can automatically accommodate new models. Finally, AutoRound provides calibration capabilities across various datasets.</p><h3><strong>Quantization Sample Code</strong></h3><p>The following example code shows how to apply AutoRound to quantize LLMs with Transformer-like API in <a href="https://github.com/intel/intel-extension-for-transformers">Intel Extension for Transformers</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rSGE-ZAPnugZ6BEYsUdwDA.png" /><figcaption>Quantization sample code using Intel Extension for Transformers</figcaption></figure><p>For more details, please refer to the <a href="https://github.com/intel/intel-extension-for-transformers/tree/main/examples/huggingface/pytorch/text-generation/quantization">AutoRound</a> example in Intel Extension for Transformers.</p><h3><strong>Collaborations and Future Work</strong></h3><p>We encourage you to explore our leaderboard and upload your quantized models. We look forward to hearing your feedback, questions, or comments. If you want to give it a try on your proprietary models, kindly raise a ticket and see how we can help you.</p><p>In future, we plan to expand the leaderboard to support ultra-low-bit quantized open LLMs. If you are interest in this topic, feel free to drop us an <a href="http://inc.maintainers@intel.com">email</a>. Again, your feedback and contributions will be greatly appreciated.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=748169e6a004" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intel-analytics-software/low-bit-quantized-open-llm-leaderboard-748169e6a004">Low-Bit Quantized Open LLM Leaderboard</a> was originally published in <a href="https://medium.com/intel-analytics-software">Intel Analytics Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The AutoRound Quantization Algorithm]]></title>
            <link>https://medium.com/intel-analytics-software/autoround-sota-weight-only-quantization-algorithm-for-llms-across-hardware-platforms-99fe6eac2861?source=rss-6d8c9480b0b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/99fe6eac2861</guid>
            <category><![CDATA[quantization]]></category>
            <category><![CDATA[intel-neural-compressor]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Intel(R) Neural Compressor & AutoRound]]></dc:creator>
            <pubDate>Tue, 02 Apr 2024 08:29:57 GMT</pubDate>
            <atom:updated>2024-05-07T16:48:56.994Z</atom:updated>
            <content:encoded><![CDATA[<h4>Weight-Only Quantization for LLMs Across Hardware Platforms</h4><blockquote>Wenhua Cheng and Hanwen Chang, Intel Corporation</blockquote><p>We recently released <a href="https://github.com/intel/auto-round">AutoRound</a>, an innovative weight-only quantization algorithm designed specifically for low-bit LLM inference. It approaches near-lossless compression for a range of popular models including gemma-7B, Mistral-7b-v0.1, Mistral-7B-Instruct-v0.2, Mixtral-8x7B-Instruct-v0.1, Phi2, LLAMA2 , Qwen1.5–7B-chat, and more. AutoRound consistently outperforms other methods (<a href="https://arxiv.org/abs/2210.17323">GPTQ</a>, <a href="https://arxiv.org/abs/2306.00978">AWQ</a>, <a href="https://arxiv.org/abs/2308.13137">OmniQuant</a>, and <a href="https://github.com/mobiusml/hqq">HQQ</a>) in many scenarios at W4G128, W4G-1, W3G128, and W2G128. Additionally, AutoRound does not introduce any extra overhead during inference.</p><p>Our method builds on prior innovations. It adopts <a href="https://arxiv.org/abs/2309.05516">signed gradient descent</a> (SignSGD) to fine-tune rounding values and minmax values of weights in fewer steps. An overview is shown in the diagram below, in which V is the rounding perturbation in the [-0.5, 0.5] range, while alpha and beta are tunable scales of min-max weights. We typically set the range to [0.5, 1]. Opting for SignSGD is inspired by the well-defined boundaries of the solution space, which offer several advantages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/0*Rcqx3tPoUdb5wn-2.png" /></figure><p>Some of the key features of AutoRound are as follows:</p><ul><li><strong>Device compatibility</strong>: It is compatible with quantization devices including Intel Guadi2<strong>, </strong>Intel CPUs, and Nvidia GPUs.</li><li><strong>Wide model support:</strong> It is suitable to a diverse range of model families. About 20 model families have been verified so far.</li><li><strong>Export flexibility</strong>: Effortlessly export quantized models to ITREX[5] and <a href="https://github.com/AutoGPTQ/AutoGPTQ">AutoGPTQ</a> formats for seamless deployment on Intel CPU and Nvidia GPU platforms.</li><li><strong>Quantized models/recipes</strong>: Improved performance using model-specific recipes. Several per-quantized models and recipes have been published.</li></ul><h3>Comparison with Other Methods</h3><p>We provide a comparative analysis under fair setting in <a href="https://github.com/intel/auto-round/blob/main/docs/acc.md">Comprehensive Accuracies Data</a>, some of which is shown in the following tables. The evaluation was done on the qdq fake model with <a href="https://github.com/EleutherAI/lm-evaluation-harness">lm-eval</a> v0.3. Our approach achieved superior performance compared to GPTQ, scoring 30/32, AWQ with 27/32, HQQ with 15/16, and OmniQuant with a perfect score of 16/16 across llamv1/llamav2/mistral-7b on W4G-1, W4G128, W3G128, and W2G128, based on the average accuracies of 11 zero-shot tasks. W4G128 denotes quantizing weights using 4 bits and 128 weights share a single quantization scale and zero point. And G-1 denotes all weights in a input channel shares the same scale and zero point.</p><p>With 512 calibration samples, the tuning cost are comparable while HQQ is much faster and OmniQuant is clearly slower. Note that our performance improves with more tuning steps and model-specific hyperparameters, as demonstrated in the next section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*52M2uBVhLDW0mRRNSkZTTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qP6r-CfqX7fjffDyli8uKQ.png" /></figure><h3>Quantized Models/Recipes</h3><p>We quantized several models using more tuning steps and model-specific hyperparameters:</p><ul><li><a href="https://huggingface.co/Intel/neural-chat-7b-v3-3-int4-inc">Intel/neural-chat-7b-v3–3-int4-inc</a> (FP16 0.6778, INT4 0.6748 )</li><li><a href="https://huggingface.co/Intel/neural-chat-7b-v3-1-int4-inc">Intel/neural-chat-7b-v3–1-int4-inc</a> (FP16 0.6769, INT4 0.6721)</li><li><a href="https://huggingface.co/Intel/Mistral-7B-v0.1-int4-inc">Intel/Mistral-7B-v0.1-int4-inc</a> (BF16 0.6306, INT4 0.6308 )</li><li><a href="https://huggingface.co/Intel/phi-2-int4-inc">Intel/phi-2-int4-inc</a> (FP16 0.6155, INT4 qdq 0.6163)</li><li><a href="http://intel/falcon-7b-int4-inc">Intel/falcon-7b-int4-inc</a> (FP16 0.5521, INT4 qdq 0.5507)</li><li><a href="https://huggingface.co/Intel/gemma-2b-int4-inc">Intel/gemma-2b-int4-inc</a> (FP16 0.5383, INT4 0.5338)</li><li><a href="https://github.com/intel/auto-round/blob/main/examples/language-modeling/scripts/Mistral-7B-Instruct-v0.2.sh">mistralai/Mistral-7B-Instruct-v0.2 recipe</a> (BF16 0.6647, INT4 0.6621)</li><li><a href="https://github.com/intel/auto-round/blob/main/examples/language-modeling/scripts/gemma-7b.sh">google/gemma-7b recipe</a> (FP16 0.6239, INT4 0.6307)</li><li><a href="https://github.com/intel/auto-round/blob/main/examples/language-modeling/scripts/gemma-7b-it.sh">google/gemma-7b-it recipe</a> (FP16 0.6022, INT4 0.6017)</li><li><a href="https://github.com/intel/auto-round/blob/main/examples/language-modeling/scripts/Mixtral-8x7B-Instruct-v0.1.sh">mistralai/Mixtral-8x7B-Instruct-v0.1 recipe</a> (BF16 0.7000, INT4 0.6977 )</li><li><a href="https://github.com/intel/auto-round/blob/main/examples/language-modeling/scripts/Mixtral-8x7B-v0.1.sh">mistralai/Mixtral-8x7B-v0.1 recipe</a> (BF16 0.6698, INT4 0.6633)</li><li><a href="https://github.com/intel/auto-round/blob/main/examples/language-modeling/scripts/Llama-2-7b-chat-hf.sh">meta-llama/Llama-2–7b-chat-hf recipe</a> (FP16 0.5901, INT4 qdq 0.5897)</li><li><a href="https://github.com/intel/auto-round/blob/main/examples/language-modeling/scripts/Qwen1.5-7B-Chat.sh">Qwen/Qwen1.5–7B-Chat recipe</a> (BF16 0.6231, INT4 0.6205)</li></ul><p>Some have been uploaded to the HF model space, while others are still under review. We evaluate most models using the average accuracy of 11 tasks. In the case of Chinese models, we adhere to the Qwen approach, which involves using the average accuracy of four tasks. All items labeled without ‘qdq’ are evaluated using a real quantized model with lm-eval 0.4, while the remaining items are evaluated using a simulated qdq model due to certain evaluation challenges encountered with lm-eval 0.4.</p><h3>Usage</h3><p>With just a few lines of code or by using the user-friendly AutoRound <a href="https://github.com/intel/auto-round/blob/main/examples/language-modeling/main.py">example</a>, you can quickly obtain quantized and compressed models.</p><h4>Model Quantization</h4><pre>##pip install auto-round<br>from transformers import AutoModelForCausalLM, AutoTokenizer<br><br>model_name = &quot;meta-llama/Llama-2-7b-hf&quot;<br>model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=&quot;auto&quot;, trust_remote_code=True)<br>tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)<br><br>from auto_round import AutoRound<br><br>bits, group_size, sym = 4, 128, False<br>## device=&quot;auto&quot;, &quot;hpu&quot; or &quot;cpu&quot; or &quot;cuda&quot;<br>autoround = AutoRound(model, tokenizer, bits=bits, group_size=group_size, sym=sym, device=None)<br>autoround.quantize()<br>output_dir = &quot;./tmp_autoround&quot;<br>autoround.save_quantized(output_dir)</pre><h4><strong>Model Inference</strong></h4><pre>from intel_extension_for_transformers.transformers import AutoModelForCausalLM<br>from transformers import AutoTokenizer<br> <br>quantized_model_path = &quot;./tmp_autoround&quot;<br>model = AutoModelForCausalLM.from_pretrained(quantized_model_path, device_map=&quot;auto&quot;, trust_remote_code=True)<br>tokenizer = AutoTokenizer.from_pretrained(quantized_model_path, use_fast=True)<br><br>text = &quot;There is a girl who likes adventure,&quot;<br>inputs = tokenizer(text, return_tensors=&quot;pt&quot;).to(model.device)<br>print(tokenizer.decode(model.generate(**inputs, max_new_tokens=50)[0]))</pre><h4><strong>Model Inference on Nvidia GPU with AutoGPTQ</strong></h4><pre>from transformers import AutoModelForCausalLM, AutoTokenizer<br><br>quantized_model_path = &quot;./tmp_autoround&quot;<br>model = AutoModelForCausalLM.from_pretrained(quantized_model_path, device_map=&quot;auto&quot;, trust_remote_code=True)<br>tokenizer = AutoTokenizer.from_pretrained(quantized_model_path, use_fast=True)<br><br>text = &quot;There is a girl who likes adventure,&quot;<br>inputs = tokenizer(text, return_tensors=&quot;pt&quot;).to(model.device)<br>print(tokenizer.decode(model.generate(**inputs, max_new_tokens=50)[0]))</pre><h3>Concluding Remarks</h3><p>AutoRound/HQQ/GPTQ/AWQ has also been implemented in <a href="https://github.com/intel/neural-compressor">Intel Neural Compressor</a> and is supported in <a href="https://github.com/intel/intel-extension-for-transformers">Intel Extension for Transformers</a> to enhance compatibility with Intel devices. For more details, please kindly refer to <a href="https://github.com/intel/auto-round">https://github.com/intel/auto-round</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99fe6eac2861" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intel-analytics-software/autoround-sota-weight-only-quantization-algorithm-for-llms-across-hardware-platforms-99fe6eac2861">The AutoRound Quantization Algorithm</a> was originally published in <a href="https://medium.com/intel-analytics-software">Intel Analytics Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Run LLMs on Intel GPUs Using llama.cpp]]></title>
            <link>https://medium.com/intel-analytics-software/run-llm-on-intel-gpus-using-llama-cpp-579d3595954e?source=rss-6d8c9480b0b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/579d3595954e</guid>
            <category><![CDATA[intel-neural-compressor]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[llama-cpp]]></category>
            <dc:creator><![CDATA[Intel(R) Neural Compressor & AutoRound]]></dc:creator>
            <pubDate>Fri, 22 Mar 2024 07:19:21 GMT</pubDate>
            <atom:updated>2024-07-16T16:44:14.545Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*verRpMuEtdeWMY2hR30JgQ.png" /></figure><h4>Taking Advantage of the New SYCL Backend</h4><blockquote>Zhang Jianyu, Meng Hengyu, Hu Ying, Luo Yu, Duan Xiaoping, and Majumder Abhilash, Intel Corporation</blockquote><p>The open-source project, <a href="https://github.com/ggerganov/llama.cpp">llama.cpp</a>, is a light LLM framework that is gaining popularity. Its high-performance and customizability have turned the project into a thriving and dynamic community of developers, researchers, and hobbyists. Approximately one year since launch, the GitHub project has more than 600 contributors; 52,000 stars; 1,500 releases; and 7,400 forks. Thanks to recent code merges, llama.cpp now supports more hardware, including Intel GPUs across server and consumer products. Intel’s GPUs join hardware support for CPUs (x86 and ARM) and GPUs from other vendors.</p><p>The original implementation was created by Georgi Gerganov. The project is mainly for educational purposes and serves as the main playground for developing new features for the <a href="https://github.com/ggerganov/ggml">ggml</a> library, a Tensor library for machine learning. With the recent updates, Intel is bringing AI everywhere to more users by enabling inference on far more devices. Llama.cpp is fast because it’s written in C and has several other attractive features:</p><ul><li>16-bit float support</li><li>Integer quantization support (4-bit, 5-bit, 8-bit, etc.)</li><li>No third-party dependencies</li><li>Zero memory allocations during runtime</li></ul><h3>SYCL Backend for Intel GPUs</h3><p>There are several backends of ggml to support and optimize for different hardware. We chose SYCL (a direct programming language) and oneMKL (a high performance BLAS library) from <a href="https://www.oneapi.io/">oneAPI</a> to develop the SYCL backend because it supports GPUs from different vendors. SYCL is a programming model to improve productivity on hardware accelerators. It is a single-source, embedded, domain-specific language based on pure C++17.</p><p>The SYCL backend supports all Intel GPUs. We have verified with:</p><ul><li>Intel Data Center GPU Max and Flex Series</li><li>Intel Arc Discrete GPU</li><li>Built-in Intel Arc GPU in Intel Core Ultra CPU</li><li>iGPU in Intel 11th, 12th, and 13th Gen Core CPUs</li></ul><p>With llama.cpp now supporting Intel GPUs, millions of consumer devices are capable of running inference on Llama. Compared to the OpenCL (CLBlast) backend, the SYCL backend has significant performance improvement on Intel GPUs. It also supports more devices, like CPU, and other processors with AI accelerators in the future. Please refer to guide to learn how to use the SYCL backend: <a href="https://github.com/ggerganov/llama.cpp/blob/master/README-sycl.md">llama.cpp for SYCL</a>.</p><h3>Run LLM on Intel GPU Using the SYCL Backend</h3><p>A detailed guide is available in <a href="https://github.com/ggerganov/llama.cpp/blob/master/README-sycl.md">llama.cpp for SYCL</a>. It can run on all Intel GPUs supported by SYCL and oneAPI. Server and cloud users can run on Intel Data Center GPU Max and Flex Series GPUs. Client users can try it out on their Intel Arc GPU or iGPU on Intel Core CPUs. We have tested the iGPUs of 11th Gen Core and newer. The older iGPU could works but with poor performance.</p><p>The only limitation is memory. The iGPU uses the host shared memory. The dGPU uses its own memory. We recommend using the iGPU with 80+ EUs (11th Gen Core and newer) and shared memory is more than 4.5 GB for llama2–7b-Q4 model (total host memory is 16 GB and more, and half memory could be allocated to iGPU).</p><h4>Install the Intel GPU Driver</h4><p>Both Linux and Windows (WSL 2) are supported. For Linux, we recommend Ubuntu 22.04, which was used for development and testing.</p><p>Linux:</p><pre>sudo usermod -aG render username<br>sudo usermod -aG video username</pre><pre>sudo apt install clinfo<br>sudo clinfo -l</pre><p>Output (example):</p><pre>Platform #0: Intel(R) OpenCL Graphics -- Device #0: Intel(R) Arc(TM) A770 Graphics</pre><p>or</p><pre>Platform #0: Intel(R) OpenCL HD Graphics -- Device #0: Intel(R) Iris(R) Xe Graphics \[0x9a49\]</pre><p>Windows: <a href="https://www.intel.com/content/www/us/en/products/docs/discrete-gpus/arc/software/drivers.html">Install Intel GPU Drivers</a>.</p><h4>Enable the oneAPI Runtime</h4><p>First, install the <a href="https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit.html">Intel oneAPI Base Toolkit</a> to get the SYCL compiler and oneMKL. Next, enable the oneAPI runtime:</p><ul><li>Linux: source /opt/intel/oneapi/setvars.sh</li><li>Windows: &quot;C:\Program Files (x86)\Intel\oneAPI\setvars.bat\&quot; intel64</li></ul><p>Runsycl-lsto confirm that there are one or more Level Zero devices. Please confirm that at least one GPU is present, like [ext_oneapi_level_zero:gpu:0].</p><p>Build by one-click:</p><ul><li>Linux: ./examples/sycl/build.sh</li><li>Windows: examples\sycl\win-build-sycl.bat</li></ul><p>Note, the scripts above include the command to enable the oneAPI runtime.</p><h4>Run an Example by One-Click</h4><p>Download <a href="https://huggingface.co/TheBloke/Llama-2-7B-GGUF/blob/main/llama-2-7b.Q4_0.gguf">llama-2–7b.Q4_0.gguf</a> and save to the models folder:</p><ul><li>Linux: ./examples/sycl/run-llama2.sh</li><li>Windows: examples\sycl\win-run-llama2.bat</li></ul><p>Note that the scripts above include the command to enable the oneAPI runtime. If the ID of your Level Zero GPU is not 0, please change the device ID in the script. To list the device ID:</p><ul><li>Linux: ./build/bin/ls-sycl-device or ./build/bin/main</li><li>Windows: build\bin\ls-sycl-device.exe or build\bin\main.exe</li></ul><h3>Summary</h3><p>The SYCL backend in llama.cpp brings all Intel GPUs to LLM developers and users. Please check if your Intel laptop has an iGPU, or your gaming PC has an Intel Arc GPU, or your cloud VM has Intel Data Center GPU Max and Flex Series GPUs. If yes, please enjoy the magical features of LLM by llama.cpp on Intel GPUs. We welcome developers to try and contribute to SYCL backend to add more features and optimization on Intel GPU. It’s a good project to learn Intel oneAPI for cross-platform development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=579d3595954e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intel-analytics-software/run-llm-on-intel-gpus-using-llama-cpp-579d3595954e">Run LLMs on Intel GPUs Using llama.cpp</a> was originally published in <a href="https://medium.com/intel-analytics-software">Intel Analytics Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Efficient Quantization with Microscaling Data Types for Large Language Models]]></title>
            <link>https://medium.com/intel-analytics-software/efficient-quantization-with-microscaling-data-types-for-large-language-models-using-intel-neural-60e3b5ec266c?source=rss-6d8c9480b0b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/60e3b5ec266c</guid>
            <category><![CDATA[intel-neural-compressor]]></category>
            <category><![CDATA[llm-quantization]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[mx-data-type]]></category>
            <category><![CDATA[mx-quantization]]></category>
            <dc:creator><![CDATA[Intel(R) Neural Compressor & AutoRound]]></dc:creator>
            <pubDate>Fri, 01 Mar 2024 13:40:57 GMT</pubDate>
            <atom:updated>2024-03-07T02:14:37.769Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d2X3T-EtHLbWqvwI" /><figcaption>Photo by <a href="https://unsplash.com/@jjying?utm_source=medium&amp;utm_medium=referral">JJ Ying</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>New Quantization Recipes Using Intel Neural Compressor</h4><blockquote>Mengni Wang, Xin He, and Haihao Shen, Intel Corporation</blockquote><h3><strong>Introduction to the Microscaling Data Type</strong></h3><p>Numerous breakthroughs have emerged across various fields, such as text analysis, language translation and chatbot technologies, fueled by the development of large language models (LLMs). Nevertheless, their increasing power comes with the challenge of explosive growth in parameters, posing obstacles for practical use. To balance memory limits and accuracy preservation for AI models, the Microscaling (MX) specification was promoted from the well-known Microsoft Floating Point (MSFP) data type [1, 2]:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*FZmK_bumBi85pb_xvnXe_Q.png" /><figcaption>Definition of MX data type (source [2])</figcaption></figure><p>At an equivalent accuracy level, the MX data type demonstrates the ability to occupy a smaller area and incur lower energy costs for multiply-accumulate compared to other conventional data types on the same silicon [1].</p><h3><strong>MX Quantization in Intel Neural Compressor</strong></h3><p>Intel Neural Compressor (<a href="https://github.com/intel/neural-compressor">INC</a>) is an open-source model compression tool that focuses on providing users with an easy-to-use interface and powerful model compression techniques like quantization, pruning, distillation, etc. We implement different quantization recipes for the MX data type in INC, provide an end-to-end pipeline for MX quantization and evaluation of LLMs, as well as validate the effectiveness of MX quantization with LLMs to show its benefits.</p><p>Currently, INC supports post-training quantization (PTQ) for INT8 and FP8, which can compress models to lower bits without training. Building upon the groundwork laid by others, INC seamlessly applies the MX data type to PTQ, offering meticulously crafted recipes to empower users to quantize LLMs without sacrificing accuracy. The memory and computational limits of LLMs are more severe than other general neural networks, so our exploration focuses on LLMs first. The following table shows the basic MX quantization recipes in INC and enumerates distinctions among various data types. The MX data type replaces general float scale with powers of two to be more hardware-friendly. It adapts a granularity falling between per-channel and per-tensor to balance accuracy and memory consumption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wsWuYdOM4Yz7AVIB572rrA.png" /><figcaption>Basic MX quantization recipes of INC</figcaption></figure><p>The exponent (exp) is equal to torch.floor(torch.log2(amax)), MAX is the representation range of the data type, amax is the max absolute value of per-block tensor, and rmin is the minimum value of the per-block tensor.</p><p>Furthermore, we are exploring advanced recipes, such as specifying particular modules to be excluded from MX quantization in order to identify opportunities for improving accuracy.</p><p>INC provides an API so concise that users can obtain a fake quantized model with the MX data type using just three lines of code (see <a href="https://github.com/intel/neural-compressor/tree/mx_quantization/examples/pytorch/nlp/huggingface_models/language-modeling/quantization/llm">link</a> for the example and <a href="https://github.com/intel/neural-compressor/blob/mx_quantization/neural_compressor/torch/quantization/config.py#L53uantization/config.py">link</a> for its full capability):</p><pre>from neural_compressor.torch import MXQuantConfig, quantize<br>quant_config = MXQuantConfig(weight_dtype=args.weight.dtype, act_dtype=args.act_dtype)<br>user_model = quantize(model=user_model, quant_config=quant_config)</pre><h3><strong>Validated Results</strong></h3><p>To showcase the accuracy preserving capabilities of the MX data type, experiments were conducted using various MX quantization recipes on nine popular LLMs. Accuracy was validated using the lambada_openai task with an accuracy target of 99% of the FP32 baseline.</p><h4><strong>Accuracy for Basic Quantization Recipes</strong></h4><p>To make the comparison fair, we apply the basic quantization recipes across all the data types without sophisticated calibration. The charts below show that the MX data type demonstrates a significant advantage in INT8 compared to conventional data types and serves as a complementary option to FP8.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*zqarI-VH4KpU52Tkm90Sxw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*m45SQbs6Bck5mOgEcUusyA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*WnTSBuztrMka5NbrJ39Tdg.png" /><figcaption>Accuracy comparison among different data types</figcaption></figure><p>MX FP6 achieves results similar to MX FP8, which means we can compress models by lower bits with negligible accuracy loss.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mFoEkFT_iYyjMdXxjbyRuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uBrTLBgxvoO-QtUj0CndGg.png" /><figcaption>Accuracy comparison among different MX data types</figcaption></figure><h4><strong>Accuracy for Advanced Quantization Recipes</strong></h4><p>The benefits of some advanced quantization recipes are shown as below. Accuracy is further improved with quantizing weight only and excluding last linear, which has motivated us to explore the other potential recipes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*azphECRt-N45dARg_X8NtQ.png" /><figcaption>Accuracy comparison among different recipes on databricks/dolly-v2–3b</figcaption></figure><h3><strong>Conclusions and Future Work</strong></h3><p>We have simulated MX quantization in INC and validated some recipes on LLMs. In future, we will explore new MX quantization recipes and its low bits capability. Furthermore, performance benchmarking will be conducted once the hardware and kernels are ready. You can star our repository to stay informed about the latest updates promptly.</p><p>We encourage you to use INC to quantize LLMs to get better inference efficiency on Intel platforms, and explore new quantization techniques for new data types on future platforms. Your feedback, suggestions, or questions are always welcome and highly appreciated.</p><h3><strong>References</strong></h3><p>[1] Bita Darvish Rouhani <em>et al. (2020)</em>, <a href="https://proceedings.neurips.cc/paper/2020/hash/747e32ab0fea7fbd2ad9ec03daa3f840-Abstract.html">Pushing the Limits of Narrow Precision Inferencing at Cloud Scale with Microsoft Floating Point</a>, <em>Advances in Neural Information Processing Systems</em> <em>33 (NeurIPS 2020)</em>, 10271–10281.</p><p>[2] <a href="https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf">OCP Microscaling Formats (MX) Specification</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60e3b5ec266c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intel-analytics-software/efficient-quantization-with-microscaling-data-types-for-large-language-models-using-intel-neural-60e3b5ec266c">Efficient Quantization with Microscaling Data Types for Large Language Models</a> was originally published in <a href="https://medium.com/intel-analytics-software">Intel Analytics Software</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>