Retrieval Augmented Generation with Huggingface Transformers and Ray

📰 Hugging Face Blog

Hugging Face integrates Ray into Retrieval Augmented Generation (RAG) for faster and more scalable contextual document retrieval

advanced Published 10 Feb 2021
Action Steps
  1. Integrate Ray into the RAG contextual document retrieval mechanism
  2. Use the Ray library to speed up retrieval calls and improve scalability
  3. Fine-tune RAG models using the integrated Ray library
Who Needs to Know This

NLP engineers and researchers can benefit from this integration to improve the performance of their RAG models, while software engineers can appreciate the scalability benefits of using Ray

Key Insight

💡 Integrating Ray into RAG can improve retrieval call speed by 2x and enhance scalability

Share This
🚀 Speed up your RAG models with Ray! 🤖

Key Takeaways

Hugging Face integrates Ray into Retrieval Augmented Generation (RAG) for faster and more scalable contextual document retrieval

Full Article

Published Time: 2021-02-10T00:00:00.012Z

# Retrieval Augmented Generation with Huggingface Transformers and Ray

[![Image 1: Hugging Face's logo](https://huggingface.co/front/assets/huggingface_logo-noborder.svg)Hugging Face](https://huggingface.co/)

* [Models](https://huggingface.co/models)
* [Datasets](https://huggingface.co/datasets)
* [Spaces](https://huggingface.co/spaces)
* [Buckets new](https://huggingface.co/storage)
* [Docs](https://huggingface.co/docs)
* [Enterprise](https://huggingface.co/enterprise)
* [Pricing](https://huggingface.co/pricing)
*
*
* * *

* [Log In](https://huggingface.co/login)
* [Sign Up](https://huggingface.co/join)

[Back to Articles](https://huggingface.co/blog)

# [](https://huggingface.co/blog/ray-rag#retrieval-augmented-generation-with-huggingface-transformers-and-ray) Retrieval Augmented Generation with Huggingface Transformers and Ray

Published February 10, 2021

[Update on GitHub](https://github.com/huggingface/blog/blob/main/ray-rag.md)

[- [x] Upvote 6](https://huggingface.co/login?next=%2Fblog%2Fray-rag)
* [![Image 2](https://huggingface.co/avatars/3391c5530f060f1eb3301671574bb416.svg)](https://huggingface.co/mggarifulla "mggarifulla")
* [![Image 3](https://huggingface.co/avatars/d7c97e6f599f487095d130680fe5ee51.svg)](https://huggingface.co/mltrials "mltrials")
* [![Image 4](https://huggingface.co/avatars/6155401e469f73c6afaad2c2fca76a63.svg)](https://huggingface.co/aslessor "aslessor")
* [![Image 5](https://huggingface.co/avatars/0810b90c3160864d96dc5a92e91c5315.svg)](https://huggingface.co/ram1813 "ram1813")
* [![Image 6](https://huggingface.co/avatars/1c255f4224eb345109e19d405b5b2cc0.svg)](https://huggingface.co/miladai "miladai")
* [![Image 7](https://cdn-avatars.huggingface.co/v1/production/uploads/noauth/LyQgYW9jZiKM89mpF8wRy.jpeg)](https://huggingface.co/anadimisra "anadimisra")

[![Image 8: system's avatar](https://cdn-avatars.huggingface.co/v1/production/uploads/1646125250765-61af81e7a7205fb7cc9ec0cb.png)](https://huggingface.co/system)

[system system Follow](https://huggingface.co/system)

##### [](https://huggingface.co/blog/ray-rag#a-guest-blog-post-by-amog-kamsetty-from-the-anyscale-team) A guest blog post by [Amog Kamsetty](https://huggingface.co/amogkam) from the Anyscale team

* [What’s next?](https://huggingface.co/blog/ray-rag#whats-next "What’s next?")

[Huggingface Transformers](https://huggingface.co/) recently added the [Retrieval Augmented Generation (RAG)](https://twitter.com/huggingface/status/1310597560906780680) model, a new NLP architecture that leverages external documents (like Wikipedia) to augment its knowledge and achieve state of the art results on knowledge-intensive tasks. In this blog post, we introduce the integration of [Ray](https://docs.ray.io/en/master/), a library for building scalable applications, into the RAG contextual document retrieval mechanism. This speeds up retrieval calls by 2x and improves the scalability of RAG distributed [fine-tuning](https://github.com/huggingface/transformers/tree/master/examples/research_projects/rag).
### [](https://huggingface.co/blog/ray-rag#what-is-retrieval-augmented-generation-rag) What is Retrieval Augmented Generation (RAG)?

[![Image 9: alt_text](https://huggingface.co/blog/assets/12_ray_rag/rag_gif.gif)](https://huggingface.co/blog/assets/12_ray_rag/rag_gif.gif)

_An overview of RAG. The model retrieves contextual documents from an external dataset as part of its execution. These contextual documents are used in conjunction with the original input to produce an output. The GIF is taken from [Facebook's original blog post](https://ai.facebook.com/blog/retrieval-augmented-generation-streamlining-the-creation-of-intelligent-natural-language-processing-models)._

Recently, [Huggingface](https://huggingface.co/) partnered with [Facebook AI](https://ai.facebook.com/) to introduce the [RAG](https://twitter.com/huggingface/status/1310597560906780680) model as part o
Read full article → ← Back to Reads

Related Videos

5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Learn 99% of Claude in 10 Minutes (Beginner to Pro)
Learn 99% of Claude in 10 Minutes (Beginner to Pro)
AI Andy
My Custom GPT For Google Shopping Titles
My Custom GPT For Google Shopping Titles
Daryl Mander
Gemini AI + Nano Banana: Deep Research to Full eBook FAST
Gemini AI + Nano Banana: Deep Research to Full eBook FAST
LoverFighterWriter
How to Use Google Gemini AI For Beginners (Full Tutorial)
How to Use Google Gemini AI For Beginners (Full Tutorial)
LoverFighterWriter
Claude vs ChatGPT: Which AI Writer Crushes Competitors?
Claude vs ChatGPT: Which AI Writer Crushes Competitors?
LoverFighterWriter