<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Victor Mocioiu on Medium]]></title>
        <description><![CDATA[Stories by Victor Mocioiu on Medium]]></description>
        <link>https://medium.com/@victormocioiu?source=rss-d67d706e5008------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*FAkH6j7tNxqwBcjH.</url>
            <title>Stories by Victor Mocioiu on Medium</title>
            <link>https://medium.com/@victormocioiu?source=rss-d67d706e5008------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 17:11:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@victormocioiu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Production-grade hybrid RAG on €116/month of compute — part 1: the pipeline, the benchmarks, the…]]></title>
            <link>https://medium.com/@victormocioiu/production-grade-hybrid-search-rag-on-116-month-of-compute-part-1-the-pipeline-the-deede53d461d?source=rss-d67d706e5008------2</link>
            <guid isPermaLink="false">https://medium.com/p/deede53d461d</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[hybrid-rag]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[postgres]]></category>
            <dc:creator><![CDATA[Victor Mocioiu]]></dc:creator>
            <pubDate>Sat, 08 Aug 2026 16:44:38 GMT</pubDate>
            <atom:updated>2026-08-08T17:34:42.299Z</atom:updated>
            <content:encoded><![CDATA[<h3>Production-grade hybrid RAG on €116/month of compute — part 1: the pipeline, the benchmarks, the receipts</h3><p>Hey y’all; short version before the meat: by the time this series wraps, you’ll have a production-grade hybrid search &amp; RAG pipeline — chatbot, authed UI, public domain, the whole kit — humming in your own Kubernetes cluster for ~€116/month. Since “production grade” is basically the most abused phrase online, I didn’t just claim it — I measured it against a public benchmark. On EnterpriseRAG-Bench (512K documents: Slack, email, Jira), this setup hits a recall of 0.662 — placing it above Azure AI Search, Vertex AI Search, and Weaviate, and just four-ish points behind Amazon Kendra. All on Postgres. With a tiny 118M-parameter embedder running on 2 shared vCPUs. Receipts are at the bottom; everything is measured, nothing is vibes.</p><p>This is the tutorial I wish existed when the AI hype train started. Maybe it was out there and I missed it — could’ve been a skill issue. I know everyone is in a rush, so all the code is available <a href="https://github.com/victormocioiu/hrag">here</a> and this is the high-level architecture we’re building:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pmDCRZWBho8BohSx1H_25w.png" /></figure><p><strong>What’s in part 1</strong> (it’s long, but every section pays rent):</p><ul><li><strong>Step 0 — le kubernetes cluster.</strong> Node pools, labels, taints, and what this actually costs (spoiler: €116/month, receipts attached).</li><li><strong>Step 1 — the embedder.</strong> multilingual-e5-small, quantized FP32→INT8: same answers (0.996 cosine parity), twice the throughput, 30% less RAM — thank AVX-512 VNNI.</li><li><strong>Step 2 — parsing and chunking.</strong> 7 PDF engines enter, one leaves. Plus: naive chunking silently destroys ~70% of table facts, and I have the charts to prove it.</li><li><strong>Step 3 — being persistent.</strong> Postgres + pgvector + BM25, RRF fusion, multi-tenancy via RLS with FORCE — and no elasticsearch anywhere in sight.</li><li><strong>Step 3.5 — but is it right?</strong> An eval harness with planted markers. 7 configs, 104 queries, and the verdict on every knob people have opinions about.</li><li><strong>Step 4 — the final boss.</strong> 512K documents from a public enterprise benchmark. My €116/month cluster vs. AWS, Azure, Google, and OpenAI. It goes better than it has any right to.</li></ul><p>Part 2 of the series covers the user-facing half: auth, UI, full multi-tenancy, the generation layer, a reranker, and the official leaderboard submission.</p><p>Prior kubernetes knowledge is not needed — I’ll explain concepts along the way.</p><p>Here’s the end state in 2 minutes, so you know what you’re signing up for (this covers the final outcome after going through part 1 and part 2):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fb7IWXz6Q3Ho%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Db7IWXz6Q3Ho&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fb7IWXz6Q3Ho%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1dbb405e0aa9938698a2fbde57b53dbc/href">https://medium.com/media/1dbb405e0aa9938698a2fbde57b53dbc/href</a></iframe><p>Also if you’re itching to play around with the results before commiting everything is live at <a href="https://hrag.app/">hrag.app</a> .</p><p>Vanity note before we start: I wrote this because I miss writing, so the words below are mine — some AI augmentation here and there, kept to a minimum. Don’t let the em dashes fool you either…I used to write in academia and abused them long before the stochastic robots did. If any of it reads like AI slop, reach out and tell me, cause it means I’ve been intoxicated by the thing I’m building on. With that out of the way…</p><h3>Prerequisites</h3><p>There are some prerequisites to get to that end state though:</p><ul><li>an account on hetzner.com (this is where we’ll get our compute from, and yep it’ll cost some cash moneys but you get to see all of this in your own infra — and it’s the only thing that will cost. promise . scouts honor)</li><li>a github account (lol — but necessary)</li><li>an account on <a href="http://edka.io/">edka.io</a> (don’t worry the free tier is more than enough for this)</li><li>an account on <a href="http://tailscale.com/">tailscale.com</a></li><li>(optional) a domain…any domain really — I got mine from <a href="http://namecheap.com/">namecheap.com</a> but any registrar works. And don’t worry setup is suppa ez on edka — I’m lazy af when it comes to this sort of stuff so my co-founder, <a href="https://x.com/camilblanaru">Camil</a>, made it as Victor proof as possible.</li></ul><p>Ok — enough intro let’s do this.</p><h3>Step 0 — le kubernetes cluster (€116/month of Hetzner)</h3><p>Please follow through the instructions <a href="https://edka.io/docs/get-started/create-your-first-cluster/">here</a>. For our tutorial we’re going to need a one node control plane, then we need 4 separate node pools — the default one for misc stuff, one for the UI, one for the ingestion pipeline, and one for the stores. You can use CX23 instances, for the first 3 nodepools and for the stores node pool I’d go with CX33. The ui, ingestion and stores node pools are each going to get their label and taint:</p><ul><li>Ui — pool:ui / pool:ui:NO_SCHEDULE</li><li>Stores — pool:stores/ pool:stores:NO_SCHEDULE</li><li>Ingest — pool:embed / pool:embed:NO_SCHEDULE</li></ul><p>In kubernetes, <strong>labels</strong> are metadata key-value pairs you attach to objects (like pods) to organize and query them — for example, labeling pods with app: web or env: prod lets you easily select “all production web pods” for deployments or monitoring. <strong>Taints</strong> are the opposite: they’re marks on nodes that repel pods unless those pods explicitly tolerate them, useful for dedicating nodes to specific workloads like GPU jobs. Taints come in three flavors: <strong>NoSchedule</strong> prevents new pods from being scheduled on that node but leaves existing pods running (good for maintenance windows where you want to drain gradually); <strong>NoExecute</strong> is stricter and actually evicts existing pods that don’t tolerate the taint (useful when decommissioning a node fast); and <strong>PreferNoSchedule</strong> is a soft preference where Kubernetes avoids scheduling new pods there but will if resources are tight elsewhere (like suggesting “try other nodes first” for less critical workloads).</p><p>For now you can think of pods as of a docker container (plus some kubernetes magick), and translating the above means — labels are a way to tag pods, and taints are a way to tag infra such that only allow pods with certain tags.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mDv0_u2rSXW_JcgjtSbTSg.png" /></figure><p>Once the cluster is created you can see something similar in the overview tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FbtsuN9NwXee4N1BeTJnMQ.png" /></figure><p>BTW money talk, cause this whole series runs on receipts. On the 1st of august 2026 this setup costs <strong>€115.95/mo excluding VAT</strong> on regular CPX (amd) instances and it’s the number every benchmark below ran on. If you’re lucky and cost-optimized instances are available in your zone, the same layout drops to €32.95/mo. We were unlucky…or so we thought: the CPX machines turned out to be AMD EPYC Genoa, and that silicon came with a free lunch — read below.</p><p>For prod…I’d go with having HA on the control plane, for the ui same instances but activate autoscaling on the nodepool and go up to 5 — really depends on your expected traffic here…well all of them do so :)) . Ideally for the storage and ingest parts I’d go with bare metal instances. If you do <a href="https://edka.io/blog/bare-metal-kubernetes-hetzner-edka/">this</a> is the wae . At current pricing for a very decent prod setup I’d expect around 300–500 euros a month in infra cost for this project. For an extra 100 eurinhos I’m sure you can have a dev/staging env as well. The jump over the tutorial setup is HA control plane, autoscaling headroom, and bare metal for stores/ingest. And yes — we support bare metal in edka. ;)</p><p>Now before we move to the next step I suggest we do some things that we only have to do once and then that will be that. First setup the <a href="https://edka.io/docs/integrations/github/">integration</a> with github, then <a href="https://edka.io/docs/registry/overview/">install</a> the in-cluster zot registry (where all the docker images will live), then setup the tailscale <a href="https://edka.io/docs/traffic/tailscale/">integration</a>. I’ll do some hand holding on this one — first go to the gateway tab and install the envoy gateway and then the tailscale operator.</p><h3>Step 1- the embedder — INT8 quantization and the free AVX-512 lunch</h3><p>The embedder sits at the heart of this project — it is the part that will take text and transform it into vectors thus enabling all those nice algebra things that make most of the ai systems work. Not going to go into details about how this works — my assumption is that you kinda have a grasp of this, but if you don’t I <a href="https://medium.com/@sharanharsoor/the-complete-guide-to-embeddings-and-rag-from-theory-to-production-758a16d747ac">gochu</a>.</p><p>To start off, fork this repo — <a href="https://github.com/victormocioiu/rag-embedder">https://github.com/victormocioiu/rag-embedder</a> . Then we can go to the deployments tab and select our repo — rag-embedder. We have to set some params in the runtime configuration , namely the port container is 8001, we want 500m for CPU request (we reserve half of a cpu for this service — it is minimum guaranteed cpu performance) , 2000m CPU limit (we can use max 2 cores in peak usage — in this case all the cores of this node pool), 512Mi for memory request (reserve half a gb) and memory limit 2048Mi (so 2gb for when embedding goes brrrr).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QeAC2yEyDp6BhgND4PQXCQ.png" /></figure><p>Next pls go to the placement tab and select the embed pool — this will mean that the embedder will only live in this node pool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pKdRoUH7xLtGoLXXmoKZtQ.png" /></figure><p>Next go to the networking tab and toggle the expose deployment button. Since we’ve already installed the tailscale operator this should already populate the view with everything we need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CCk15Ph-jfo1L-mW-FZ5YQ.png" /></figure><p>Now — click that glorious create deployment button and…wait… The first time around this takes a while as we’re building most of the stuff from scratch… so in my case it took about 5 minutes. After that, if you’re connected to tailscale you should be able to reach your url — I suggest going directly to /docs to confirm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SfgQMrXDhMKzEueRc4QAFQ.png" /></figure><p>Ok cool…infra done…let’s see what this baby can do and how we optimize it. Aiight so…we thought we were unlucky for getting the more expensive machines on Hetzner…however ours turned out to be AMD EPYC Genoa processors — and you verify that by reading the CPU flags, because Hetzner presents a generic QEMU model string — and the way you do that is by using edka -shameless self-promotion — just go to observability/metrics -&gt; click browse catalog choose nodes and click on node_cpu_flag_info . And you’d think, cool but why does that matter — well because Genoa has AVX-512 VNNI instructions…dot-product instructions literally built for neural nets. On their own that’s nice…but the real advantage is this: if you shrink the model’s numbers from FP32 down to INT8, one of those instructions chews through 64 multiply-adds at a time instead of 16. If you’ve taken a look at the project repo you’ll notice we use ONNX Runtime for CPU inference — and because it comes bundled with kernels for everything (SSE, AVX2, AVX-512, VNNI) it automagically picks the speediest one at runtime. Same model file, same Docker image…faster on better silicon, zero rebuilds. So more bang for the same buck…but, and I know I’ve just said it, it also opens the gate for even MORE bang per buck by quantizing the embedder from FP32 to INT8. So I did exactly that. Now, your gut should be screaming “but doesn’t chopping 32-bit floats into 8-bit ints wreck the accuracy?”…mine did too, so I measured because my gut does not know math that well also so you don’t have to take my word for any of it.</p><p>mini intermezzo — cause I forgot to mention, the embedder we are using is multilingual-e5-small… and every word in that name really means something. Multilingual: it handles ~100 languages in one model, so a German invoice and a Spanish email land in the same vector space. Small: ~118M parameters, which quantized down to a ~118MB ONNX file…small enough to bake straight into the Docker image and run comfortably on a 2-core box. As for the <a href="https://arxiv.org/abs/2212.03533">e5</a> …pff.. it does mean something; it stands for ‘EmbEddings from bidirEctional Encoder rEpresentations’ — five E’s, you can blame Microsoft; I do.</p><p>Also one sneaky-important spec: it outputs 384-dimensional vectors instead of the 1536 you get from the typical embedding APIs. Why does that matter for us? Because that’s a 4× difference which means that in postgres with pgvector’s halfvec (2 bytes per dimension) a vector costs 768 bytes, so a million chunks is ~0.7GB of vectors instead of ~3GB. And if you’re not really as deep as my severely fried brain is into this — a book page comes out to roughly 1.3 chunks, so 1M chunks is about 770k book pages…call it 2,500 novels or so Claude tells me. And before you even see the benchmarks: embedding all of it takes about 13 hours on this node…which, if you’re the cost-driven type, works out to about 35 euro cents of node time. enough intermezzo..benchmarks and optimisations’</p><h3>Benchmarks — INT8 vs FP32: same answers, 2× throughput, 30% less RAM</h3><p>First thing first — I had Claude generate 200 sentences in multiple languages — then ran them locally on the FP32 PyTorch implementation and live on the INT8 endpoint and did a cosine similarity check per pair which yielded a mean of 0.996 and 95% of the pairs were above 0.994. Check the amazing figure below (man I should really be more grateful for my time in academia)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Fb-5s2UsUjZKTMRaY9hCQ.png" /></figure><p>Oke so we’ve lost <em>some</em> precision…but what did that get us? Here I measured directly on the pod but also the live http endpoint (from a pod next door, so the network doesn’t pollute the numbers) cause I wanted to see how the wrapping affects us as well:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NdBWpE-WAQzWo2rHvDcU_Q.png" /></figure><p>We are squeezing more computation out of the same and we’re also consuming about 30% less memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*vtLj-5yStySwIstSsjttGQ.png" /></figure><p>So then if I were to summarize this info what would I say? I’d say we basically get the same answers but twice as fast on 30% less ram. Oh, and the previous figure, the one with the batches gives one extra piece of information — if we wanna squeeze everything from the instance…we should really use batches of around 32 — so process 32 chunks at the same time. And with that we’re ready to move on to the next bit — feeding the embedder — so parsing and chunking.</p><h3>Step 2 — parsing and chunking</h3><p>The embedder eats text and spits out vectors…but one has to slaughter the markdowns, the docxes, the htmls, and the PDFs first. Enough with the metaphors -start by forking this <a href="http://github.com/victormocioiu/rag-ingest">repo</a>. This will live in the same node pool as the embedder and its job is to sniff -&gt; parse -&gt;chunk -&gt; send to embed.</p><p>Before we eagerly move on to deploying this we’ll need a valkey instance for caching (promised production — delivering production) and being sure that we don’t lose time if we upload duplicate content. So what I need you to do is, in edka, go to the databases tab and create a new valkey instance. We’ll be using 250m for CPU request, 1000m for CPU limit, 256 Mi for memory request and 1024 Mi for memory limit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fIO1lSDH-zLUDerLNLlxVw.png" /></figure><p>Then in the placement tab make sure to assign it to the stores pool. That’s it — click create, wait for it to finish and grab the connection key — in my case it turned out to be redis://valkey.valkey.svc.cluster.local:6379/0. Nice we can now move to deploying the rag-ingest part. So under deployments select the proper repo and put in 8002 as the container port, 250m for CPU request, 1000m for CPU limit, 256 Mi for memory request and 1024 Mi or 1Gi for memory limit; remember to place it in the embed pool and expose it through tailnet.</p><p>Now for env vars, we need 3 things — the internal url of the rag-embedder, the internal url of the valkey service and a time to live for the entries in cache as we don’t want to keep everything forever and ever. In my case (and if you followed along they should be the same for you) those 3 env vars are:</p><ul><li>EMBEDDER_URL=http://rag-embedder.rag.svc.cluster.local</li><li>VALKEY_URL=redis://valkey.valkey.svc.cluster.local:6379/0</li><li>CACHE_TTL_S=604800</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5-x1iN3pV3ex8jPFtRTZ1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HSoS05coo_8v6UWb0H8JUg.png" /></figure><p>Put those in click deploy then click build…should take a few minutes before you can access your tailnet url.</p><h3>Benchmarks -where ingestion time actually goes</h3><p>Great! Now that this is live we can move on to le benchmarks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w7IVP7aMruA-oBXulATiRg.png" /></figure><p>Ok cool, it looks like the embedder is the bottleneck as somewhat expected; and yep — at about 3 seconds per 20 page document that is 150 ms per text-dense page. But that number is only valid if we go the naive way of chunking — more on that in a second.</p><h3>The Valkey cache: re-ingesting embeds nothing</h3><p>Let’s also see if valkey earns its keep…drum roll please:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*obH9lXQ810S7oFvxx4nGgw.png" /></figure><p>Shock and awe — it does earn its keep by making the whole ingest pipeline on duplicated content roughly 40 times faster. Kinda expected tbh and very handy in my experience.</p><h3>Chunking: naive vs structural (or: how to silently lose 70% of your tables)</h3><p>Ok — but we do live in a world where documents have some kind of structure to it and chunking naively would lose some structure. In the naive approach we use a window (480 tokens in our case) and some overlap with the next window (64 tokens) and slide that window until we have the whole document until it is done. To preserve structure we go structural instead: walk the parsed text in document order, keeping a stack of the headings above the current position. Pack paragraphs into the current chunk until the next one wouldn’t fit — then close the chunk and keep going under the same heading, carrying up to 64 tokens of trailing text as overlap. When a new heading arrives, close the current chunk immediately and without overlap…no chunk ever mixes two sections. Every chunk gets its full heading path (“Billing &gt; Refunds”) prepended, and those tokens count against the same 480 budget — the heading rides inside the window, not on top of it. (And if a single paragraph is bigger than the whole budget, we split at sentences, and only cut mid-sentence as a last resort.)</p><p>So to get a visualization of how those two strategies look like in terms of the same document here you go:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TvAGoGozdmsO2J-1l5-RQg.png" /></figure><p>Notice that we get 43 chunks in the naive approach where all -1 chunks are of 480 token length and in the structural approach we get 60 chunks grouped in 2 cohorts. Man you can really tell that that is synthetic data — lol.</p><p>Mkay, chunking tackled which leaves one more question at least in terms of latency and that is using various formats. For this test we use the same 20 docs but in md, html, docx, and pdf format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4p69lKbILvC65pZTVUXb6w.png" /></figure><p>As expected markdown and html are the fastest whereas docx and pdf are the slowest. Embedding still takes the same time…and one thing I’ve noticed is that the library that we’re using for parsing pdfs — pypdf discards the headings and we end up in naive-ish land where we basically do paragraph packing but no bueno… (agh pdfs — another of my favorite companies making life more complicated than it should be)</p><h3>The 7-engine PDF shootout</h3><p>So the PDF issue bugs me, but when did extra benchmarks not solve things? Alrighty then so the setup is take the same synthetically made 17-page PDF that has 21 headings — both as bookmarks and font-size structure then compare it against 7 different approaches:</p><ul><li>pypdf — the current default: just extract the text, no structure, the “do nothing clever” baseline</li><li>pypdf_outline — same library, but also read the PDF’s own bookmarks and turn them back into headings</li><li>pdfplumber -pure-python layout analysis: look at the font sizes and guess that “bigger than body text = heading”</li><li>pymupdf- same font-size trick but via a C library (the one with licensing homework, more on that in a second)</li><li>pypdfium2 — literally Chrome’s PDF engine, same font-size trick</li><li>markitdown -Microsoft’s “convert anything to markdown” wrapper everyone keeps recommending…added so I can answer “why not just markitdown?” with a number instead of a shrug</li><li>tesseract OCR — the nuclear option: rasterize every page to an image and read it, which is what you’re left with when the PDF is a scan and has no text layer at all…</li></ul><p>And the results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tThKM6w0qk-rKw3Guva3Jg.png" /></figure><p>Unfortunately pymupdf is the winner, and I say unfortunately because it’s AGPL and basically no one will want that in their codebase unless it’s a completely open-source project. So that gives us the real shippable winner — pypdfium2 at 148 ms (5% of embedding time). One thing to point out is that pypdf_outline also does a great job …but not quite perfect. pdfplumber is also great but…meh around 2 seconds…that doubles our time per doc…so erm…maybe…but no. markitdown… nothing to say about this just that we’re not going for that route. And then the kicker — tesseract …man 17 seconds…pff…not in this setup. Maybe somewhere down the line it will have its place.</p><p>For now the default stays pypdf; part 3.5’s eval — where we finally measure whether heading paths actually improve retrieval at all — decides if pypdfium2 gets promoted..maybe sooner cause my gut is telling me I’m forgetting something. Ah, I just remembered that tables exist and those need special treatment to make sure you don’t get an underperforming RAG system. Man and you’d think parsing and chunking were easy. C’est la vie. Why am I so daunted by this? Well cause I have to test the above libraries again on proper data AND the naive/structured approach. And my gut feeling is that this leads down a small, but very useful, rabbit hole. Thanks to the magic of modern agentic engineering that wasn’t that big of a hassle actually and here are the results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eWywBTnhErjUVj0CLcn7ZA.png" /></figure><p>and for latency</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jRTjgvE8zbxNsam9l1kaaw.png" /></figure><p>Oke…so what did we do here? Ofc generate some synthetic data with 450 unique facts in table cells with 3 tables * 150 rows…in pdf, markdown, and html. And then we score fact co-location — does some chunk contain both the value and the column header?</p><p>Judging from the first figure we see that naive chunking destroys about 70% of the table facts when not in pdf — that’s because our pdf renderer repeats the header row on every page break so even table-blind text extraction keeps headers near values. Not really a good property — meaning not really a guarantee that this will work in practice. Top on that that pypdf and pypdfium2 do not have table finders like pdfplumber and pymupdf — which is why the latency on those last 2 libs is way way higher (the x axis on the latency figure is logarithmic). So the above figures aren’t really relevant ’cause they don’t help us pick a clear winner. Ideally we’d want smth that finds tables and is low latency, but life is all about tradeoffs. And now since we’re already here why don’t we add one more thing to mix — how we read the tables; what do I mean? Given a normal table you could parse a row in 2 ways either by grid so a row is just that:</p><p>region | q3 refund rate | tickets</p><p>EMEA | 4.2% | 120</p><p>APAC | 3.1% | 95</p><p>OR as pairs (every row carries its own labels):</p><p>region: EMEA; q3 refund rate: 4.2%; tickets: 120</p><p>region: APAC; q3 refund rate: 3.1%; tickets: 95</p><p>I honestly prefer the second one but it will cost us more chunks (it is a tradeoff I am willing to make for the sake of accuracy since tables matter a lot for enterprises). In terms of extra chunk cost that is about 50%-60% more chunks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZKTrfAXJr-OiOvbikBo8CQ.png" /></figure><p>Ok so if you’ve kept all the info till now in your personal cache you’ll come to the conclusion that, as expected, only pdfs are a real issue here. We either get bad table support but are blazingly fast (always wanted to be one of the cool kids and say that in an article) or…be slow. In reality we’ll get a mix of documents so the only sane approach is to go for the slow route when tables are present and the fast version when they aren’t.</p><p>So we designed this hybrid approach to route each page to the right tool.The trick is in how you detect tables cheaply: turns out table grids are literally drawn; think lines and rectangles, vector path objects and those are very different from prose pages that are just glyphs. It looks like pypdfium2 will count those table specific ‘objects’ so you get 0 on a text only page and 57–114 on every table page. Neat- I’m starting to see a bright future ahead for pypdfium2. Then that means our hybrid approach goes something like this: count the above objects and if they exceed a threshold pass that page to pdfplumber, if not we go with the fast option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IweuGnMsObNXxsxH0G-KgA.png" /></figure><p>Alrighty then — to summarize — for the ingest pipeline we will be using a structured chunking approach, that yields in theory better chunks, and when dealing with pdfs we will be using a hybrid approach (pypdfium2+pdfplumber) to make sure we hit tables, and tables will be parsed such that each row has the header data . A bit of experimenting to get to that phrase, and now in the next section we will actually see if it was worth it.</p><h3>Step 3 — being persistent</h3><p>Ok, documents can be parsed and embedded now….but then what? The pipeline does not have any memory. To work through step 3 — pls fork <a href="https://github.com/victormocioiu/rag-api">this</a> repo. For this section we’re gonna go with a crowd favorite to get memory, namely the ol’ faithful postgres. I really love postgres because we’ll use it for multiple things in this tutorial: search but also multi-tenancy that will come in the next part….well ok we’ll get some multi tenancy this part as well…just cause if you’ve read thus far would not want to leave you hanging.</p><p>So in edka, before you reach for the databases tab for installing postgres let’s do one small detour to add-ons. In add-ons search for local-path-storage-class addon and install it. This will enable us to use the nodepools NVME vs the hcloud volumes and that buys us higher IOPS and lower latency. Nice, now we can install postgres — so in its install screen for storage select local-path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5WooEKQrUqm26HvKQN6MYw.png" /></figure><p>Now in the extensions tab make sure to add vector and pg_textsearch — we need those for doing vector math and having BM25. Now go to placement and select the stores pool; next backup is up to you…if you’re doing this as a tutorial there’s really no need. If you want to go for prod — for goodness gracious why are we even talking about this — just do it! Cool. Click Create Postgres. With that out of the way we’re ready to deploy our rag-api — which for part 1 of the tutorial will sit after the rag-ingest part not in front of it. Why? Because the arrow points the other way than you’d think. rag-api is not a gateway that ingest hides behind…it’s the memory at the end of the pipeline. Documents flow upload → rag-ingest → rag-embedder → and then rag-ingest pushes the finished chunks-plus-vectors into rag-api, which is the only service in the whole platform allowed to touch Postgres. Ingest doesn’t know the schema exists. It just POSTs its results to an internal endpoint and stays as stateless as it was in step 2 — which means its failure modes stay boring, its image stays small, and when I inevitably break the database layer I only have one place to look. I got asked (by myself, at 11pm) whether rag-api also needs the ingest URL as an env var and the answer is a satisfying no…rag-api never calls ingest. Nothing calls ingest except you. One direction with no cycles, and the dependency graph stays a straight line so this can be debugged easily when a client starts shouting at 2AM your time.</p><p>The “in front” version of rag-api the thing that does auth, tenants with real API keys, quotas, chat is coming in part 2, and it’ll be this same service growing a public face. That’s the plan with the two hats: today it wears the internal one (persist + search for the pipeline), later it adds the front-door one (the thing your users actually talk to). Same repo, same database ownership, no re-architecture…we just haven’t earned the front door yet, because a front door with nothing behind it is a wall.</p><p>So: deployment form, same ritual as always. Select the rag-api repo, container port 8003 — and actually read what you type into that field, I fat-fingered 3002 and got the full everything-is-green-and-nothing-works experience, pod Running, migrations applied, TLS issued, URL dead…everything green plus connection refused equals port mismatch, tattoo it somewhere. 250m/1000m CPU, 256Mi/512Mi memory — the API itself is thin, the heavy lifting happens in Postgres and the embedder. Placement: the stores pool, so search sits on the same node as the database it hammers. Expose it through the tailnet, hand it the two env vars (DATABASE_URL from the connection secret section in the overview tab, EMBEDDER_URL for embedding your search queries — documents arrive already embedded), and by the time the pod reports Ready the migrations have self-applied and the schema exists. First boot of an empty brain…let’s teach it something.</p><p>I uploaded the one of the docs we used in step 2 which is an employee handbook through the normal /ingest endpoint, and it flows the whole way: parse, chunk, embed, and now persist. Then the moment of truth, the first search in the platform’s life:</p><p>“how long is the refund window for antarctic customers?”</p><p>Top hit: the Billing &gt; Refunds chunk, planted answer — 77 days — sitting right there, heading path attached. 23ms server-side: 21.7ms embedding the question, 1.7ms for Postgres to search both indexes. The table fact works too (“Atlantis refund rate” → 9.9%, retrieved with its header row repeated, because step 2 insisted on that and now we know why).</p><p>Both indexes? Right — search here is two queries and a sum. The vector arm embeds your question and asks HNSW for the nearest chunks by inner product. The lexical arm hands the raw question to the BM25 index, which ranks by term rarity so it knows “refund” matters and “the” doesn’t, because it has the whole corpus’s statistics to consult. Each arm returns its ranked list, and they’re fused with reciprocal-rank fusion: every chunk scores the sum of 1/(60+rank) across the lists it appears in. RRF is embarrassingly simple and that’s the appeal — no normalizing incomparable scores against each other, just ranks. One thing that we can tune that is the weight on the vector arm’s contribution, because the arms are not equally trustworthy and we’ll measure exactly how unequal later in this part.(BTW THIS IS SOMETHING THAT NO ONE TOLD ME YEARS AGO HYBRID DOES NOT HAVE TO MEAN 50/50). Maybe one more geeky detail: both arms run inside the same tenant transaction, so RLS scopes hybrid search for free. Multi-tenant isolation woop woop.</p><p>(And because I can’t resist a good idempotency flex: I uploaded the same handbook again. Same document_id back (Postgres, content hash), 3/3 embed cache hits (Valkey — 101.5ms → 1.3ms), persist no-op in 7.1ms. woop woop x2)</p><h3>Intermezzo — the schema: three tables, two search arms, and RLS with FORCE</h3><p>Cause I’m a geek, how did we design the tables in that postgres thingy?</p><p>I don’t think ORMs and migration frameworks are bad but sometimes raw dogging sql has a certain appeal. I get a rush when using just some numbered .sql files that are applied in order by a 40-line runner at startup, tracked in a schema_migrations table; the schema is the documentation. I will gladly die on this hill: for a schema this size, visible SQL beats generated SQL every single time someone has to debug it at 2am. We end up with three tables: tenants, documents, and chunks. Tenants is a lookup (slug, name,id), documents is bookkeeping (content_hash, filename, mime type…). Chunks is where the magic happens :</p><p>- embedding halfvec(384) — half-precision vectors, 768 bytes each. The “small model, small vectors” math from step 1 pays off again, storage-wise this time…2M chunks of OpenAI-sized vectors would be 12GB of floats, ours are 1.5GB — and yes we lose info compared to those but it is more than enough for enterprise.</p><p>- content text — the full chunk text lives in the row. Retrieval returns readable text because the database has readable text so we do not have to fetch the actual content from somewhere else (to be read as NO NEED for an extra hop.)</p><p>- content_tsv tsvector GENERATED ALWAYS AS (…) -Postgres maintains the lexical index itself on every insert. No sync job, no drift, no separate search cluster to babysit.</p><p>On top of that, three search structures for two search arms: an HNSW index (halfvec_ip_ops) for the vector arm — inner product ranks identically to cosine because every stored vector is unit-norm, which is why “norm 1.0” has been an invariant since the embedder’s first commit…this index is why. A BM25 index (pg_textsearch) for the lexical arm; the IDF-ranked search living inside Postgres. And the generated tsvector with its GIN index as the portable fallback for any Postgres that doesn’t have the extension (trying to be inclusive here — for no other reason than the fact that some people just love a certain specific version of postrees, yes, I know, geeks). Look at that….no elasticsearch needed.</p><p>And then the part that isn’t decorative: multi-tenancy via row level security, with FORCE. FORCE is the load-bearing word — without it, the table owner (exactly the role your app connects as) silently bypasses every written policy .Every query runs inside a transaction that does SET LOCAL app.tenant_id = …; the policies read it; no tenant context means zero rows. Fail-closed. Two war stories baked into that design, both earned: my first RLS test run had the isolation tests passing while proving nothing, because the tests connected as a superuser and superusers bypass RLS entirely, FORCE or no FORCE, if your isolation tests run as postgres, they test your ability to write green checkmarks. And the empty-string gotcha: a pooled connection doesn’t revert the tenant GUC to NULL after commit, it reverts to empty string, and ‘’::uuid isn’t a filter, it’s a cast error…hence the NULLIF(current_setting(…), ‘’) in every policy, mapping both flavors of “no tenant” to the same zero rows.</p><p>One more quiet decision: documents are idempotent on (tenant_id, content_hash). Re-uploading a file is a no-op that returns the existing id — the content hash ingest has been computing since its first day (because of this..sometimes I love recursion). Combined with the embed cache, uploading the same document twice costs you a hash lookup and some smugness.</p><p>Enough with the intermezzo let’s show the benchmarks.</p><h3>Benchmarks — HNSW is flat, and the database is not your bottleneck</h3><p>2000 synthetic documents of mixed sizes were generated and passed through the pipeline from an in-cluster client — pausing at corpus checkpoints (1K, 5K, 10K, 20K chunks) to measure search at each size. The seeding itself is a stat I enjoy: 19,990 chunks in 18.5 minutes end-to-end, ~18 chunks/s including persistence, which matches the embedder-bound token rate from step 2 exactly…the pipeline has one bottleneck and it’s still the model. Some things simply don’t change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*Ww-cZVrs1e6-VOI5_z8AQw.png" /></figure><p>The vector line is the entire argument for approximate nearest-neighbor indexes, measured: 2.7ms at 1K chunks, 3.2ms at 20K. The corpus grew 20×, the query time grew half a millisecond. HNSW is flat. That’s it, that’s the pitch.</p><p>The lexical fallback line (the plain-Postgres tsquery arm) tells a different story: 4ms → 71ms, climbing linearly. Now, an honest caveat that turns out to matter: this corpus is worst-case for lexical search by construction; my synthetic docs recycle the same twenty words, so every query term matches nearly every chunk, and Postgres has to rank all of them. Real vocabularies are selective. But the lesson generalizes: GIN finds candidates fast, ranking them is linear in how many there are.</p><p>I ran the same worst-case corpus against the BM25 arm expecting to gloat, and got 1.5 seconds. Worse than the fallback! BM25’s speed comes from Block-Max WAND pruning, which skips blocks of postings that can’t reach the top-k…but pruning needs score gaps, and twenty recycled words have none because every posting scores alike and nothing can be skipped. In my experience, every ranking strategy has a corpus that defeats it, and this one’s kryptonite is “no term is rarer than any other.” On real text the picture inverts hard, and we’ll measure that properly when the corpus gets serious later in this part. Spoiler: it gets serious.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CQ3yRGWijUV5ABbNVlhTaw.png" /></figure><p>Where does a search request actually spend its time? ~18ms embedding the query, ~3ms searching both indexes in Postgres. Read that again: the fastest component in this platform is now a Postgres ANN query over 20K vectors, and the bottleneck is — third part in a row — the model. The e5-small forward pass on two shared vCPUs costs six times more than the database does. I can already hear the people that were thinking — why not weaviate, qdrant, pinecone, etc — this is (partly) why — the database is NOT the slow part. Not at this scale and not for quite a while.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i7xO6vU-5PrN5NvZZJ9e7g.png" /></figure><p>Persistence is the boring chart, which is exactly what you want from this family of charts: linear at ~2.5ms per chunk plus ~7ms of transaction overhead and zero errors. We went for one transaction per document because a partially-persisted document is never visible to search.</p><p>And one war story from this session, because the benchmarks kept teaching lessons I’d already paid for once: mid-seeding, the embedder pod ballooned to 1.6GB. Step 1 established “batch size is a token budget, not a count” — we measured the batch-32 knee on 40-token texts, and ingest was now sending batches of 32 × 480-token chunks, six times the token load, and ORT’s memory arena grows to the largest batch it has ever seen and never, ever gives it back. Same lesson, new disguise. We went back and tuned EMBED_BATCH_SIZE=8 because 8 × 480 tokens hits the same tokens/s saturation point and it halved the pod’s memory for one env var: RSS 1.6GB → 811Mi with throughput identical. Units, man. Always the units.</p><h3>Step 3.5 — but is it right? The eval harness</h3><p>So above the intermezzo we got ONE query right and we celebrated…the rest is basically measuring speed. So we have to make sure that the correct chunks come back on a larger dataset. Also, I have a pile of open questions I’ve been carrying since step 2, each one a knob somebody on the internet has a strong opinion about: structural vs naive chunking, heading paths on or off, overlap, PDF engines, tables as grids or pairs, and which lexical arm earns its place. Opinions are free…let’s buy some answers instead.</p><p>The trick that makes this cheap is planted markers. Every fact in the eval corpus carries a unique token , i.e. qzmd4x1v, that kind of thing so a query counts as answered if a returned chunk contains its marker. That makes the ground truth configuration-agnostic: however you chunk the document, the marker lands in exactly one chunk. Basically — did the chunk with the token come back or not.</p><p>The corpus: 42 documents comprised of 20 markdown manuals, 6 with 30-row tables, 8 multilingual (de/fr/ro/es), 8 PDFs with font-size headings — and 104 queries across six classes: natural questions, keyword queries, table lookups, PDF facts, same-language, and cross-lingual. Every configuration gets its own tenant. Same corpus, ingested seven times with one knob flipped each, and RLS isolates the ablations from each other. The whole run, 7 configs × 42 docs plus 12 scoring passes × 104 queries, takes about six minutes against the live cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2xFTaAbR_W_MJBaN8Vl3JQ.png" /></figure><p>The headline surprised me: on recall, almost nothing matters. Every config lands at 0.92 — and that 0.92 is exactly 96/104, because the only misses anywhere are the 8 cross-lingual queries. Every English-answerable question gets answered by every configuration. Partly that’s the pipeline working; partly it’s an honest limit of the method — a unique planted token is exactly what BM25 is best at finding, so marker recall saturates almost by construction.</p><p>The discriminating signal moved somewhere subtler: ranking. The knobs stopped deciding whether you find the fact and started deciding where it ranks and this is very very very important because rank is what decides what your LLM actually reads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r_R0uDHp0jrki3IZ8TCDRg.png" /></figure><h3>The verdicts come out crisp:</h3><p>Read this way:</p><p>- Heading paths: the load-bearing knob. Drop the prepended crimson churn report &gt; Quarterly figures line and table questions crater from r@1 0.92 to 0.25. The dept token still gets found and BM25 matches it, but ranking it first needs the heading line to carry the words the question actually asks — “churn rate” appears nowhere in a chunk of | dept-velvet-21 | qztb1x21v | 68 | rows, so both arms lean on the prepended heading for it: the embedder for semantic surface, BM25 for the term statistics. With BM25 in the stack, heading paths stopped deciding whether you find the fact and started deciding where it ranks…and rank is what your LLM reads.</p><p>- Tables as pairs: the only config that goes perfect on tables (r@1 1.00). Row-as-sentence reads as prose to the embedder and clean term statistics to BM25; a pipe-delimited grid is soup to one and noise to the other.</p><p>- Structural vs naive chunking: a recall tie that isn’t a tie. Naive packs the corpus into 68 giant chunks and finds markers just as well…while returning 12% of its entire corpus per query and burning 3× the context budget to deliver the same fact. The metric can’t see context quality so don’t let a tie fool you.</p><p>- Overlap: noise-level here (the planted facts rarely straddle a boundary, which is exactly the case overlap protects). It costs ~6% tokens. Keep it, cheap insurance.</p><p>- PDF engines: tie on markers. BM25 finds a token in flat text just fine so this verdict rests on what step 2 measured directly: structure. pypdfium2 via the hybrid router, unchanged.</p><p>- The lexical arm: this is why BM25 is in the platform. For comparison I ran plain Postgres tsquery: 0.19 — natural questions score literally zero, because websearch_to_tsquery demands every word including “what” and “is” appear in one chunk. You can rescue it to 0.85 with a hand-rolled stopword-stripping hack. Or you can use a lexical arm with IDF that treats stopwords as cheap instead of mandatory: BM25 alone scores 0.923 with zero query preprocessing. The margin looks small on 42 documents… but hold that thought until the corpus gets serious.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VvhuHLB3wADDb81Yg8Tnxg.png" /></figure><p>And the thing the harness caught that I didn’t plant: cross-lingual retrieval fails. 0 for 8. Same-language is perfect — German questions find German chunks, all four languages — but an English question against a German document comes back empty in every single configuration. Lexical arms obviously can’t cross languages, and e5-small’s “multilingual” turns out to mean each language embeds well, not that the languages share a semantic space tight enough for 384-dim retrieval. If cross-lingual matters to you: translate at ingest or query time (or I suggest going for something like <a href="https://huggingface.co/jinaai/jina-embeddings-v3">jina3</a> embeddings). Don’t expect the embedder to do it</p><p>So…here is what the eval says, in small words. The search finds the answer for almost every english question, in every configuration…the pipeline delivers. what the knobs decide is not if the fact comes back but rather what comes back FIRST, and first place is what your llm actually reads. The heading line we glue on top of each chunk is the thing that does that work and it boosts the table questions from 25% at first place to 92%;. The lexical arm is simply great because plain postgres text search found NOTHING for natural questions but in turn BM25 knows which words are rare and which are filler so you get 92% out of the box. Finally the bad result: the model cannot match an english question to a german document…same language works perfectly, cross language is zero for eight. so the win is not the embedder…the win is the boring glue around it so the headings, the table shapes, the ranking math. structure in, relevance out.</p><p>And now the cherry on top- finally part 1 of this series is coming to an end. We will partly benchmark the pipeline on a <a href="https://github.com/onyx-dot-app/EnterpriseRAG-Bench">public</a> dataset. The full benchmark results come out in the second part. But without further ado…</p><h3>Step4 — The final boss: 512K ‘enterprise’ documents</h3><p>Time to stop grading my own homework. Onyx’s EnterpriseRAG-Bench is a public benchmark built exactly for this: 512K documents simulating a company’s internals with 285K Slack threads, 121K email threads, and the long tail of Jira, Confluence, Drive, HubSpot, meeting transcripts — plus 500 questions across ten categories, from single-doc lookups to multi-document aggregation. MIT licensed, real leaderboard, populated by AWS, Azure, Google, and OpenAI offerings. My €116/month cluster is going in. First of all gotta mention that in this part we will only compete on the column of document recall.</p><p>Before running anything, the prediction — written down first, so I can be wrong in public:</p><p>e5-small is a 118M-parameter model that costs nothing and runs on 2 shared vCPUs. the leaderboard has systems with frontier embedders, rerankers, and agentic retrieval loops. we will not win. the claim was never “we win”…the claim is performance-per-euro: how much of a 512K-document enterprise corpus can a €116/month hetzner cluster actually answer? my guess: document recall somewhere in 0.5–0.7 overall, strong on the single-document questions, weak on multi-doc aggregation. If we land above 0.7 I’ll be delighted and suspicious, in that order.</p><p>The ingest itself became an ops story I’ll keep short, because the numbers do the talking. Full corpus is ~2.5GB of text so about ~740M tokens, which at the embedder’s known rate meant ~28 hours on the 2-vCPU embed node. Instead: Hetzner bills hourly, so I added a temporary 16-vCPU CPX62 pool for about €0.10/h, flipped the embedder to 6 replicas and ingest to 2 in edka’s placement tab, and ran the loader overnight from my laptop over the tailnet at ~26–31k tokens/s. The loader keeps a resume ledger and the platform’s content-hash idempotency makes restarts free that got tested, involuntarily, several times (let’s go out for a beer and I’ll tell that story as well). Postgres swallowed 1.98M chunks with zero persist errors while the HNSW and BM25 indexes kept pace with inserts. Total burst-node bill: about €2.</p><p>A 512K-document corpus is also the first ‘real real’ data I’ve ever run against the platform, and it found real bugs before scoring a single question. I’ll spare you most of the list, but my favorite: the embedder’s request batcher enforced a token budget per client request (step 1’s hard-won lesson) and then merrily reassembled small requests into giant flushes internally. The lesson had been learned at one layer and not the one below it. All six replicas crash-looping at 3am, fixed by teaching the batcher the same arithmetic. There’s something clarifying about a benchmark that stress-tests your platform before it grades your retrieval.</p><p>Then the 500 questions, at the platform config — hybrid, BM25 arm, vector weight 0.3, top-10 documents, ~270ms per question:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2d9dCsY8ZaiAdHCmJ4hJAw.png" /></figure><p>Document Recall: 0.662. Inside my predicted band, and the shape matches too: single-doc lookups strong (basic 0.75, intra-document reasoning 0.93, constrained 0.85), multi-document aggregation weak (project-related 0.53, completeness 0.44 — when the answer needs ten documents, a top-10 window has no room for error). Right in public, for once…I’m framing this one.</p><p>The category worth dwelling on is semantic: 0.416 — questions deliberately written with low keyword overlap, aimed straight at the embedder. I dug into the failures and the diagnosis is precise: for one failed question, the gold chunk sits at vector rank 15,698 of 1.98M. Top 1% by similarity — nowhere near top-50. This unfortunately is not an index-tuning problem (cranking HNSW’s ef_search 10× doesn’t surface it — verified) — it’s geometry. 384 dimensions cannot keep half a million near-synonymous engineering documents apart. The vector arm alone scores 0.219 on this benchmark. That “more than enough for enterprise” energy from the schema section? This is where it goes to die, with a rank number on its grave. (If I were to redo the whole thing again I would probably go for beefier infra for the embedder and a better embedder such as multilingual-e5-large — my approximations tell me that it would still be around 3–5 euros to ingest all the data and embedding latency for querying would go to about 100ms on the 2 cpu node)</p><p>So remember back when I was caps-screaming and said that hybrid does not have to be 50–50? Well…we started with that and compared to just lexical and got 0.616 for hybrid and 0.654 for BM25. Weird no…but the question is if there exist a ratio that improves that 0.65..turns out it does and that is 100% lexical and 30% vector and that improves the score to 0.662 — so an extra 0.008. You’ d think it ain’t much (but it’s honest work..sorry just had to), but the vector arm contributes in the areas where BM25 has a hard time; the project -related question jump up 5 points, intra-document reasoning +2.5 and constrained +2 because the embedder surfaces docs that are not related to term statistics.</p><p>And where we land, on the leaderboard’s Document Recall column:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatawrapper.dwcdn.net%2FQpTy5%2F1%2F&amp;display_name=Datawrapper&amp;url=https%3A%2F%2Fdatawrapper.dwcdn.net%2FQpTy5%2F1%2F&amp;image=https%3A%2F%2Fdatawrapper.dwcdn.net%2FQpTy5%2Fplain-s.png%3Fv%3D1&amp;type=text%2Fhtml&amp;schema=dwcdn" width="600" height="702" frameborder="0" scrolling="no"><a href="https://medium.com/media/5843120fd1b4e8801b95799ea5f4c429/href">https://medium.com/media/5843120fd1b4e8801b95799ea5f4c429/href</a></iframe><p>Above Azure AI Search, Vertex AI Search, RAGFlow, and Weaviate. Four-ish points behind Amazon Kendra. Double the LlamaIndex and LangChain defaults.</p><p>On Postgres, a 118M-parameter embedder, and €116 a month — plus €2 of weekend burst rental I’d say that’s pretty darn good.(And if your zone has cost-optimized instances, the same stack is €33 — lower latency but same place on the ladderboard.)</p><p>The honest asterisks, all of them: the leaderboard ranks by Overall Score, which is two-thirds LLM-judged answer quality and for that we need a generation layer that we don’t have yet, so read this as a column placement, not a ranking claim — still proud though. Our number is self-measured set math, not their judge-with-corrections protocol (our answers file is in their submission format, waiting). And our always-return-10 habit costs ~9 “invalid extra docs” per question. This is a precision problem with a known fix: the measured reranker ceiling says gold sits within the top-200 candidates for 64% of questions, so a small cross-encoder re-ranking that window is the single biggest upgrade available. That’s part 2’s opening move — generation layer, official judge run, leaderboard submission, and a reranker with its ceiling already measured.</p><p>Quick recap of what you now own: a hybrid RAG pipeline — INT8 embedder, structure-aware chunking, Postgres doing vector <em>and</em> BM25 with tenant isolation the database enforces — that holds its own on a public enterprise benchmark against systems from companies with slightly bigger infra budgets than €116/month. And if you followed along, you got there without really knowing the ins and outs of kubernetes.</p><p>That last part is the bit I’d like to highlight (because it is both true and…shameless self promotion). I remember the days when a solo-dev could only hope to have infra done this easily — it was either spend a shit ton of time NOT doing the actual job, or cram everything into a brittle VPS. LLMs have alleviated some of that pain, but you can still shoot yourself in the foot quite easily. I think we’ve solved this problem quite nicely on<a href="https://edka.io/"> edka.io</a> — the free tier covers everything in this tutorial.</p><p><strong>Part 2 is where it gets a public face</strong>: the generation layer, auth and full multi-tenancy, the reranker (ceiling already measured: gold sits in the top-200 for 64% of questions), the official judge run, and the leaderboard submission. If you want it when it drops: I’ll post it on X <a href="https://x.com/vmocioiu">— <strong>@vmocioiu</strong></a>. Until then — star the repo if this saved you some benchmarking, and if you find a mistake in mine, you know where to find me.</p><p>Thank you for coming to my Ted talk.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=deede53d461d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your Sellers Don’t Have Time to Watch That Video. What If They Didn’t Have To?]]></title>
            <link>https://medium.com/showpad-engineering/your-sellers-dont-have-time-to-watch-that-video-what-if-they-didn-t-have-to-bf93a6f2acae?source=rss-d67d706e5008------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf93a6f2acae</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[showpad]]></category>
            <dc:creator><![CDATA[Victor Mocioiu]]></dc:creator>
            <pubDate>Tue, 24 Feb 2026 13:56:20 GMT</pubDate>
            <atom:updated>2026-02-25T10:30:08.462Z</atom:updated>
            <content:encoded><![CDATA[<h3><em>How we went from idea to working prototype in a day — building an AI-powered video intelligence tool that turns recordings into direct actionable knowledge.</em></h3><h3>The Problem Nobody Talks About</h3><p>Sales organizations produce an enormous amount of video content: recorded demos, customer calls, pitch rehearsals, competitive intel briefings, product walkthroughs, onboarding sessions. The intention is always the same — make sellers sharper. The reality is almost always the opposite.</p><p>A 45-minute product training sits in the platform. A rep needs the three key differentiators mentioned at minute 32, but they don’t know that. So they either scrub through the whole thing (unlikely when they have pipeline to build), or they skip it entirely. The content exists. The knowledge doesn’t transfer.</p><p>This isn’t a content creation problem. It’s a content <em>consumption</em> problem. And it gets worse as organizations scale — more products, more verticals, more competitive dynamics, more content that nobody has time to absorb.</p><p>The content already lives in Showpad. Sellers are used to going there before a call. But where the video is stored isn’t the problem we’re trying to solve.</p><p>The real question is: how do we make sure sellers can access and apply the right insight at the right moment, no matter where the content lives? How do we equip them to walk into every conversation sharper, more confident, and better prepared than anyone else in the room?</p><h3>What This Looks Like for Sellers</h3><p>What would a seller actually <em>do</em> with this? Turns out, quite a lot.</p><p><strong>Ramp time drops.</strong> New sellers don’t need to sit through hours of recordings. They get structured summaries of what each video covers, organized by topic, with the most important facts surfaced automatically. They still watch the parts that matter — they just know which parts those are.</p><p><strong>Preparation gets surgical.</strong> A rep about to walk into a competitive deal can upload the latest CI briefing, get the three highlights, and jump to the exact 90-second segment that covers the competitor’s weakness. That’s the difference between “I think they’re weak on integrations” and citing the specific example from the briefing.</p><p><strong>Coaching becomes reviewable.</strong> Managers can process recorded sales calls and immediately see the topical breakdown: discovery, objection handling, pricing discussion, next steps. The section summaries tell you whether the rep covered the right ground. The highlights catch the moments worth replaying.</p><p><strong>Institutional knowledge compounds.</strong> Every video that gets analyzed produces structured, timestamped metadata. Combined with the transcripts and search capabilities already in Showpad, this turns a library of video content into something closer to a queryable knowledge base — and the more content that flows through, the more valuable it becomes.</p><p>None of this requires sellers to change their behavior. They upload a video, wait a few minutes, and get an interactive breakdown. The tool does the work.</p><h3>How It Works</h3><p>The system runs a multi-stage pipeline behind the scenes. A video goes in; structured, navigable output comes back.</p><h3>The Pipeline</h3><p>Each stage in this pipeline is deliberately implementation-agnostic. The STT service, the foundation model, the orchestration layer — any of these can be swapped for a different vendor or a newer state-of-the-art model without touching the rest of the system. That modularity is a design choice, not an accident. The AI landscape moves fast; the architecture shouldn’t lock us into whatever is best today when something better ships next quarter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*arEAJJXGdQ11F4MTV8HxiQ.png" /></figure><p>The video file’s audio track is demuxed and re-encoded into a normalized format optimized for downstream transcription accuracy: single-channel, 16kHz sample rate, lossless encoding. This normalization step is critical because source videos arrive in wildly inconsistent states — variable bitrates, stereo tracks with one dead channel, compressed codecs that introduce artifacts at speech-relevant frequencies. By standardizing the audio before it hits the transcription model, we eliminate an entire class of accuracy failures at the cheapest possible point in the pipeline. The operation is deterministic and fast — typically under a few seconds regardless of video length.</p><p><strong>Stage 2: Transcription</strong></p><p>The normalized audio is passed to a speech-to-text model that produces word-level timestamped segments. Each segment is returned as a (start, end, text) tuple with sub-second precision. A model that gives you paragraph-level timestamps produces output that’s unusable for interactive navigation. Out current STT model runs behind a service interface, so swapping it for a faster or more accurate alternative is a configuration change.</p><p><strong>Stage 3: Analysis Orchestration</strong></p><p><em>Stage 3.1 Prompt Construction</em></p><p>The analysis orchestrator takes the formatted transcript and constructs a structured prompt for the foundation model. The prompt engineering specifies the exact output schema (sections with titles, start/end timestamps, and summaries; highlights with facts, timestamps, section associations, and rank), provides formatting constraints, and includes guardrails against common failure modes — over-segmentation, hallucinated timestamps, highlights that restate the summary rather than surfacing genuinely notable moments. The prompt also encodes domain awareness: it knows what “good” sections look like for spoken content (not too granular, not too broad — a 30-minute video should produce 4–7 sections, not 47), and it distinguishes between a highlight that’s genuinely surprising and one that’s just a topic header rephrased as a fact.</p><p><em>Stage 3.2 Structured Response &amp; Validation</em></p><p>The foundation model returns a single JSON response containing the complete analysis — every section and every highlight, fully formed, in one pass. That payload is immediately validated against a strict schema: correct field types, timestamps that fall within the video’s actual duration, section boundaries that don’t overlap or leave gaps, highlights that reference sections that actually exist. If validation fails on any constraint, the response is rejected and the call is retried with the same prompt. This binary pass/fail approach — rather than trying to patch or repair malformed output — keeps failure modes simple and debuggable. When it works, you know it works completely. When it doesn’t, we know exactly why.</p><p><strong>Stage 4: Storage</strong></p><p>The storage layer is intentionally simple. The analysis output — the full JSON payload containing sections, highlights, and metadata — is written to S3 under a deterministic path structure keyed by video identifier. No database, no query engine, no additional infrastructure to operate. The JSON goes in, and any service that knows the video ID can retrieve it.</p><p>Alongside the JSON, we persist the transcript as a WebVTT file. VTT is the W3C standard for time-aligned text tracks — the same format browsers natively understand for captions, subtitles, and chapter markers via the HTML5 &lt;track&gt; element. It’s a plain-text format where each cue carries a start time, end time, and text payload, which maps directly to what our transcription stage produces. Persisting the transcript as VTT rather than (or in addition to) a proprietary format means any standards-compliant video player can consume it without transformation. That’s a deliberate choice: the output of the pipeline shouldn’t require knowledge of the pipeline to be useful.</p><p>The path structure in S3 is flat and predictable — video ID, output type, done. There’s no clever partitioning scheme because there doesn’t need to be. The access pattern is simple: given a video, retrieve its analysis. Sometimes the right architectural decision is recognizing that the boring option is also the correct one.</p><p><strong>Stage 5: Consuming the Output</strong></p><p>The analysis produces two complementary artifacts, each suited to different integration patterns.</p><ul><li>JSON payload carries the full structured analysis — sections with titles, time ranges, and summaries; highlights with facts, timestamps, section associations, and importance rankings. It’s the format you reach for when building interactive experiences, feeding data into search indices, or integrating with other platform services that need to reason about video content programmatically.</li><li>VTT file carries the time-aligned transcript in a format that every major video player already speaks. Drop it into an HTML5 &lt;track&gt; element and you get native caption rendering with no additional code. Use the chapters track kind, and players that support it will surface navigable chapter markers automatically. The format is lightweight, well-documented, and supported across browsers, native apps, and streaming infrastructure alike.</li></ul><p>Between the two, the range of possible integrations is broad. We intentionally stop short of prescribing how these artifacts should be consumed. The pipeline’s responsibility is to produce accurate, well-structured, standards-compliant output and make it available at a predictable location. How that output gets surfaced to sellers is a product decision best made by the teams closest to the user experience. Our role is to ensure that when those teams reach for the data, it’s already in a shape they can work with immediately, without needing to understand or depend on the internals of how it was produced.</p><h3>Wiring it together</h3><p>Here’s the part that surprised us: it mostly just worked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L-c3q-a0rexlgUrqBA9z2g.png" /></figure><p>We did build a lightweight UI to inspect the output because trusting AI-generated structure without human verification is how you ship confidently wrong results. The UI let us play back videos with the section and highlight overlays visible, click through the timeline, and spot-check whether the analysis matched the content. It’s the kind of thing that takes an afternoon to wire up and pays for itself immediately: you stop guessing about quality and start seeing it.</p><p>What we saw was that the quality was strong enough to validate the approach on real content, across different video types — product walkthroughs, competitive briefings, recorded calls. The pipeline didn’t need heroic prompt engineering or multi-pass orchestration to produce useful output. It needed clean architecture, clear constraints, and a simple way to verify the results.</p><p>That verification step matters more than it might seem. Building the POC fast wasn’t just about speed — it was about closing the loop between “we think this works” and “we can see that this works” within the same day. The faster you get a working system producing real output from real content, the faster you move from hypothesis to evidence.</p><h3>What the POC Told Us</h3><p>The point of moving fast wasn’t to ship something rough. It was to answer specific questions that no amount of planning could resolve.</p><p><strong>Can a single LLM call produce useful structure from raw speech?</strong> For the content we tested — product demos, training recordings, competitive briefings, typically ranging from 10 to 45 minutes — yes. One well-crafted prompt, one structured response, validated against a schema. The sections mapped to how a human would mentally divide the content. The highlights genuinely surfaced notable moments rather than restating summaries. This won’t hold universally — longer-form content, multi-speaker panels, or heavily unstructured conversations will likely push the limits of a single-pass approach. But for the use cases we were targeting, the simplicity of one call kept latency manageable, costs predictable, and the failure surface small.</p><p><strong>Does interactive navigation add real value over a flat summary?</strong> Early prototyping confirmed that the moment a seller can click a highlight and land on the exact point in the video, the experience shifts qualitatively. You stop watching the video and start navigating it. That distinction matters when someone has three minutes before a call. A flat list of bullet points would have been marginally useful. Structured, timestamped, clickable output changes the behavior.</p><p><strong>Does the speed of building actually matter, or is it just a nice story?</strong> It matters because confidence comes from seeing rather than just planning. We could have spent a week designing the prompt, debating section granularity, and speculating about highlight quality. Instead, we had real output from real videos by the afternoon — and the verification UI to confirm that the output held up. The architecture that made that possible — simple stages, clean interfaces, a straightforward prompt against well-structured input — was the real deliverable. And it was also fun as hell :D</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf93a6f2acae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/showpad-engineering/your-sellers-dont-have-time-to-watch-that-video-what-if-they-didn-t-have-to-bf93a6f2acae">Your Sellers Don’t Have Time to Watch That Video. What If They Didn’t Have To?</a> was originally published in <a href="https://medium.com/showpad-engineering">Product &amp; Engineering at Showpad</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>