---
title: "Testing BM25 Against Embeddings on 49 Questions About My Blog"
description: "Which retrieval method ranks the right blog post first?"
date: 2026-11-25
url: https://bryananthonio.com/blog/testing-bm25-against-embeddings-on-49-questions-about-my-blog/
tags: ["llm","rag","eval","embeddings","bm25"]
---

# Testing BM25 Against Embeddings on 49 Questions About My Blog

I tested 7 retrieval methods on 49 questions about my blog to see which ones ranked relevant posts the highest. Surprisingly, the choice of the algorithm didn’t matter as much as I expected as almost every retriever had the right post in its top 3 rankings for most of the questions.

What I found most interesting is that each retriever struggled on questions with a temporal component, where only a newer post had the right answer.

## How I Set Up the Evals

### Github Repo

You can find all of the code I used to set up my evals here in this [Github repo](https://github.com/photon-collider/blog-retrieval-bench).

### Retrieval Algorithms

I used the following algorithms to retrieve relevant blog posts and rank them in order of relevancy for each query:

-   [BM25 (bm25s)](https://en.wikipedia.org/wiki/Okapi_BM25), using Lucene’s 33 English stopwords plus a Snowball stemmer.
-   [bge-m3 (568M)](https://huggingface.co/BAAI/bge-m3), a classic encoder.
-   [EmbeddingGemma 2](https://huggingface.co/google/embeddinggemma-2), which is multimodal, but its text model is only 270M.
-   [Qwen3-Embedding-0.6B](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B), built from a Qwen3 LLM.
-   [Reciprocal rank fusion](https://docs.opensearch.org/latest/vector-search/ai-search/hybrid-search/rrf/) (RRF, k = 60), using BM25 plus each embedding model. This is a method for aggregating the rankings from a set of retrieval algorithms to get one ranking.

### Corpus

The corpus for this experiment included all 44 of my previous posts, written in [MDX, a variant of markdown](https://mdxjs.com). I didn’t use any chunking here as the longest post is ~7,600 tokens, which fits every embedding model’s context window.

The indexed text for each post contains prose, code snippets, and the frontmatter metadata (title, description, hero image alt text and captions).

### Eval Questions

My eval set contained 49 questions. Claude generated them initially and I revised the ones that didn’t sound natural.

All questions had two possible wordings. One wording was crafted in a direct manner with the relevant post in mind, so it shares the post’s vocabulary (close to BM25’s best case). The second was a paraphrase written by a subagent adopting the persona of a forgetful reader who read a post but may be hazy on certain details. Paraphrased questions were meant to favor embeddings by using fewer keywords contained in relevant posts.

I’d expect real questions to fall between these two extremes.

Each question could be answered from a single post. For some questions more than one post contained the right answer so a retrieval algorithm would need to assign a high rank to just one of these posts.

Furthermore, I labelled eight questions “current-state”, meaning that the answer has changed over time. In these cases an older post gives an outdated answer and only a newer post has the current one. I expected every retriever to struggle with these questions because none of them account for the date each post was published.

### Retrieval Metrics

As for metrics, I used Hit@k, which measures whether a relevant post is ranked as one of the top k results. Across all N questions, it’s the share where a relevant post appears in the top k results:

$\text{Hit@}k = \frac{1}{N}\sum_{i=1}^{N} \mathbb{1}[\text{rank}_i \le k]$

MRR is mean reciprocal rank, which takes the average of $1/\text{rank}$ of the first relevant post per question.

## Results

Hit@1: share of questions with a source post ranked first

*[Figure: BM25: Direct wording 0.78, Paraphrase 0.69. bge-m3 (568M): Direct wording 0.80, Paraphrase 0.78. EmbeddingGemma 2 (270M text model): Direct wording 0.86, Paraphrase 0.84. Qwen3-Embedding-0.6B: Direct wording 0.80, Paraphrase 0.84. RRF(BM25 + bge-m3): Direct wording 0.86, Paraphrase 0.82. RRF(BM25 + Gemma 2): Direct wording 0.86, Paraphrase 0.82. RRF(BM25 + Qwen3): Direct wording 0.82, Paraphrase 0.80.]*

| Retriever | Hit@1 | Hit@3 | MRR |
| --- | --- | --- | --- |
| Random | 0.03 / 0.03 | 0.08 / 0.08 | 0.11 / 0.11 |
| BM25 | 0.78 / 0.69 | 0.90 / 0.88 | 0.85 / 0.79 |
| bge-m3 | 0.80 / 0.78 | 0.92 / 0.92 | 0.87 / 0.85 |
| EmbeddingGemma 2 | 0.86 / 0.84 | 0.96 / 0.96 | 0.92 / 0.91 |
| Qwen3-Embedding-0.6B | 0.80 / 0.84 | 0.94 / 0.90 | 0.86 / 0.88 |
| RRF(BM25 + bge-m3) | 0.86 / 0.82 | 1.00 / 0.94 | 0.91 / 0.88 |
| RRF(BM25 + Gemma 2) | 0.86 / 0.82 | 1.00 / 0.94 | 0.91 / 0.88 |
| RRF(BM25 + Qwen3) | 0.82 / 0.80 | 0.98 / 0.94 | 0.89 / 0.87 |

Each cell is direct wording / paraphrase. Random is the expected score of a random ranking.

BM25 alone got 0.78 Hit@1 and 0.90 Hit@3 on the straightforward wording. On the paraphrased questions Hit@1 dropped 9 points, whereas Hit@3 only dropped by 2 points.

EmbeddingGemma 2 did really well here. On the paraphrased questions it had the highest Hit@3 and MRR, and tied Qwen3 for the highest Hit@1. On the straightforward wording, combining BM25 with Gemma 2 or with bge-m3 ranked a source post in the top 3 for every question.

### The Case For Using Embeddings

It was clear that some questions benefited more from using embeddings. For instance, every retriever ranks [the right post](https://bryananthonio.com/blog/implementing-rate-limiter-fastapi-redis/) first for this question: “what rate limiting algorithm did Bryan implement?”

Results differ if we paraphrase this to “what method did Bryan use to cap how many requests people can make?” In this case, BM25 ranks the right post in 3rd place and instead ranks my post about [visiting Chicago](https://bryananthonio.com/blog/my-first-visit-to-chicago/) first. In this query the words “did” and “people” accounted for ~75% of the score assigned to the Chicago post.

*[Figure: The two wordings of the same question, word by word. Direct wording: What rate limiting algorithm did Bryan implement? The words rate, limiting, algorithm and implement all appear in the rate limiter post, so BM25 ranks it first. Paraphrase: What method did Bryan use to cap how many requests people can make? Only requests is a distinctive word from that post, while did and people are rare words that the Chicago post uses, so BM25 ranks the right post third. Every embedding model ranks the rate limiter post first for both wordings.]*

These keywords rarely occur across my blog posts. Out of the 44 posts, only 6 and 10 posts contained the words “did” and “people”, respectively. Of the posts featuring these two keywords the Chicago post was one of the shorter ones. BM25 tends to favor shorter posts with relevant keywords so it gave this post a higher score as a result.

I could have also used a stop word list that would drop the word “did” when processing the query. In that case BM25 would have ranked [my post on building a custom Celery backend with MongoDB](https://bryananthonio.com/blog/custom-celery-mongodb-backend/) first, and the right post second.

In contrast, all of the embedding models rank the correct post first. This is to be expected since embedding models account for the semantics of a given query.

### Retrievers Struggle with Current-State Questions

All retrievers struggled with current-state questions, in part because none of them accounts for when each post was published.

Eight of the 49 questions are current-state questions. One example is the question: “what machine does Bryan use to run his recipe manager tool?” For this question, all retrievers except Qwen3 rank [this post first](https://bryananthonio.com/blog/my-homelab-setup/). That post answers the question with information that is now out of date. The post with the correct answer is [this one](https://bryananthonio.com/blog/building-a-better-nas-for-my-homelab/).

One other reason for this discrepancy is that the older post used relevant keywords like “recipe” more frequently and there’s even a whole section dedicated to talking about Mealie. The newer post, in contrast, only mentions Mealie in a brief note near the end.

*[Figure: Timeline for the question 'What machine does Bryan use to run his recipe manager tool?'. My Homelab Setup, from March 2026, has a whole section on Mealie as a recipe management tool running on the home server: the outdated answer, ranked first by 6 of 7 retrievers. Building a Better NAS for My Homelab, from October 2026, mentions once that Mealie now runs on an M1 Mac mini: the current answer. The older post matches the question better, and retrievers ignore dates.]*

Across the 8 current-state questions, each retriever ranked the correct post first for only 1 to 3 of them. Here, Hit@1 varied between 0.12–0.38. On the other 41 questions, Hit@1 was 0.80–0.98.

## Final Thoughts

Every retriever had the right post in the top 3 for 88–100% of questions. This tells me that there’s not much headroom to improve on most of the questions in my eval. However, the results from the current-state questions point to the biggest opportunity for improvement: adding a reranking step.

Based on the user’s query, we could optionally rerank the posts to prioritize newer or older posts. That’s a whole other rabbit hole to follow and one that I’d pursue with a more challenging setup.
