AI & Machine Learning

Why I'm Finally Taking RAG Seriously (And Why You Should Too)

A

Adil Sher

Author

Oct 21, 2026
4 min read
0 views
Why I'm Finally Taking RAG Seriously (And Why You Should Too)

I spent three months last year building a chatbot that just... didn't work. We threw everything at it, fine-tuned models, prompt engineering, the works, and it still hallucinated like crazy when users asked it about our proprietary documentation. Then a colleague whispered the magic acronym: RAG. I nodded like I understood, but honestly? I didn't. After actually implementing it on a client project, I realize I've been approaching AI integration backwards. RAG isn't just another pattern to add to your toolkit, it's the thing that makes LLMs actually useful for real businesses.

Let me be direct: if you're building anything that needs to answer questions about specific documents or knowledge bases, you're going to hit a wall without RAG. The model doesn't know your stuff. Full stop. No amount of prompt engineering changes that. I had to learn this the hard way.

The Basic Architecture (And Why It Actually Matters)

RAG stands for Retrieval-Augmented Generation, and it's basically a pipeline with four concrete steps that I finally understand after working through this. First, you ingest documents, PDFs, text files, whatever. Second, you split them intelligently into chunks so they're digestible. Third, you embed those chunks into a vector database. Fourth, when a user asks a question, you retrieve the relevant chunks and feed them into an LLM alongside the question.

The original article walks through this, but here's what clicked for me: this is just sophisticated copy-paste with better retrieval. Instead of the model guessing answers from its training data, you're giving it the source material. That's it. That's the revolution.

The chunking step is more critical than it looks. You need overlap (the article mentions 150 characters) so sentences don't get cut awkwardly. Use recursive splitting, it's smart enough to break at paragraph boundaries first, then sentences, then words as a last resort. I've seen projects fail because someone just naively split on fixed character counts.

Embedding: The Bridge Between Text and Math

Here's where things get technical, and I had to wrap my head around this. Embeddings convert text into vectors, high-dimensional arrays of numbers. A model like nomic-embed-text takes your text chunks and outputs these vectors. You store these in a vector database (SQLite works fine for prototypes, though I've moved to Chroma for production).

When a user queries, you embed their question the same way, then find the closest vectors in your database. It's fuzzy matching, but mathematically sound. The beauty is you don't need GPT-4 for embeddings, local models like nomic-embed-text run on a laptop via Ollama.

I made a mistake early on assuming I needed to use OpenAI's embeddings. I didn't. Running embeddings locally saved us thousands monthly and reduced latency significantly.

The Actual Implementation I'd Build

Here's a simplified version of what I'd do in production:

from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain_ollama import OllamaEmbeddings
from langchain_community.vectorstores import Chroma

def setup_rag_pipeline(pdf_path):
 # 1. Load and clean
 documents = load_pdf(pdf_path)
 documents = clean_documents(documents)
 
 # 2. Split intelligently
 splitter = RecursiveCharacterTextSplitter(
 chunk_size=1000, 
 chunk_overlap=150
 )
 chunks = splitter.split_documents(documents)
 
 # 3. Embed and store
 embeddings = OllamaEmbeddings(model="nomic-embed-text")
 vectorstore = Chroma.from_documents(
 chunks, 
 embeddings, 
 persist_directory="./chroma_db"
 )
 
 return vectorstore

# At query time:
def answer_question(vectorstore, question):
 retriever = vectorstore.as_retriever()
 relevant_chunks = retriever.invoke(question)
 # Feed to LLM with prompt + chunks
 return llm_response

The magic happens in retriever.invoke()-it returns the most relevant chunks based on vector similarity.

My Take: Where This Gets Real

The original article touches on important details but doesn't emphasize something crucial: quality of cleaning matters enormously. PDFs with images, weird formatting, or non-Latin characters will trip you up. I spent two days debugging garbage characters before realizing the PDF loader was choking on encoding. The article's clean_docs() function is essential, don't skip it.

Also, this pattern is cheaper than fine-tuning. You pay per embedding (cheap) and per LLM query (one request per user query). Fine-tuning is a sunk cost that gets stale. RAG stays fresh because you can update your vector database anytime.

One thing the article glosses over: what if your PDF is scanned? You need OCR first, which is a whole different problem. Most production PDFs aren't clean text, they're images. Plan for that complexity.

What's Your Use Case?

I'm curious what drew you to RAG. Are you building a document search? A customer support chatbot? Something else? The pipeline changes slightly depending on your constraints.

The next step for me is exploring hybrid search (combining vector and keyword matching) and learning about re-ranking models to improve retrieval quality. But that's after you nail the basics.

Source: This post was inspired by "LLM - RAG - Implementation" by Dev.to. Read the original article

Written by Adil Sher

Full stack developer building high-traffic platforms, AI services, and custom web applications. Explore my portfolio, learn about my background, or get in touch.

Related Articles

Stop Calling Everything AI: A Developer's Reality Check
AI & Machine Learning Oct 18

Stop Calling Everything AI: A Developer's Reality Check

Last month, I spent two hours in a client meeting defending why their "AI-powered" recommendation system was just collaborative filtering with a glorified name. They'd read somewhere that AI was the future, saw their competitor use the word in a press release, and suddenly everyt...