System Design
19. AI System Design and LLM InfrastructureAnimated
Retrieval-Augmented Generation (RAG) Architecture
Give the model fresh, relevant documents before it answers.
The idea
Retrieve relevant chunks from a knowledge base, add them to the prompt, then generate a grounded answer.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- client
- gateway / proxy
- service
- cache
- data store
- queue / stream
Turn the question into an embedding vector.
- step:
- 1/4
- at:
- User question
1/9
The green dot is a request moving through the system.
Step by step
- 1Embed the question
- 2Search the vector store
- 3Add top chunks to the prompt
- 4The LLM answers with sources
Where it is used
Chat with documents.
Watch out for
Bad retrieval makes bad answers. Measure retrieval separately.