In today’s world of artificial intelligence, retrieval-augmented generation (RAG) systems have become a key component for building applications that combine external knowledge with language models. But for a RAG to work properly, an efficient retrieval engine is essential. In this article I share my practical experience reproducing three fundamental retrieval baselines —BM25, dense retrieval, and SPLADE— on a modest setup: a MacBook with 16 GB of RAM. The goal is to provide a useful guide for developers and companies looking to implement AI solutions without relying on massive infrastructure.
Reproducing these models is not trivial. BM25, a classic in information retrieval, relies on term frequency and document length statistics. Its implementation in Python using libraries like rank_bm25 is straightforward, but when working with large collections, memory optimization becomes critical. On my 16GB MacBook, I discovered that the biggest bottleneck is not computation but in-memory index manipulation. By adjusting chunking and using sparse arrays, I achieved acceptable performance. However, initial crashes taught me the importance of freeing memory with gc.collect() and reducing batch sizes.
Dense retrieval, on the other hand, introduces embeddings generated by models like Sentence-BERT. Here the challenge is twofold: vector generation and efficient indexing. With 16 GB, it is not possible to load large models without quantization. I opted for lightweight models such as all-MiniLM-L6-v2 and used FAISS for cosine similarity search. Key fixes included vector normalization and using flat indexes instead of hierarchical ones, which consume more memory. Score checks allowed me to confirm that results were consistent with the literature.
SPLADE, a model that combines sparse and dense representations, requires even more care. Its sparse but token-based representation demands vocabulary preprocessing. On my MacBook, the implementation with transformers and splade from huggingface had memory issues when expanding the full vocabulary. The solution was to limit the number of tokens per document and use torch.no_grad() to avoid gradient accumulation. After several adjustments, I managed to reproduce baseline results, validating that even modest hardware can run these models if properly optimized.
Beyond the technical side, this experience has important business implications. At Q2BSTUDIO, we understand that AI adoption in real environments does not always require expensive clusters. The ability to reproduce retrieval systems on affordable hardware democratizes access to technologies like AI agents, which depend on fast and accurate searches to contextualize responses. For example, a virtual assistant for customer service needs to combine hybrid search (BM25 + dense) to deliver relevant results in milliseconds.
Furthermore, integrating these systems with cloud services such as AWS or Azure can scale efficiency. At Q2BSTUDIO we offer cloud solutions that allow deploying search engines with high availability. Cybersecurity also plays a role: protecting indexes and embeddings from unauthorized access is critical when handling sensitive data. On the other hand, analyzing search results with BI tools like Power BI enables companies to visualize query patterns and optimize their models.
Developing custom software for RAG involves much more than copying tutorial code. It requires understanding the trade-offs between precision and latency, and knowing when to use each baseline. BM25 is great for keyword searches, while dense retrieval captures semantics. SPLADE offers a middle ground. In real projects, we combine these approaches in hybrid pipelines, and our team at Q2BSTUDIO helps companies choose the right strategy based on their data and budget.
An often overlooked aspect is result validation. In my reproduction, score checks were essential to detect implementation errors. For instance, when comparing BM25 scores with expected values, I discovered that the tokenizer was splitting certain words incorrectly. Small details like this can cause a RAG system to produce wrong answers. The discipline of testing and validation is part of our approach at Q2BSTUDIO, where we prioritize software quality from design.
The trend toward autonomous AI agents, which plan and execute tasks, heavily depends on contextual information retrieval. An agent that needs to search technical documentation or interaction history must do so in real time. Here, models like SPLADE offer a balance between efficiency and expressiveness. In our experience, combining these retrievers with large language models (LLMs) powers applications in business intelligence, process automation, and data analysis.
Finally, I want to emphasize that reproducing these baselines is not an end in itself, but a means to understand the capabilities and limitations of each approach. Companies like Q2BSTUDIO apply this knowledge in cloud AWS/Azure projects for clients who need scalable and secure search systems. Additionally, we integrate BI/Power BI tools to monitor retrieval engine performance and adjust indexing strategies. The intersection between information retrieval and other areas such as cybersecurity is increasingly relevant, as data poisoning attacks can affect search quality.
In conclusion, if you are considering implementing a RAG system in your company, you do not need a supercomputer. With a 16GB MacBook and proper optimizations, you can experiment with BM25, dense retrieval, and SPLADE. The knowledge gained will help you make informed decisions about your product architecture. At Q2BSTUDIO, we are ready to accompany you on that journey, offering custom software development, artificial intelligence, cybersecurity, and cloud services. The future of information retrieval is within everyone’s reach.




