---
title: "Building Cost-Efficient Enterprise RAG applications with Intel Gaudi 2 and Intel Xeon"
description: "A RAG chatbot built with LangChain's rag-redis template runs BAAI/bge-base-en-v1.5 embeddings on Intel Granite Rapids Xeon CPUs, Redis as the vector store, and an LLM served by Hugging Face TGI on Gaudi 2."
url: "https://swe.quest/articles/building-cost-efficient-enterprise-rag-applications-with-intel-gaudi-2-and-b583c6eb9fcf2d2e"
canonical: "https://huggingface.co/blog/cost-efficient-rag-applications-with-intel"
source: "Hugging Face"
published: "2024-05-09"
difficulty: "medium"
kind: "How-to"
reading_minutes: 8
tags: ["rag","inference","hardware","cost-optimization","llms"]
---

# Building Cost-Efficient Enterprise RAG applications with Intel Gaudi 2 and Intel Xeon

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2024-05-09, 8 min read, How-to. Original: [https://huggingface.co/blog/cost-efficient-rag-applications-with-intel](https://huggingface.co/blog/cost-efficient-rag-applications-with-intel)

## Summary

A RAG chatbot built with LangChain's rag-redis template runs BAAI/bge-base-en-v1.5 embeddings on Intel Granite Rapids Xeon CPUs, Redis as the vector store, and an LLM served by Hugging Face TGI on Gaudi 2. The walkthrough covers ingesting Nike 10-K filings, wiring the retrieval chain, launching TGI Gaudi via Docker (with sharding for 70B models and optional FP8 quantization, claimed 1.8x over BF16), and starting the FastAPI backend and npm GUI. Intel's benchmark of Llama2-70B with 16 concurrent users reports H100 delivering 1.13x more throughput but only 0.44x the performance per dollar of Gaudi 2, with pricing caveats.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [RAG & retrieval](https://swe.quest/tags/rag.md) (AI & ML)
- [Inference & serving](https://swe.quest/tags/inference.md) (AI & ML)
- [Hardware](https://swe.quest/tags/hardware.md) (Infrastructure)
- [Cost optimization](https://swe.quest/tags/cost-optimization.md) (Reliability & operations)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)

## Prerequisites

- retrieval-augmented generation basics
- Docker ([easy posts on Containers](https://swe.quest/tags/containers.md?difficulty=easy))
- LangChain

## Keywords

Intel Gaudi 2, Text Generation Inference, LangChain, Redis, Optimum Habana, OPEA, Granite Rapids, Llama 2

## Related posts

- [Text-Generation Pipeline on Intel® Gaudi® 2 AI Accelerator](https://swe.quest/articles/text-generation-pipeline-on-intel-gaudi-2-ai-accelerator-08fe7776346f5b95.md): Hugging Face · 2024-02-29 · Medium · 6 min read · Inference & serving, LLMs, Hardware, Python
  Optimum Habana's custom GaudiTextGenerationPipeline runs Llama 2 text generation (7b, 13b, 70b) on Intel Gaudi 2 with a few lines of code, handling pre- and post-processing end to end.
- [CPU Optimized Embeddings with 🤗 Optimum Intel and fastRAG](https://swe.quest/articles/cpu-optimized-embeddings-with-optimum-intel-and-fastrag-e206611a492390e0.md): Hugging Face · 2024-03-15 · Medium · 11 min read · Inference & serving, RAG & retrieval, Performance engineering, Hardware, Python
  Post-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.
- [Benchmarking Language Model Performance on 5th Gen Xeon at GCP](https://swe.quest/articles/benchmarking-language-model-performance-on-5th-gen-xeon-at-gcp-7e85a320d2818cb1.md): Hugging Face · 2024-12-17 · Medium · 6 min read · Inference & serving, Performance engineering, Hardware, Cloud platforms, LLMs
  On Google Cloud, C4 instances (5th Gen Xeon Emerald Rapids with AMX) deliver 10x–24x higher throughput than N2 instances (3rd Gen Ice Lake, AVX-512 only) for text embedding with UAE-Large-V1, and 2.3x–3.6x higher throughput for Llama 3.2 3B text generation.
- [Fast Inference on Large Language Models: BLOOMZ on Habana Gaudi2 Accelerator](https://swe.quest/articles/fast-inference-on-large-language-models-bloomz-on-habana-gaudi2-accelerator-b18b18c9b1b881f4.md): Hugging Face · 2023-03-28 · Medium · 8 min read · Inference & serving, LLMs, Hardware, Performance engineering
  BLOOMZ (176B parameters, 352 GB in 16-bit) runs inference on a single 8-HPU Habana Gaudi2 server using Optimum Habana with Habana's DeepSpeed-inference fork, HPU graphs and a KV cache.
- [AMD + 🤗: Large Language Models Out-of-the-Box Acceleration with AMD GPU](https://swe.quest/articles/amd-large-language-models-out-of-the-box-acceleration-with-amd-gpu-fa18508c54402fa1.md): Hugging Face · 2023-12-05 · Easy · 7 min read · Inference & serving, Hardware, LLMs, Performance engineering
  Hugging Face Transformers now runs all models and tasks on AMD Instinct GPUs with no code changes versus NVIDIA, backed by ROCm support for Flash Attention v2, vLLM Paged Attention, DeepSpeed, GPTQ via AutoGPTQ, ONNX Runtime's ROCMExecutionProvider, and Optimum-Benchmark.

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)
