Blazing Fast SetFit Inference with 🤗 Optimum Intel on Xeon
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%.
Related posts
- CPU Optimized Embeddings with 🤗 Optimum Intel and fastRAG
Hugging Face mediumAdeptPost-training static int8 quantization of BGE embedding models (small, base, large) with Optimum Intel, Intel Neural Compressor and IPEX gives up to 4.5x lower latency and up to 4x higher throughput on 4th-gen Xeon CPUs compared with a bf16 PyTorch baseline. Accuracy loss stays small: under 0.3% on MTEB reranking and up to 1.55% on retrieval. The guide covers calibration with a qasper subset, loading the model with IPEXModel, and the benchmark setup (ipexrun, TCMalloc, single socket). It also shows how to plug the quantized models into fastRAG's QuantizedBiEncoderRetriever and QuantizedBiEncoderRanker for RAG indexing and reranking.
- Intel and Hugging Face Partner to Democratize Machine Learning Hardware Acceleration
Hugging Face mediumAdeptIntel has joined Hugging Face's Hardware Partner Program, and the two are collaborating on Optimum Intel, an open-source library built on Intel Neural Compressor that applies quantization, pruning and distillation to Transformer models on Xeon CPUs. A worked example applies post-training dynamic quantization to a DistilBERT review classifier with a 5% tolerable accuracy loss and up to 10 tuning trials. The run converts all 38 Linear and 2 Embedding operators to INT8, dropping accuracy from 0.574 to 0.546 while making evaluation 1.34x faster.
- Introducing Optimum: The Optimization Toolkit for Transformers at Scale
Hugging Face easyNoviceOptimum is a new open source Hugging Face library that targets production performance for Transformer models by wrapping hardware-specific acceleration tooling built with hardware partners. Its first integration uses Intel Neural Compressor to quantize Transformers for Intel Xeon CPUs. Quantization is hard to do by hand: ops must be swapped for quantized kernels, quantize/dequantize nodes inserted, observers, schemes and int8/uint8/int16 types chosen, and accuracy loss balanced. Neural Compressor handles this through post-training, quantization-aware and dynamic quantization driven by a YAML config that can be stored on the Model Hub.
- Accelerate your models with 🤗 Optimum Intel and OpenVINO
Hugging Face mediumAdeptOptimum 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.
- Smaller is better: Q8-Chat, an efficient generative AI experience on Xeon
Hugging Face easyNoviceSmoothQuant 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.