---
title: "Accelerate StarCoder with 🤗 Optimum Intel on Xeon: Q8/Q4 and Speculative Decoding"
description: "Combining INT8 SmoothQuant quantization with assisted generation (speculative decoding) speeds up StarCoder-15B inference on 4th Gen Intel Xeon by about 7.3x in time per output token, with no loss on HumanEval pass@1."
url: "https://swe.quest/articles/accelerate-starcoder-with-optimum-intel-on-xeon-q8-q4-and-speculative-decoding-3e5a7bd24523d940"
canonical: "https://huggingface.co/blog/intel-starcoder-quantization"
source: "Hugging Face"
published: "2024-01-30"
difficulty: "hard"
kind: "Research"
reading_minutes: 9
tags: ["inference","llms","performance","hardware","ai-coding"]
---

# Accelerate StarCoder with 🤗 Optimum Intel on Xeon: Q8/Q4 and Speculative Decoding

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2024-01-30, 9 min read, Research. Original: [https://huggingface.co/blog/intel-starcoder-quantization](https://huggingface.co/blog/intel-starcoder-quantization)

## Summary

Combining INT8 SmoothQuant quantization with assisted generation (speculative decoding) speeds up StarCoder-15B inference on 4th Gen Intel Xeon by about 7.3x in time per output token, with no loss on HumanEval pass@1. INT8 static quantization gives roughly 2.2x on both time to first token and per-token latency. Groupwise 4-bit weight-only RTN gives 3.35x on per-token latency but slows the first token to 0.84x, because dequantization adds compute where the prefill phase is compute-bound while decoding is memory-bandwidth-bound. For assisted generation, an INT8 164M-parameter draft model that fits in CPU cache plus an INT8 target model works better than 4-bit, since verifying K tokens in parallel shifts the bottleneck back to compute. The resulting models load through optimum-intel's IPEXModelForCausalLM.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)
- [Hardware](https://swe.quest/tags/hardware.md) (Infrastructure)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)

## Prerequisites

- LLM autoregressive decoding ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- model quantization basics ([easy posts on Inference & serving](https://swe.quest/tags/inference.md?difficulty=easy))
- speculative decoding
- CPU memory bandwidth bottlenecks ([easy posts on Hardware](https://swe.quest/tags/hardware.md?difficulty=easy))

## Keywords

StarCoder, Optimum Intel, Intel Xeon, Intel AMX, SmoothQuant, Intel Extension for PyTorch, HumanEval, assisted generation

## Related posts

- [Blazing Fast SetFit Inference with 🤗 Optimum Intel on Xeon](https://swe.quest/articles/blazing-fast-setfit-inference-with-optimum-intel-on-xeon-804c53c4c80ba1a3.md): Hugging Face · 2024-04-03 · Medium · 6 min read · Inference & serving, Performance engineering, Hardware, Python
  Post-training static int8 quantization of a SetFit model body with Optimum Intel and Intel Neural Compressor speeds up inference on Xeon CPUs by up to 7.8x in throughput with negligible accuracy loss.
- [Smaller is better: Q8-Chat, an efficient generative AI experience on Xeon](https://swe.quest/articles/smaller-is-better-q8-chat-an-efficient-generative-ai-experience-on-xeon-67e9bd0a15445b38.md): Hugging Face · 2023-05-16 · Easy · 5 min read · Inference & serving, LLMs, Hardware
  SmoothQuant enables accurate 8-bit (INT8) post-training quantization of LLMs by mathematically shifting activation outliers into the weights, which makes Transformer layers quantization-friendly.
- [Faster Assisted Generation with Dynamic Speculation](https://swe.quest/articles/faster-assisted-generation-with-dynamic-speculation-d8a65fbd607c86ac.md): Hugging Face · 2024-10-08 · Medium · 7 min read · Inference & serving, LLMs, Performance engineering
  Dynamic speculative decoding stops the draft model's token generation as soon as its softmax confidence falls below a threshold (assistant\_confidence\_threshold), rather than always drafting a fixed or heuristically adjusted number of tokens before verification by the target model.
- [Make your llama generation time fly with AWS Inferentia2](https://swe.quest/articles/make-your-llama-generation-time-fly-with-aws-inferentia2-bc8b5e1981a590c0.md): Hugging Face · 2023-11-07 · Medium · 7 min read · Inference & serving, LLMs, Hardware, Cloud platforms, Performance engineering
  optimum-neuron can now compile and export Llama 2 models for text generation on AWS Inferentia2, using static input shapes (batch size, 2048 sequence length that also bounds the KV cache) and a configurable core count and fp16 precision.
- [Assisted Generation: a new direction toward low-latency text generation](https://swe.quest/articles/assisted-generation-a-new-direction-toward-low-latency-text-generation-46c4fea13508392f.md): Hugging Face · 2023-05-11 · Medium · 12 min read · Inference & serving, LLMs, Performance engineering, Python
  Assisted generation cuts autoregressive LLM latency by letting a much smaller assistant model with the same tokenizer greedily draft candidate tokens, then verifying them all in a single forward pass of the large model.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
