Skip to content

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

Hugging Face 6 min read How-to mediumAdept

Optimize and deploy with Optimum-Intel and OpenVINO GenAI

Hugging Face Transformers LLMs can be exported to OpenVINO IR with Optimum-Intel, quantized with NNCF, and deployed through the lightweight OpenVINO GenAI LLMPipeline from Python or C++. Models over one billion parameters default to INT8 weights during export. For Llama 3.1 8B the recommendation is to stack AWQ, scale estimation and mixed INT4/INT8 quantization using a calibration dataset. Wikitext perplexity goes from 7.34 in FP32 to 7.35 at INT8 and 7.83 at INT4. Code examples cover export via API and CLI, generation config, streaming, and chat mode that reuses the KV cache across turns.

Assumes: Hugging Face TransformersLLM quantization basicsC++ build basics

Related posts

  • Quanto: a PyTorch quantization backend for Optimum

    Hugging Face mediumAdept

    Quanto is a PyTorch quantization backend for Optimum that works in eager mode on any device (CPU, CUDA, MPS), supports int2/int4/int8/float8 weights and int8/float8 activations, and accelerates int8-int8, fp16-int4, bf16-int8 and bf16-int4 matmuls on CUDA. The workflow runs from dynamic quantization through optional activation calibration and quantization-aware training to freezing integer weights, then serializing with safetensors plus a quantization map for reloading via requantize. It integrates with transformers through QuantoConfig, works across modalities such as Whisper, and is torch.compile-friendly when activations are left unquantized.

  • Get your VLM running in 3 simple steps on Intel CPUs

    Hugging Face mediumAdept

    SmolVLM2-256M can run locally on Intel CPUs by converting it to OpenVINO IR with Optimum Intel, quantizing it, and running generation, with optional Intel GPU offload via device="gpu". Two post-training options are covered: 8-bit weight-only quantization, and a mixed setup that applies calibrated static quantization to the vision encoder and weight-only quantization to the language model. On a Core Ultra 7 265K, converting to OpenVINO cut time to first token from 5.15s to 0.42s and raised decoding throughput from 0.7 to 47 tokens/s. Adding 8-bit weight-only quantization pushed TTFT to 0.25s and throughput to 64 tokens/s.

  • Accelerate your models with 🤗 Optimum Intel and OpenVINO

    Hugging Face mediumAdept

    Optimum Intel now integrates OpenVINO, letting Transformers models run on OpenVINO Runtime across Intel processors and be quantized with the Neural Network Compression Framework (NNCF). A walkthrough applies post-training static quantization to a ViT image classifier fine-tuned on food101, using 300 calibration samples, then exports to OpenVINO IR and loads the result via OVModelForImageClassification pipelines. The quantized model shrinks 3.8x (344MB to 90MB) and cuts per-sample latency 2.4x (98ms to 41ms) with no measurable accuracy loss (87.6). Warm up the model before benchmarking, because compilation happens on the first inference. Encoder-decoder quantization is not yet supported.

  • 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.

  • 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.

The quest for software engineering knowledge.

Look:
Layout: