Part 4: Spring AI Building a RAG Pipeline

Part 4: Spring AI Building a RAG Pipeline

A Spring AI RAG pipeline lets an LLM answer using your documents instead of just its training data. RAG — retrieval-augmented generation — is three moves: take the user’s question, find the most relevant chunks from your data (using embeddings and a vector store), and send those chunks plus the question to the model. The model answers grounded in what you gave it. Spring AI’s ChatClient and document/vector abstractions make this surprisingly little code. This is Part 4 of the Spring AI series and it ties the previous parts together. ...

Part 3: Spring AI Embeddings and Vector Stores

Part 3: Spring AI Embeddings and Vector Stores

RAG rests on two primitives: embeddings (turning text into vectors) and a vector store (saving those vectors and finding the nearest ones to a query). Spring AI gives you one interface for each — EmbeddingModel and VectorStore — and you choose the implementation with a dependency and config, exactly like the chat client in Part 2. This is Part 3 of the Spring AI series, and it’s the groundwork for the RAG pipeline in Part 4. ...

To RAG or to Fine-Tune? Picking the Right Tool for the AI Job

To RAG or to Fine-Tune? Picking the Right Tool for the AI Job

When you need an LLM to use your knowledge or behave a specific way, two approaches dominate the conversation: RAG (retrieval-augmented generation) and fine-tuning. They sound interchangeable and they’re not — they solve different problems and have very different cost, complexity, and maintenance profiles. Getting RAG vs fine-tuning right early saves you a lot of wasted GPU budget. Here’s the honest comparison. The one-line difference RAG changes what the model knows right now by injecting relevant documents into the prompt at query time. The model’s weights never change. Fine-tuning changes how the model behaves by updating its weights on your examples. Knowledge problem → reach for RAG. Behavior/format/style problem → consider fine-tuning. Most “the AI doesn’t know our stuff” issues are knowledge problems. ...