Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 9 min read Research hardMaster

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

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.

Related posts

  • Blazing Fast SetFit Inference with 🤗 Optimum Intel on Xeon

    Hugging Face mediumAdept

    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. The walkthrough calibrates on 100 rotten_tomatoes samples, quantizes a bge-small SetFit model with the IPEX backend, and benchmarks it against fp32 Transformers and IPEX bf16 with TorchScript. At batch size 1, latency drops from 15.69 ms to 4.55 ms (3.45x), model size shrinks from 127 MB to 45 MB, and sst2 accuracy moves only from 88.4% to 88.1%.

  • Smaller is better: Q8-Chat, an efficient generative AI experience on Xeon

    Hugging Face easyNovice

    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. Intel applied it to OPT, LLaMA, Alpaca, Vicuna, BloomZ and MPT-7B-chat models, roughly halving model size. On many LM Evaluation Harness tasks the quantized models matched or slightly improved accuracy, and most remaining tasks degraded only marginally. Running on a single 32-core Sapphire Rapids Xeon socket at batch size 1, the quantized models deliver low per-token latency, demonstrated in the Q8-Chat Space, with Optimum Intel integration via Intel Neural Compressor planned.

  • Faster Assisted Generation with Dynamic Speculation

    Hugging Face mediumAdept

    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. An oracle analysis shows optimal speculation lookahead varies widely across iterations, so static values waste forward passes. On an RTX 4090 the dynamic schedule beat the heuristic in every tested model pair, reaching 2.71x on OPT-6.7B summarization and 1.52x for Llama-3.1-8B with Llama-3.2-1B where the heuristic gave no speedup. It is the default for assisted generation in Transformers 4.45.0 and can be tuned or reverted through generation_config parameters.

  • Make your llama generation time fly with AWS Inferentia2

    Hugging Face mediumAdept

    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. Compiled models can be saved or pushed to the Hub and used via transformers-style generate() or optimum-neuron pipelines, supporting greedy search and top-k/top-p sampling. Benchmarks on inf2.48xlarge show Llama 2 7B encoding 256 tokens in about 0.5s, with throughput up to 750 tokens/s at batch size 4, while a 2-core 'budget' config on inf2.xlarge manages about 22–32 tokens/s. Latency is fairly insensitive to batch size, but throughput is capped by device memory and the static sequence length limits long contexts.

  • Assisted Generation: a new direction toward low-latency text generation

    Hugging Face mediumAdept

    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. The large model keeps matching tokens plus the first divergent one. The draft length adapts: it grows by 2 when every candidate matches and shrinks by 1 otherwise. The approach exploits the fact that forward passes are memory-bandwidth bound. In 🤗 Transformers it is exposed through an `assistant_model` argument to `generate` (batch size 1 only) and yields up to 2x speedups, 3x with INT8, and up to 10x when the model relies on memory offloading. It works best on input-grounded tasks like ASR and summarization, and with sampling only at low temperatures.

The quest for software engineering knowledge.

Look:
Layout: