{
  "@context": "https://schema.org",
  "@id": "https://aggr.aymericbeaumet.com/items/huggingface-co/2025-09-29-accelerating-qwen3-8b-agent-on-intel-r-coretm-ultra-with/#webpage",
  "@type": [
    "WebPage",
    "ArchiveComponent"
  ],
  "articleBody": "[![banner image](https://huggingface.co/blog/assets/intel-qwen3-agent/smolagents-1300-650.png)](https://huggingface.co/blog/assets/intel-qwen3-agent/smolagents-1300-650.png)\n\nTL;DR:\n\n- [Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B) is one of the most exciting recent releases—a model with native agentic capabilities, making it a natural fit for the AIPC.\n\n- With [OpenVINO.GenAI](https://github.com/openvinotoolkit/openvino.genai), we’ve been able to accelerate generation by ~1.3× using speculative decoding with a lightweight Qwen3-0.6B draft.\n\n- By using speculative decoding and applying a simple pruning process to the draft, we pushed the speedup even further to ~1.4×\n\n- We wrapped this up by showing how these improvements can be used to run a fast, local AI Agent with 🤗 [smolagents](https://github.com/huggingface/smolagents)\n\n## Qwen3\n\nQwen3-8B is part of the latest Qwen family, trained with explicit agentic behaviors. It supports tool invocation, multi-step reasoning, and long-context handling capabilities, that make it well-suited for complex agent workflows. When integrated with frameworks like Hugging Face 🤗smolagents, QwenAgent, or AutoGen, it enables a wide range of agentic applications built around tool use and reasoning. Unlike single-turn chatbots, agentic applications rely on reasoning models that produce “thinking aloud” traces, intermediate steps that expand token usage, making inference speed critical to responsiveness. The combination of optimized inference and built-in agentic intelligence makes Qwen3-8B a compelling foundation for next-gen AI agents.\n\n## Accelerating Qwen3-8B on Intel® Core™ Ultra with Speculative Decoding\n\nWe started by benchmarking the 4-bit optimized OpenVINO version of Qwen3-8B on an Intel Lunar Lake integrated GPU, establishing this as our baseline for further acceleration\n\n[Speculative decoding](https://arxiv.org/abs/2211.17192) is a method to speed up auto-regressive generation. It works by using a smaller, faster model as a draft to propose multiple tokens in a single forward pass, which are then validated by the larger target model in one forward pass. In our setup, [Qwen3-8B](https://huggingface.co/OpenVINO/Qwen3-8B-int4-ov) served as the target model while [Qwen3-0.6B](https://huggingface.co/OpenVINO/Qwen3-0.6B-int8-ov) was used as the draft. This approach delivered an average of 1.3× speedup over the baseline.\n\n```python\nfrom openvino_genai import LLMPipeline, draft_model\n\ntarget_path = \"/path/to/target/Qwen3-8B-int4-ov\"\ndraft_path = \"/path/to/draft/Qwen3-0.6B-int8-ov\"\ndevice = \"GPU\"\n\nmodel = LLMPipeline(target_path, device, draft_model=draft_model(draft_path, device))\n\nstreamer = lambda x: print(x, end=\"\", flush=True)\nmodel.generate(\"What is speculative decoding and how does it improve inference speed?\", max_new_tokens=100, streamer=streamer)\n```\n\n> Before initializing the `LLMPipeline`, make sure both the target and draft models are converted to OpenVINO. You can either download pre-converted models from the provided links or follow these [instructions](https://huggingface.co/docs/optimum-intel/en/openvino/export) to convert your own.\n\n## Pushing Performance Further\n\nThe speculative decoding speedup depends on the average number of generated tokens per forward step of the target, γ \\\\gamma, the speculation window size, and the ratio between the target and draft models' latency c c. A smaller, faster (though less accurate) draft can often deliver greater acceleration. This inspired us to shrink the draft model while still preserving its quality, i.e. E(#generated\\_tokens) E(\\\\# generated\\\\\\_tokens).\n\nSpeedup=E(#generated\\_tokens)γc+1 Speedup = \\\\frac{E(\\\\# generated\\\\\\_tokens)}{\\\\gamma c + 1}\n\nOur [recent work](https://huggingface.co/papers/2411.11055) shows that model depth (number of layers) is a major contributor to inference latency. We drew inspiration from recent work on layer-wise compression\\[1\\]. In our approach, we identify blocks of layers that contribute little, measured using angular distance, and remove them. After pruning, we apply fine-tuning to recover accuracy. Using this method, we pruned 6 out of 28 layers from the Qwen3-0.6B draft model. To recover the quality of the pruned draft model, we further finetuned it using synthetic data generated by Qwen3-8B. The data was produced by generating responses to 500k prompts from [BAAI/Infinity-Instruct dataset](https://huggingface.co/datasets/BAAI/Infinity-Instruct).\n\nThe resulting pruned draft model delivered ~1.4x speedup compared to the baseline, an improvement over the ~1.3× gain achieved with the original draft. This outcome aligns with theoretical expectations - reducing draft latency improves the over-all speedup, enabling faster and more efficient inference.\n\nThis demonstrates how pruning + speculative decoding can unlock faster and more efficient inference—making local AI agents even more practical.\n\nCheck out the [notebook](https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/supplementary_materials/notebooks/qwen-3/qwen3.ipynb) and the Qwen3-0.6B depth-pruned [draft model](https://huggingface.co/OpenVINO/Qwen3-pruned-6L-from-0.6B-int8-ov) to reproduce our results step by step\n\n## Integration with 🤗smolagents\n\nTo showcase the real-world potential, we deployed our optimized setup with the 🤗smolagents library. With this integration, developers can plug in Qwen3-8B (paired with our pruned draft) to build agents that call APIs and external tools, write and execute code, handle long-context reasoning and run efficiently on Intel® Core™ Ultra. The benefits aren’t limited to Hugging Face, this model pairing can also be used seamlessly with frameworks like AutoGen or QwenAgent, further strengthening the agentic ecosystem.\n\nIn our demo, we assigned the accelerated Qwen3-based agent a task: 👉 Summarize the key features of the Qwen3 model series and present them in a slide deck.\n\nHere’s how it worked: 1. The agent used a web search tool to gather up-to-date information. 2. It then switched to the Python interpreter to generate slides with the `python-pptx` library. This simple workflow highlights just a fraction of the possibilities unlocked when accelerated Qwen3 models meet frameworks like 🤗smolagents, bringing practical, efficient AI agents to life on AI PC. Try it [here](https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/supplementary_materials/notebooks/qwen-3/smolagents/qwen3_agent.ipynb) 🚀\n\n### References\n\n\\[1\\] Gromov, A., Tirumala, K., Shapourian, H., Glorioso, P., & Roberts, D. A. (2025, January 22). The unreasonable ineffectiveness of the deeper layers. Poster presented at ICLR 2025. [https://arxiv.org/abs/2403.17887](https://arxiv.org/abs/2403.17887)\n\n> **Performance and legal notices**\n>\n> - Performance results are based on internal benchmarking with OpenVINO™ 2025.2 as of September 2025, using a configuration with an Intel® Core™ Ultra 7 268V 2.20 GHz processor with an integrated Intel® Arc™ 140V GPU, paired with 32 GB of DDR5 memory.\n> - Performance varies by use, configuration and other factors. Learn more at [www.Intel.com/PerformanceIndex](http://www.Intel.com/PerformanceIndex).\n> - No product or component can be absolutely secure.\n> - Your costs and results may vary.\n> - Intel technologies may require enabled hardware, software, or service activation.\n> - © Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries.\n> - Other names and brands may be claimed as the property of others.\n",
  "authors": [],
  "captured_at": "2026-10-04T12:50:30.804479567+00:00",
  "category": "ai",
  "content_html": "<p><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/blog/assets/intel-qwen3-agent/smolagents-1300-650.png\"><picture class=\"article-picture article-picture-fallback\" style=\"--image-ratio:16 / 9\"><img src=\"https://huggingface.co/blog/assets/intel-qwen3-agent/smolagents-1300-650.png\" alt=\"banner image\" loading=\"eager\" decoding=\"async\" fetchpriority=\"high\" referrerpolicy=\"no-referrer\" class=\"progressive-image\"></picture></a></p>\n<p>TL;DR:</p>\n<ul>\n<li>\n<p><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/Qwen/Qwen3-8B\">Qwen3-8B</a> is one of the most exciting recent releases—a model with native agentic capabilities, making it a natural fit for the AIPC.</p>\n</li>\n<li>\n<p>With <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/openvinotoolkit/openvino.genai\">OpenVINO.GenAI</a>, we’ve been able to accelerate generation by ~1.3× using speculative decoding with a lightweight Qwen3-0.6B draft.</p>\n</li>\n<li>\n<p>By using speculative decoding and applying a simple pruning process to the draft, we pushed the speedup even further to ~1.4×</p>\n</li>\n<li>\n<p>We wrapped this up by showing how these improvements can be used to run a fast, local AI Agent with 🤗 <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/huggingface/smolagents\">smolagents</a></p>\n</li>\n</ul>\n<h2>Qwen3</h2>\n<p>Qwen3-8B is part of the latest Qwen family, trained with explicit agentic behaviors. It supports tool invocation, multi-step reasoning, and long-context handling capabilities, that make it well-suited for complex agent workflows. When integrated with frameworks like Hugging Face 🤗smolagents, QwenAgent, or AutoGen, it enables a wide range of agentic applications built around tool use and reasoning. Unlike single-turn chatbots, agentic applications rely on reasoning models that produce “thinking aloud” traces, intermediate steps that expand token usage, making inference speed critical to responsiveness. The combination of optimized inference and built-in agentic intelligence makes Qwen3-8B a compelling foundation for next-gen AI agents.</p>\n<h2>Accelerating Qwen3-8B on Intel® Core™ Ultra with Speculative Decoding</h2>\n<p>We started by benchmarking the 4-bit optimized OpenVINO version of Qwen3-8B on an Intel Lunar Lake integrated GPU, establishing this as our baseline for further acceleration</p>\n<p><a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://arxiv.org/abs/2211.17192\">Speculative decoding</a> is a method to speed up auto-regressive generation. It works by using a smaller, faster model as a draft to propose multiple tokens in a single forward pass, which are then validated by the larger target model in one forward pass. In our setup, <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/OpenVINO/Qwen3-8B-int4-ov\">Qwen3-8B</a> served as the target model while <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/OpenVINO/Qwen3-0.6B-int8-ov\">Qwen3-0.6B</a> was used as the draft. This approach delivered an average of 1.3× speedup over the baseline.</p>\n<pre><code class=\"language-python\"><span class=\"code-snippet\" data-language=\"Python\"><span class=\"syntax-source syntax-python\"><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-keyword syntax-control syntax-import syntax-from syntax-python\">from</span></span><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-meta syntax-import-source syntax-python\"> <span class=\"syntax-meta syntax-import-path syntax-python\"><span class=\"syntax-meta syntax-import-name syntax-python\">openvino_genai</span></span> <span class=\"syntax-meta syntax-statement syntax-import syntax-python\"><span class=\"syntax-keyword syntax-control syntax-import syntax-python\">import</span></span></span></span><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"></span><span class=\"syntax-meta syntax-statement syntax-import syntax-python\"> <span class=\"syntax-meta syntax-generic-name syntax-python\">LLMPipeline</span><span class=\"syntax-punctuation syntax-separator syntax-import-list syntax-python\">,</span> <span class=\"syntax-meta syntax-generic-name syntax-python\">draft_model</span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">target_path</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">/path/to/target/Qwen3-8B-int4-ov<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span>\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">draft_path</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">/path/to/draft/Qwen3-0.6B-int8-ov<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span>\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">device</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">GPU<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">model</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">LLMPipeline</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">target_path</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">device</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">draft_model</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">draft_model</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">draft_path</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">device</span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n\n<span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">streamer</span></span> <span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span> <span class=\"syntax-meta syntax-function syntax-inline syntax-python\"><span class=\"syntax-storage syntax-type syntax-function syntax-inline syntax-python\">lambda</span></span><span class=\"syntax-meta syntax-function syntax-inline syntax-python\"><span class=\"syntax-meta syntax-function syntax-inline syntax-parameters syntax-python\"> <span class=\"syntax-variable syntax-parameter syntax-python\">x</span></span><span class=\"syntax-punctuation syntax-section syntax-function syntax-begin syntax-python\">:</span></span> <span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-support syntax-function syntax-builtin syntax-python\">print</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">x</span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">end</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">flush</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-constant syntax-language syntax-python\">True</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n<span class=\"syntax-meta syntax-function-call syntax-python\"><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">model</span><span class=\"syntax-punctuation syntax-accessor syntax-dot syntax-python\">.</span></span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-variable syntax-function syntax-python\">generate</span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-begin syntax-python\">(</span><span class=\"syntax-meta syntax-function-call syntax-arguments syntax-python\"><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\"><span class=\"syntax-punctuation syntax-definition syntax-string syntax-begin syntax-python\">&quot;</span></span></span><span class=\"syntax-meta syntax-string syntax-python\"><span class=\"syntax-string syntax-quoted syntax-double syntax-python\">What is speculative decoding and how does it improve inference speed?<span class=\"syntax-punctuation syntax-definition syntax-string syntax-end syntax-python\">&quot;</span></span></span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">max_new_tokens</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-constant syntax-numeric syntax-integer syntax-decimal syntax-python\">100</span><span class=\"syntax-punctuation syntax-separator syntax-arguments syntax-python\">,</span> <span class=\"syntax-variable syntax-parameter syntax-python\">streamer</span><span class=\"syntax-keyword syntax-operator syntax-assignment syntax-python\">=</span><span class=\"syntax-meta syntax-qualified-name syntax-python\"><span class=\"syntax-meta syntax-generic-name syntax-python\">streamer</span></span></span><span class=\"syntax-punctuation syntax-section syntax-arguments syntax-end syntax-python\">)</span></span>\n</span></span></code></pre>\n<blockquote>\n<p>Before initializing the <code>LLMPipeline</code>, make sure both the target and draft models are converted to OpenVINO. You can either download pre-converted models from the provided links or follow these <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/docs/optimum-intel/en/openvino/export\">instructions</a> to convert your own.</p>\n</blockquote>\n<h2>Pushing Performance Further</h2>\n<p>The speculative decoding speedup depends on the average number of generated tokens per forward step of the target, γ \\gamma, the speculation window size, and the ratio between the target and draft models' latency c c. A smaller, faster (though less accurate) draft can often deliver greater acceleration. This inspired us to shrink the draft model while still preserving its quality, i.e. E(#generated_tokens) E(\\# generated\\_tokens).</p>\n<p>Speedup=E(#generated_tokens)γc+1 Speedup = \\frac{E(\\# generated\\_tokens)}{\\gamma c + 1}</p>\n<p>Our <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/papers/2411.11055\">recent work</a> shows that model depth (number of layers) is a major contributor to inference latency. We drew inspiration from recent work on layer-wise compression[1]. In our approach, we identify blocks of layers that contribute little, measured using angular distance, and remove them. After pruning, we apply fine-tuning to recover accuracy. Using this method, we pruned 6 out of 28 layers from the Qwen3-0.6B draft model. To recover the quality of the pruned draft model, we further finetuned it using synthetic data generated by Qwen3-8B. The data was produced by generating responses to 500k prompts from <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/datasets/BAAI/Infinity-Instruct\">BAAI/Infinity-Instruct dataset</a>.</p>\n<p>The resulting pruned draft model delivered ~1.4x speedup compared to the baseline, an improvement over the ~1.3× gain achieved with the original draft. This outcome aligns with theoretical expectations - reducing draft latency improves the over-all speedup, enabling faster and more efficient inference.</p>\n<p>This demonstrates how pruning + speculative decoding can unlock faster and more efficient inference—making local AI agents even more practical.</p>\n<p>Check out the <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/supplementary_materials/notebooks/qwen-3/qwen3.ipynb\">notebook</a> and the Qwen3-0.6B depth-pruned <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://huggingface.co/OpenVINO/Qwen3-pruned-6L-from-0.6B-int8-ov\">draft model</a> to reproduce our results step by step</p>\n<h2>Integration with 🤗smolagents</h2>\n<p>To showcase the real-world potential, we deployed our optimized setup with the 🤗smolagents library. With this integration, developers can plug in Qwen3-8B (paired with our pruned draft) to build agents that call APIs and external tools, write and execute code, handle long-context reasoning and run efficiently on Intel® Core™ Ultra. The benefits aren’t limited to Hugging Face, this model pairing can also be used seamlessly with frameworks like AutoGen or QwenAgent, further strengthening the agentic ecosystem.</p>\n<p>In our demo, we assigned the accelerated Qwen3-based agent a task: 👉 Summarize the key features of the Qwen3 model series and present them in a slide deck.</p>\n<p>Here’s how it worked: 1. The agent used a web search tool to gather up-to-date information. 2. It then switched to the Python interpreter to generate slides with the <code>python-pptx</code> library. This simple workflow highlights just a fraction of the possibilities unlocked when accelerated Qwen3 models meet frameworks like 🤗smolagents, bringing practical, efficient AI agents to life on AI PC. Try it <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/supplementary_materials/notebooks/qwen-3/smolagents/qwen3_agent.ipynb\">here</a> 🚀</p>\n<h3>References</h3>\n<p>[1] Gromov, A., Tirumala, K., Shapourian, H., Glorioso, P., &amp; Roberts, D. A. (2025, January 22). The unreasonable ineffectiveness of the deeper layers. Poster presented at ICLR 2025. <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://arxiv.org/abs/2403.17887\">https://arxiv.org/abs/2403.17887</a></p>\n<blockquote>\n<p><strong>Performance and legal notices</strong></p>\n<ul>\n<li>Performance results are based on internal benchmarking with OpenVINO™ 2025.2 as of September 2025, using a configuration with an Intel® Core™ Ultra 7 268V 2.20 GHz processor with an integrated Intel® Arc™ 140V GPU, paired with 32 GB of DDR5 memory.</li>\n<li>Performance varies by use, configuration and other factors. Learn more at <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"http://www.Intel.com/PerformanceIndex\">www.Intel.com/PerformanceIndex</a>.</li>\n<li>No product or component can be absolutely secure.</li>\n<li>Your costs and results may vary.</li>\n<li>Intel technologies may require enabled hardware, software, or service activation.</li>\n<li>© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries.</li>\n<li>Other names and brands may be claimed as the property of others.</li>\n</ul>\n</blockquote>\n",
  "content_markdown": "[![banner image](https://huggingface.co/blog/assets/intel-qwen3-agent/smolagents-1300-650.png)](https://huggingface.co/blog/assets/intel-qwen3-agent/smolagents-1300-650.png)\n\nTL;DR:\n\n- [Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B) is one of the most exciting recent releases—a model with native agentic capabilities, making it a natural fit for the AIPC.\n\n- With [OpenVINO.GenAI](https://github.com/openvinotoolkit/openvino.genai), we’ve been able to accelerate generation by ~1.3× using speculative decoding with a lightweight Qwen3-0.6B draft.\n\n- By using speculative decoding and applying a simple pruning process to the draft, we pushed the speedup even further to ~1.4×\n\n- We wrapped this up by showing how these improvements can be used to run a fast, local AI Agent with 🤗 [smolagents](https://github.com/huggingface/smolagents)\n\n## Qwen3\n\nQwen3-8B is part of the latest Qwen family, trained with explicit agentic behaviors. It supports tool invocation, multi-step reasoning, and long-context handling capabilities, that make it well-suited for complex agent workflows. When integrated with frameworks like Hugging Face 🤗smolagents, QwenAgent, or AutoGen, it enables a wide range of agentic applications built around tool use and reasoning. Unlike single-turn chatbots, agentic applications rely on reasoning models that produce “thinking aloud” traces, intermediate steps that expand token usage, making inference speed critical to responsiveness. The combination of optimized inference and built-in agentic intelligence makes Qwen3-8B a compelling foundation for next-gen AI agents.\n\n## Accelerating Qwen3-8B on Intel® Core™ Ultra with Speculative Decoding\n\nWe started by benchmarking the 4-bit optimized OpenVINO version of Qwen3-8B on an Intel Lunar Lake integrated GPU, establishing this as our baseline for further acceleration\n\n[Speculative decoding](https://arxiv.org/abs/2211.17192) is a method to speed up auto-regressive generation. It works by using a smaller, faster model as a draft to propose multiple tokens in a single forward pass, which are then validated by the larger target model in one forward pass. In our setup, [Qwen3-8B](https://huggingface.co/OpenVINO/Qwen3-8B-int4-ov) served as the target model while [Qwen3-0.6B](https://huggingface.co/OpenVINO/Qwen3-0.6B-int8-ov) was used as the draft. This approach delivered an average of 1.3× speedup over the baseline.\n\n```python\nfrom openvino_genai import LLMPipeline, draft_model\n\ntarget_path = \"/path/to/target/Qwen3-8B-int4-ov\"\ndraft_path = \"/path/to/draft/Qwen3-0.6B-int8-ov\"\ndevice = \"GPU\"\n\nmodel = LLMPipeline(target_path, device, draft_model=draft_model(draft_path, device))\n\nstreamer = lambda x: print(x, end=\"\", flush=True)\nmodel.generate(\"What is speculative decoding and how does it improve inference speed?\", max_new_tokens=100, streamer=streamer)\n```\n\n> Before initializing the `LLMPipeline`, make sure both the target and draft models are converted to OpenVINO. You can either download pre-converted models from the provided links or follow these [instructions](https://huggingface.co/docs/optimum-intel/en/openvino/export) to convert your own.\n\n## Pushing Performance Further\n\nThe speculative decoding speedup depends on the average number of generated tokens per forward step of the target, γ \\\\gamma, the speculation window size, and the ratio between the target and draft models' latency c c. A smaller, faster (though less accurate) draft can often deliver greater acceleration. This inspired us to shrink the draft model while still preserving its quality, i.e. E(#generated\\_tokens) E(\\\\# generated\\\\\\_tokens).\n\nSpeedup=E(#generated\\_tokens)γc+1 Speedup = \\\\frac{E(\\\\# generated\\\\\\_tokens)}{\\\\gamma c + 1}\n\nOur [recent work](https://huggingface.co/papers/2411.11055) shows that model depth (number of layers) is a major contributor to inference latency. We drew inspiration from recent work on layer-wise compression\\[1\\]. In our approach, we identify blocks of layers that contribute little, measured using angular distance, and remove them. After pruning, we apply fine-tuning to recover accuracy. Using this method, we pruned 6 out of 28 layers from the Qwen3-0.6B draft model. To recover the quality of the pruned draft model, we further finetuned it using synthetic data generated by Qwen3-8B. The data was produced by generating responses to 500k prompts from [BAAI/Infinity-Instruct dataset](https://huggingface.co/datasets/BAAI/Infinity-Instruct).\n\nThe resulting pruned draft model delivered ~1.4x speedup compared to the baseline, an improvement over the ~1.3× gain achieved with the original draft. This outcome aligns with theoretical expectations - reducing draft latency improves the over-all speedup, enabling faster and more efficient inference.\n\nThis demonstrates how pruning + speculative decoding can unlock faster and more efficient inference—making local AI agents even more practical.\n\nCheck out the [notebook](https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/supplementary_materials/notebooks/qwen-3/qwen3.ipynb) and the Qwen3-0.6B depth-pruned [draft model](https://huggingface.co/OpenVINO/Qwen3-pruned-6L-from-0.6B-int8-ov) to reproduce our results step by step\n\n## Integration with 🤗smolagents\n\nTo showcase the real-world potential, we deployed our optimized setup with the 🤗smolagents library. With this integration, developers can plug in Qwen3-8B (paired with our pruned draft) to build agents that call APIs and external tools, write and execute code, handle long-context reasoning and run efficiently on Intel® Core™ Ultra. The benefits aren’t limited to Hugging Face, this model pairing can also be used seamlessly with frameworks like AutoGen or QwenAgent, further strengthening the agentic ecosystem.\n\nIn our demo, we assigned the accelerated Qwen3-based agent a task: 👉 Summarize the key features of the Qwen3 model series and present them in a slide deck.\n\nHere’s how it worked: 1. The agent used a web search tool to gather up-to-date information. 2. It then switched to the Python interpreter to generate slides with the `python-pptx` library. This simple workflow highlights just a fraction of the possibilities unlocked when accelerated Qwen3 models meet frameworks like 🤗smolagents, bringing practical, efficient AI agents to life on AI PC. Try it [here](https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/supplementary_materials/notebooks/qwen-3/smolagents/qwen3_agent.ipynb) 🚀\n\n### References\n\n\\[1\\] Gromov, A., Tirumala, K., Shapourian, H., Glorioso, P., & Roberts, D. A. (2025, January 22). The unreasonable ineffectiveness of the deeper layers. Poster presented at ICLR 2025. [https://arxiv.org/abs/2403.17887](https://arxiv.org/abs/2403.17887)\n\n> **Performance and legal notices**\n>\n> - Performance results are based on internal benchmarking with OpenVINO™ 2025.2 as of September 2025, using a configuration with an Intel® Core™ Ultra 7 268V 2.20 GHz processor with an integrated Intel® Arc™ 140V GPU, paired with 32 GB of DDR5 memory.\n> - Performance varies by use, configuration and other factors. Learn more at [www.Intel.com/PerformanceIndex](http://www.Intel.com/PerformanceIndex).\n> - No product or component can be absolutely secure.\n> - Your costs and results may vary.\n> - Intel technologies may require enabled hardware, software, or service activation.\n> - © Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries.\n> - Other names and brands may be claimed as the property of others.\n",
  "dateCreated": "2026-10-04T12:50:30.804479567+00:00",
  "date_created": "2025-09-29T00:00:00+00:00",
  "date_modified": "2025-09-29T00:00:00+00:00",
  "date_published": "2025-09-29T00:00:00+00:00",
  "description": "TL;DR: Qwen3-8B is one of the most exciting recent releases—a model with native agentic capabilities, making it a natural fit for the AIPC. With OpenVINO.GenAI, we’ve been able to accelerate generation by ~1.3× using speculative decoding…",
  "external_url": "https://huggingface.co/blog/intel-qwen3-agent",
  "git": {
    "commit": "ebb0941c5c06a2ab2377342d607535262a3e969e",
    "path": "items/huggingface-co/2025/09/2025-09-29-accelerating-qwen3-8b-agent-on-intel-r-coretm-ultra-with.md",
    "permalink": "https://github.com/aymericbeaumet/aggr-instance/blob/ebb0941c5c06a2ab2377342d607535262a3e969e/items/huggingface-co/2025/09/2025-09-29-accelerating-qwen3-8b-agent-on-intel-r-coretm-ultra-with.md"
  },
  "id": "urn:aggr:item:835c3e5f7868652b18ea0364e627cb045a145dab",
  "isBasedOn": {
    "@id": "https://huggingface.co/blog/intel-qwen3-agent"
  },
  "mainEntity": {
    "@id": "https://huggingface.co/blog/intel-qwen3-agent",
    "@type": "CreativeWork",
    "archivedAt": {
      "@id": "https://aggr.aymericbeaumet.com/items/huggingface-co/2025-09-29-accelerating-qwen3-8b-agent-on-intel-r-coretm-ultra-with/#webpage"
    },
    "dateModified": "2025-09-29T00:00:00+00:00",
    "datePublished": "2025-09-29T00:00:00+00:00",
    "headline": "Accelerating Qwen3-8B Agent on Intel® Core™ Ultra with Depth-Pruned Draft Models",
    "timeRequired": "PT5M",
    "url": "https://huggingface.co/blog/intel-qwen3-agent",
    "wordCount": 988
  },
  "name": "Archived snapshot: Accelerating Qwen3-8B Agent on Intel® Core™ Ultra with Depth-Pruned Draft Models",
  "preview": null,
  "reading_minutes": 5,
  "replicated_at": null,
  "source": "huggingface-co",
  "source_name": "Hugging Face - Blog",
  "summary": null,
  "tags": [],
  "temporalCoverage": "2026-10-04T12:50:30.804479567+00:00",
  "title": "Accelerating Qwen3-8B Agent on Intel® Core™ Ultra with Depth-Pruned Draft Models",
  "url": "https://aggr.aymericbeaumet.com/items/huggingface-co/2025-09-29-accelerating-qwen3-8b-agent-on-intel-r-coretm-ultra-with/",
  "word_count": 988
}