<?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 Carlos Martínez on Medium]]></title>
        <description><![CDATA[Stories by Carlos Martínez on Medium]]></description>
        <link>https://medium.com/@CarlosMartes?source=rss-08dd210e921f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*1Z1Rq-0l75F-RZGBWI2SVw.png</url>
            <title>Stories by Carlos Martínez on Medium</title>
            <link>https://medium.com/@CarlosMartes?source=rss-08dd210e921f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:12:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@CarlosMartes/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[Beyond Naive RAG: Build Smarter Systems with Query Routing and Hybrid Retrieval]]></title>
            <link>https://blog.gopenai.com/beyond-naive-rag-build-smarter-systems-with-query-routing-and-hybrid-retrieval-1ab37ad3dc78?source=rss-08dd210e921f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ab37ad3dc78</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[rags]]></category>
            <dc:creator><![CDATA[Carlos Martínez]]></dc:creator>
            <pubDate>Fri, 04 Sep 2026 20:36:00 GMT</pubDate>
            <atom:updated>2026-09-04T20:36:00.852Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*--9RElxpI43vW0lFJ0SoXA.png" /></figure><p>The first time I saw “retrieval failed” logs spike at 2 a.m., the problem looked like a <a href="https://zilliz.com/learn/vector-similarity-search?utm_campaign=mediumkoc">vector search</a> issue — embeddings out of sync, maybe a bad model update. It wasn’t. The real issue was that we were running the same dense-<a href="https://zilliz.com/learn/vector-similarity-search?utm_campaign=mediumkoc">vector similarity search</a> on every query, whether it was “What’s the Q3 revenue for LightOn?” or “What is 2 + 2?” The pipeline couldn’t tell the difference, so it retrieved documents for trivial queries and burned through compute, while complex queries with synonyms or mixed terminology got back irrelevant chunks because pure <a href="https://zilliz.com/glossary/semantic-search?utm_campaign=mediumkoc">semantic search</a> couldn’t handle exact keyword matches.</p><p>That’s naive <a href="https://zilliz.com/learn/Retrieval-Augmented-Generation?utm_campaign=mediumkoc">RAG</a>: a fixed pipeline that treats every query identically. You embed the question, run a <a href="https://zilliz.com/learn/vector-similarity-search?utm_campaign=mediumkoc">similarity search</a>, grab top-K results, and generate an answer. No routing, no fallback, no way to know which stage broke when results are bad. Modern RAG systems work differently — they decide <em>whether</em> to retrieve, <em>what</em> to search for, and <em>how</em> to search before touching the database. This article walks through a four-node architecture that routes queries intelligently, explains how to run hybrid retrieval without maintaining two separate indexes, and shows how to evaluate each pipeline stage so you can actually debug failures instead of guessing.</p><h3>Why “just use long context” doesn’t work in production</h3><p>When models started supporting 128K-token windows, the immediate reaction was “why bother with retrieval?” Just stuff the entire knowledge base into the prompt. I’ve seen teams try this. It falls apart for two reasons that aren’t obvious until you’re paying the bill.</p><p><strong>Cost scales with your corpus, not your query.</strong> Every request sends the full knowledge base through the model. If your corpus is 100K tokens, that’s 100K input tokens per request — even when the answer needs one paragraph. Monthly inference costs grow linearly with corpus size, and caching doesn’t help much when queries vary.</p><p><strong>Attention degrades with length.</strong> Models lose focus on relevant information buried in long contexts. The “lost in the middle” effect shows that models are more likely to miss information placed in the middle of long inputs. Larger context windows haven’t solved this — attention quality hasn’t kept pace with window size. RAG avoids both problems by retrieving only the relevant passages before generation. The question isn’t whether RAG is needed; it’s how to build RAG that actually works.</p><h3>The four-node architecture: routing before retrieval</h3><p>Instead of a fixed pipeline, a modern RAG system routes each query through four decision nodes. Each node answers one question about how to handle the current query.</p><p><strong>Node 1: Query Routing — Does this query need retrieval?</strong> The first decision classifies the incoming query and sends it down the appropriate path. Common-sense questions like “What is 2 + 2?” go directly to the <a href="https://zilliz.com/glossary/large-language-models-(llms)?utm_campaign=mediumkoc">LLM</a> — no retrieval. Knowledge-base questions like “What are the specs for Model X?” route to the retrieval pipeline. Real-time information requests like “Weather in Paris this weekend” call an external API. Routing upfront avoids unnecessary retrieval for queries that don’t need it. In systems where a large share of queries are simple or general-knowledge, this alone can cut compute costs significantly.</p><p><strong>Node 2: Query Rewriting — What should the system search for?</strong> User queries are often vague. A question like “the main numbers in LightOn’s Q3 report” doesn’t translate well into a search query. Query rewriting transforms the original question into structured search conditions: time range (July 1–September 30, 2025), document type (financial report), entity (LightOn, Finance department). This step bridges the gap between how users ask questions and how retrieval systems index documents.</p><p><strong>Node 3: Retrieval Strategy Selection — How should the system search?</strong> Different content types need different retrieval strategies. Code with variable names and function signatures works best with lexical search (BM25) — exact keyword matching on structured tokens. Natural language documents need semantic search (dense vectors) to handle synonyms and paraphrases. Multimodal content like charts and diagrams requires multimodal retrieval to capture visual structure that text extraction misses. Documents are tagged with metadata at indexing time. At query time, these tags guide both which documents to search and which retrieval method to use.</p><p><strong>Node 4: Minimal-Context Generation — How much context does the model need?</strong> After retrieval and reranking, the system sends only the most relevant passages to the model — not entire documents. Compared with full-document loading, passing only the relevant passages can reduce token usage by over 90%. Lower token counts mean faster responses and lower costs, even when caching is in play.</p><h3>Why hybrid retrieval is harder than it looks</h3><p>In practice, Node 3 (retrieval strategy selection) is where most teams get stuck. No single retrieval method covers all enterprise document types. Some argue that keyword search is sufficient — after all, Claude Code’s grep-based code search works well. But code is highly structured, with consistent naming conventions. Enterprise documents are a different story.</p><p><strong>Enterprise documents are messy.</strong> Synonyms and varied phrasing mean “optimize memory usage” and “reduce memory footprint” use different words but mean the same thing. Keyword search matches one and misses the other. In multilingual environments — Chinese with word segmentation, Japanese with mixed scripts, German with compound words — the problem multiplies. Visual structure matters too: engineering drawings depend on layout, financial reports rely on tables, medical images depend on spatial relationships. OCR extracts text but loses structure. Text-only retrieval can’t handle these documents reliably.</p><p>Hybrid retrieval combines multiple search methods — typically BM25 for keyword matching and dense vectors for semantic search — to cover what neither method handles alone. The traditional approach runs two separate systems: one for BM25, one for vector search. Each query hits both, and results are merged afterward. It works, but it comes with real overhead: two separate indexes to store, two systems to keep in sync, two queries plus result merging on every request, and tuning merge weights across systems.</p><p><a href="https://milvus.io/?utm_campaign=mediumkoc">Milvus</a> 2.6 supports both dense vectors (for semantic search) and sparse vectors (for BM25-style keyword search) in the same collection. A single API call returns fused results, with retrieval behavior adjustable by changing the weight between vector types. No separate indexes, no sync issues, no merge latency.</p><pre>from pymilvus import MilvusClient, DataType<br><br># Define schema with both dense and sparse vectors<br>schema = client.create_schema()<br>schema.add_field(&quot;id&quot;, DataType.INT64, is_primary=True)<br>schema.add_field(&quot;text&quot;, DataType.VARCHAR, max_length=1000)<br>schema.add_field(&quot;dense_vec&quot;, DataType.FLOAT_VECTOR, dim=768)<br>schema.add_field(&quot;sparse_vec&quot;, DataType.SPARSE_FLOAT_VECTOR)<br><br># Single query with adjustable fusion weights<br>results = client.hybrid_search(<br>    collection_name=&quot;docs&quot;,<br>    data=[dense_query, sparse_query],<br>    anns_field=[&quot;dense_vec&quot;, &quot;sparse_vec&quot;],<br>    limit=10,<br>    rerank=RRFRanker()<br>)</pre><p>The real win here isn’t just convenience — it’s operational simplicity. One collection, one write path, one query API. When retrieval quality drops, you’re debugging one system, not tracking down sync lag between two.</p><h3>How to evaluate each stage independently</h3><p>Checking only the final answer isn’t enough. RAG is a multi-stage pipeline, and a failure at any stage propagates downstream. If you only measure answer quality, you can’t tell whether the problem is in routing, rewriting, retrieval, reranking, or generation.</p><p>When users report “inaccurate results,” the root cause could be anywhere: routing may skip retrieval when it shouldn’t; query rewriting may drop key entities; retrieval may miss relevant documents; reranking may bury good results; or the model may ignore the retrieved context entirely.</p><p>I learned this the hard way after spending two days tuning reranking weights, only to discover that the retrieval stage was already missing the relevant documents. Reranking can’t fix what retrieval didn’t fetch.</p><p><strong>Evaluate each stage with its own metrics.</strong> Use F1 score for routing accuracy — high false-negative rate means queries needing retrieval are skipped. Use entity extraction accuracy and synonym coverage for query rewriting — rewritten queries that drop important terms or change intent break downstream stages. Use Recall@K and NDCG@10 for retrieval quality — relevant documents that aren’t retrieved or are ranked too low won’t make it to the model. Use Precision@3 for reranking — top results that aren’t actually relevant waste context budget. Use faithfulness and answer completeness for generation — models that ignore retrieved context or give partial answers fail the final step.</p><pre># Per-stage evaluation setup<br>def evaluate_routing(test_queries):<br>    predictions = [router.classify(q) for q in test_queries]<br>    labels = [q.expected_route for q in test_queries]<br>    return f1_score(labels, predictions)<br>def evaluate_retrieval(test_queries, k=10):<br>    results = []<br>    for q in test_queries:<br>        retrieved = retriever.search(q.text, limit=k)<br>        relevant = set(q.relevant_doc_ids)<br>        recall = len(set(retrieved) &amp; relevant) / len(relevant)<br>        results.append(recall)<br>    return sum(results) / len(results)</pre><p>Set up layered monitoring. Use offline test sets to define baseline metric ranges for each stage. In production, trigger alerts when any stage drops below its baseline. This lets you catch regressions early and trace them to a specific stage — instead of guessing.</p><h3>Implementing query routing in practice</h3><p>Query routing is the first decision point and often the easiest to implement. A simple classifier can distinguish between queries that need retrieval and those that don’t. For production systems, I’ve found that a lightweight model trained on a few hundred labeled examples works well enough to start.</p><pre>from transformers import pipeline<br><br># Initialize routing classifier<br>router = pipeline(<br>    &quot;text-classification&quot;,<br>    model=&quot;distilbert-base-uncased-finetuned&quot;<br>)<br><br>def route_query(query):<br>    result = router(query)[0]<br>    if result[&#39;label&#39;] == &#39;GENERAL&#39;:<br>        return llm.generate(query)<br>    elif result[&#39;label&#39;] == &#39;KNOWLEDGE&#39;:<br>        return retrieval_pipeline(query)<br>    elif result[&#39;label&#39;] == &#39;REALTIME&#39;:<br>        return api_call(query)</pre><p>The routing model doesn’t need to be perfect. Even 80% accuracy delivers measurable savings because the cost of a false positive (unnecessary retrieval) is much lower than running retrieval on every query. Start with a simple three-class classifier: general knowledge, knowledge-base, and real-time. Refine the categories as you collect production data.</p><h3>What I’d build first</h3><p>Three priorities stand out from real-world RAG deployments:</p><p><strong>Add routing early.</strong> Many queries don’t need retrieval at all. Filtering them upfront reduces load and improves response time with minimal engineering effort. I’ve seen routing cut unnecessary retrieval calls by 30–40% in systems with a mix of simple and complex queries.</p><p><strong>Use unified hybrid retrieval.</strong> Maintaining separate BM25 and vector search systems doubles storage costs, creates sync complexity, and adds merge latency. A unified system like Milvus 2.6 — where dense and sparse vectors live in the same collection — eliminates these issues. The operational simplicity alone is worth it.</p><p><strong>Evaluate each stage independently.</strong> End-to-end answer quality alone is not a useful signal. Per-stage metrics (F1 for routing, Recall@K and NDCG for retrieval) let you debug faster and avoid breaking one stage while tuning another. When I added per-stage monitoring, time-to-diagnosis for retrieval issues dropped from hours to minutes.</p><p>The real value of a modern RAG system isn’t just retrieval — it’s knowing <em>when</em> to retrieve and <em>how</em> to retrieve. Start with routing and unified hybrid search, and you’ll have a foundation that scales without doubling your infrastructure complexity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ab37ad3dc78" width="1" height="1" alt=""><hr><p><a href="https://blog.gopenai.com/beyond-naive-rag-build-smarter-systems-with-query-routing-and-hybrid-retrieval-1ab37ad3dc78">Beyond Naive RAG: Build Smarter Systems with Query Routing and Hybrid Retrieval</a> was originally published in <a href="https://blog.gopenai.com/">GoPenAI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[External Collection: Index and Retrieve Lake-Resident Data Without Moving It]]></title>
            <link>https://medium.com/@CarlosMartes/external-collection-index-and-retrieve-lake-resident-data-without-moving-it-0386609868a0?source=rss-08dd210e921f------2</link>
            <guid isPermaLink="false">https://medium.com/p/0386609868a0</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[data-lake]]></category>
            <dc:creator><![CDATA[Carlos Martínez]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 04:01:13 GMT</pubDate>
            <atom:updated>2026-08-31T04:01:13.628Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YFTfuXn_ENNJ3JxMoJ44UQ.png" /></figure><p>I’ve been in the trenches long enough to know that every “new” feature comes with a hidden cost, usually paid in alerts at 3 AM. So, when the team started talking about “External Collections” for our <a href="https://zilliz.com/learn/what-is-vector-database?utm_campaign=mediumkoc">vector database</a>, my first thought wasn’t “innovation,” it was “another synchronization pipeline to babysit.” We’ve been running a production product catalog search for years, and the current setup, while functional, is a constant source of friction.</p><p>Our product attributes and multimodal embeddings live in Parquet files on S3. This is our source of truth, updated by various ETL jobs, and consumed by Spark for analysis and training. For low-latency search, we’ve always had to copy this data into a vector database. This means a dedicated pipeline: extract from S3, transform, load into the vector database, and then monitor the whole thing. Every time the <a href="https://zilliz.com/blog/choosing-the-right-embedding-model-for-your-data?utm_campaign=mediumkoc">embedding model</a> changes, or a field is backfilled, or even just a new batch of products arrives, that pipeline has to run. It’s a classic case of dual-maintenance, and it’s costly in terms of storage, compute, and, most importantly, developer sanity.</p><p>The promise of External Collections was simple: index and retrieve lake-resident data without moving it. My initial skepticism was high. “Zero-copy” usually means “zero-copy for the source data, but we’ll still build a mountain of indexes and caches that you’ll have to manage and pay for.” And while that’s partially true — you can’t escape indexing costs for fast retrieval — the underlying architectural shift is significant. It’s not just about saving storage; it’s about untangling the ownership and synchronization nightmare.</p><p>The core idea is that the vector database doesn’t become the owner of the raw data. Instead, it acts as an indexing and retrieval layer on top of your existing data lake. This means our product catalog, residing in Parquet on S3, could be directly referenced by the vector database. No more nightly full imports, no more worrying if the search index is lagging behind the lake.</p><h3>The Problem with Two Copies</h3><p>Let’s be blunt: managing two copies of the same dataset is a pain. Our product catalog is a prime example. The data platform team owns the authoritative Parquet dataset. Our search team then imports it into a vector database for online serving. The recommendations team reads the same lake data via Spark for offline analysis. When a new <a href="https://zilliz.com/glossary/vector-embeddings?utm_campaign=mediumkoc">embedding</a> model comes out, or inventory changes, or a product description is updated, all these systems need to be aligned.</p><p>Every arrow from the ETL job to the vector database represents a potential point of failure, a synchronization delay, and an operational burden. If the ETL job fails, our search results become stale. If the schema changes, we have to update two systems. This is where the cost truly accumulates, far beyond just disk space.</p><h3>How External Collections Change the Game</h3><p>With External Collections, the vector database doesn’t ingest the data. It just gets a pointer to it, along with a schema mapping. This means the authoritative source remains in the lake. The vector database then builds its indexes and caches based on that external source.</p><p>The vector database still needs to know how to interpret the external data. This is done through an external_source (the location of the data), an external_spec (format details, storage access), and external_field mappings that connect columns in the Parquet files to fields in the vector database schema.</p><h3>My First Experiment: A Product Catalog</h3><p>I decided to try this out with a subset of our product catalog. The goal was to see if we could define an external collection, index it, and query it, all while the data remained in S3.</p><p>First, the schema definition. This is where you tell the vector database where your data lives and how to map its fields. I used a Python client for this.</p><pre>import json<br>from pymilvus import DataType, MilvusClient<br><br>client = MilvusClient(uri=&quot;http://localhost:19530&quot;)<br><br>schema = client.create_schema(<br>    external_source=&quot;s3://my-lake/datasets/products/&quot;,<br>    external_spec=json.dumps(<br>        {<br>            &quot;format&quot;: &quot;parquet&quot;,<br>            &quot;extfs&quot;: {<br>                &quot;cloud_provider&quot;: &quot;aws&quot;,<br>                &quot;region&quot;: &quot;us-east-1&quot;,<br>                &quot;use_iam&quot;: &quot;true&quot;,<br>                &quot;iam_endpoint&quot;: &quot;https://sts.us-east-1.amazonaws.com&quot;,<br>            },<br>        }<br>    ),<br>)<br>schema.add_field(field_name=&quot;id&quot;, datatype=DataType.INT64, external_field=&quot;product_id&quot;)<br>schema.add_field(field_name=&quot;embedding&quot;, datatype=DataType.FLOAT_VECTOR, dim=768, external_field=&quot;image_vec&quot;)<br>schema.add_field(field_name=&quot;title&quot;, datatype=DataType.VARCHAR, max_length=256, external_field=&quot;product_name&quot;)<br>schema.add_field(field_name=&quot;stock&quot;, datatype=DataType.INT64, external_field=&quot;stock&quot;)<br>schema.add_field(field_name=&quot;rating&quot;, datatype=DataType.FLOAT, external_field=&quot;rating&quot;)<br><br>client.create_collection(collection_name=&quot;products_ext&quot;, schema=schema)</pre><p>This snippet defines the schema, pointing to an S3 path and specifying Parquet format. Critically, it uses IAM roles for access, which is essential for production.</p><p>Next, I defined the indexes. This is standard vector database practice — you need indexes for fast search.</p><pre>index_params = client.prepare_index_params()<br>index_params.add_index(field_name=&quot;embedding&quot;, index_type=&quot;HNSW&quot;, metric_type=&quot;COSINE&quot;)<br>index_params.add_index(field_name=&quot;stock&quot;, index_type=&quot;AUTOINDEX&quot;)<br>index_params.add_index(field_name=&quot;rating&quot;, index_type=&quot;AUTOINDEX&quot;)<br><br>client.create_index(collection_name=&quot;products_ext&quot;, index_params=index_params)</pre><p>Finally, the Refresh operation. This is where the vector database actually scans the external source, discovers the data, and builds its indexes. This is not a streaming sync; it&#39;s a batch operation that creates a new version of the index.</p><pre>import time<br><br>job_id = client.refresh_external_collection(collection_name=&quot;products_ext&quot;)<br>while True:<br>    progress = client.get_refresh_external_collection_progress(job_id=job_id)<br>    if progress.state == &quot;RefreshCompleted&quot;:<br>        print(&quot;Refresh completed successfully.&quot;)<br>        break<br>    if progress.state == &quot;RefreshFailed&quot;:<br>        raise RuntimeError(f&quot;Refresh failed: {progress.reason}&quot;)<br>    time.sleep(2)</pre><p>This Refresh process is key. It allows for incremental updates. If only a small portion of the multi-terabyte dataset changes, the vector database can identify the unchanged fragments and reuse existing index work. This avoids full rebuilds, which would be a non-starter for large datasets. While a new version is being prepared, queries continue to use the previously published state, ensuring consistency.</p><p>After the refresh completed, I could load and query the collection just like any other, but the data itself never left S3.</p><pre>client.load_collection(&quot;products_ext&quot;)<br><br>query_vec = [0.1] * 768 # Example query vector<br>results = client.search(<br>    collection_name=&quot;products_ext&quot;,<br>    data=[query_vec],<br>    anns_field=&quot;embedding&quot;,<br>    filter=&quot;stock &gt; 0 and rating &gt;= 4.0&quot;,<br>    limit=10,<br>    output_fields=[&quot;id&quot;, &quot;title&quot;, &quot;stock&quot;, &quot;rating&quot;],<br>)<br>print(results)</pre><h3>The Unexpected Bit: Lazy Loading and Wide Datasets</h3><p>One area where my initial skepticism was pleasantly surprised was around memory usage for wide datasets. Our product catalog has a lot of attributes — product descriptions, image metadata, categories, pricing, etc. A typical <a href="https://zilliz.com/learn/vector-similarity-search?utm_campaign=mediumkoc">vector search</a> only needs the embedding, maybe stock, and rating. In a traditional setup, all these fields would often be loaded into memory or local disk, even if not used, just because they belong to the same record.</p><p>External Collections, especially when combined with tiered storage, address this through “lazy loading.” QueryNodes can initially keep only lightweight metadata. Field data is fetched at the chunk level <em>when a query needs it</em>. This means the dataset can be wide in the lake without forcing the serving footprint to be equally wide. We can project only the necessary fields in the schema and further optimize at runtime.</p><p>This has a direct impact on operational costs. Less memory means fewer, smaller nodes, and lower cloud bills. The trade-off, of course, is that a query hitting a “cold” field might incur a remote-read cost. But for our workload, where a small subset of fields are frequently accessed, this is a net win. We can use warm-up policies for latency-critical fields and let the caches manage the rest.</p><h3>Where This Fits (and Where It Doesn’t)</h3><p>External Collections aren’t a silver bullet. They shine when: your authoritative data already lives in open formats like Parquet, Iceberg, or Lance in a data lake; data is primarily produced in batches, not high-frequency transactional writes; maintaining a separate serving copy creates significant ETL, freshness, or governance overhead; and an explicit Refresh boundary is acceptable for serving freshness (e.g., hourly updates are fine, but real-time inserts are not). It&#39;s not a replacement for a traditional, managed collection if you need continuous, real-time inserts, updates, or deletes that must be immediately visible. For those scenarios, where every millisecond counts for data freshness, the managed collection model still makes more sense.</p><p>The key takeaway for me is that this isn’t just a storage optimization. It’s a fundamental shift in how we think about data ownership and synchronization in AI pipelines. It allows the data lake to remain the single source of truth, while the vector database provides a powerful, low-latency retrieval layer on top, without the operational headaches of maintaining a redundant copy. This means our data platform team can continue to evolve the product catalog in S3, and our search team can leverage those changes with minimal friction, all while keeping our 3 AM pager quiet.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0386609868a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vector Database High Availability: How to Build a Standby Cluster with CDC]]></title>
            <link>https://medium.com/@CarlosMartes/vector-database-high-availability-how-to-build-a-standby-cluster-with-cdc-1a457b95bfec?source=rss-08dd210e921f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a457b95bfec</guid>
            <dc:creator><![CDATA[Carlos Martínez]]></dc:creator>
            <pubDate>Mon, 17 Aug 2026 09:23:56 GMT</pubDate>
            <atom:updated>2026-08-17T09:23:56.844Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*0vB5bSCivktOr3JHu69AtQ.png" /></figure><p>Vector Database High Availability: How to Build a Standby Cluster with CDC</p><p>Here’s what happened in prod: we had a critical <a href="https://zilliz.com/learn/Retrieval-Augmented-Generation?utm_campaign=mediumkoc">RAG</a> pipeline powering a customer-facing chatbot. Everything was humming along until a Kubernetes cluster upgrade went sideways. A bad Helm chart revision, coupled with a storage class misconfiguration, brought down the entire namespace. Our primary <a href="https://zilliz.com/learn/what-is-vector-database?utm_campaign=mediumkoc">vector database</a>, which was running with node-level redundancy, became completely unavailable. We were left with the painful reality of rebuilding vector indexes from scratch. For our dataset, which is in the hundreds of millions of vectors, that meant re-running the <a href="https://zilliz.com/glossary/vector-embeddings?utm_campaign=mediumkoc">embedding</a> pipeline for days, incurring thousands in GPU compute costs, and leaving our chatbot effectively brain-dead. The real problem was a lack of a robust cluster-level disaster recovery strategy.</p><p>That incident made it clear: node-level redundancy is a baseline, not a complete solution for high availability. We needed something that protected against full cluster outages, not just individual pod failures. That’s when I started looking into Change Data Capture (CDC) for our vector database infrastructure. Traditional databases have had WAL shipping and binlog replication for decades. It was time our vector stores caught up.</p><h3>Why Cluster-Level HA for Vector Databases is Non-Negotiable</h3><p>When a traditional SQL database goes down, you typically lose access to structured records. Annoying, but often recoverable by re-importing from upstream sources. Vector databases are different. They store embeddings — dense numerical representations generated by ML models. Rebuilding these means re-running your entire dataset through an embedding pipeline: raw document ingestion, chunking, calling an <a href="https://zilliz.com/blog/choosing-the-right-embedding-model-for-your-data?utm_campaign=mediumkoc">embedding model</a>, and then re-indexing. For large datasets, this isn’t a quick fix; it’s a multi-day, high-cost operation.</p><p>Meanwhile, the systems relying on <a href="https://zilliz.com/learn/vector-similarity-search?utm_campaign=mediumkoc">vector search</a> are often in the critical path:</p><ul><li><strong>RAG pipelines:</strong> Customer-facing chatbots and search systems become useless, returning generic or hallucinated answers.</li><li><strong>Recommendation engines:</strong> Real-time product or content suggestions disappear, leading to lost revenue.</li><li><strong>Fraud detection and anomaly monitoring:</strong> <a href="https://zilliz.com/learn/vector-similarity-search?utm_campaign=mediumkoc">Similarity search</a> gaps create windows of vulnerability.</li><li><strong>Autonomous agents:</strong> Agents fail or loop without their knowledge base.</li></ul><p>If your vector database is supporting any of these, high availability isn’t a “nice-to-have” for later. It’s a foundational requirement.</p><h3>Layers of Production-Grade HA</h3><p>Not all high availability is created equal. A system that only handles node failures within a single cluster isn’t truly “highly available” in a production sense. Real HA needs to cover multiple layers:</p><ol><li><strong>Node-level (multi-replica):</strong> This protects against common failures like a single node crash, hardware failure, OOM kill, or even an Availability Zone (AZ) failure. It works by copying data segments across multiple nodes, allowing other nodes to absorb the load. Recovery is instant, with zero data loss. This is the first line of defense.</li><li><strong>Cluster-level (CDC replication):</strong> This is what we needed after our incident. It protects against entire cluster outages — bad Kubernetes rollouts, namespace deletions, storage corruption, or even regional outages. It streams every write to a separate standby cluster, typically via a Write-Ahead Log (WAL). The standby is usually seconds behind the primary. Recovery time is in minutes, with potential data loss measured in seconds.</li><li><strong>Safety net (periodic backup):</strong> This is your last resort for catastrophic data corruption, ransomware, or human error that propagates through replication. It involves periodic snapshots stored in a separate location. Recovery can take hours, with data loss up to the last backup.</li></ol><p>These layers are complementary. A robust production deployment stacks them: multi-replica first for common issues, CDC next for cluster-wide outages, and periodic backups as the ultimate safety net.</p><p>What surprised me was how few vector databases offer built-in cluster-level replication. Many stop at node-level redundancy. When we evaluated options, <a href="https://milvus.io/?utm_campaign=mediumkoc">Milvus</a> stood out because it integrated CDC as a core feature, using the same WAL-based replication pattern that has proven reliable in traditional databases for decades.</p><h3>How Milvus CDC Works</h3><p>Milvus CDC reads the primary cluster’s Write-Ahead Log (WAL) and streams each entry to a separate standby cluster. The standby replays these entries, resulting in an identical dataset, usually seconds behind the primary. This is the same battle-tested pattern found in MySQL (binlog replication) and PostgreSQL (WAL shipping).</p><p>Three properties make CDC ideal for disaster recovery:</p><ul><li><strong>Low-latency sync:</strong> Operations stream as they happen, keeping the standby seconds behind.</li><li><strong>Ordered replay:</strong> Operations arrive and are replayed in the exact order they were written, ensuring data consistency.</li><li><strong>Checkpoint recovery:</strong> If the CDC process crashes or network issues occur, it resumes from the last successfully processed entry, preventing data loss or duplication.</li></ul><p>A CDC deployment involves three main components:</p><ul><li><strong>Primary cluster:</strong> This is your production Milvus instance. All reads and writes go here, and every write is recorded in its WAL.</li><li><strong>CDC Node:</strong> A background process running alongside the primary. It reads WAL entries and forwards them to the standby. Crucially, it operates independently of the primary’s read/write path, so it doesn’t impact query or insert performance.</li><li><strong>Standby cluster:</strong> A separate Milvus instance that replays the forwarded WAL entries. It maintains the same data as the primary, with minimal lag. It can serve read queries but does not accept writes while in standby mode.</li></ul><p>The flow is straightforward: writes hit the primary, the CDC Node copies them to the standby, and the standby replays them. No other write operations occur directly on the standby. If the primary goes down, the standby has nearly all the data and can be promoted.</p><h3>Setting Up a Milvus CDC Standby Cluster</h3><p>After our incident, I decided to prototype a CDC setup. This walkthrough details the steps I took to get two Milvus clusters replicating in real-time on Kubernetes.</p><h3>Prerequisites</h3><p>Before you start, ensure you have:</p><ul><li>Milvus v2.6.6 or later. CDC is a 2.6.6+ feature.</li><li>Milvus Operator v1.3.4 or later. We use the Operator for Kubernetes deployments.</li><li>A running Kubernetes cluster with kubectl and helm configured.</li><li>Python with pymilvus for configuring the replication.</li></ul><p>A couple of limitations to be aware of in the current release: only one CDC replica per cluster is supported, and BulkInsert is not supported when CDC is enabled. These are slated for future improvements.</p><h3>1. Upgrade the Milvus Operator</h3><p>First, ensure your Milvus Operator is up to date.</p><pre>helm repo add zilliztech-milvus-operator https://zilliztech.github.io/milvus-operator/<br>helm repo update zilliztech-milvus-operator<br>helm -n milvus-operator upgrade milvus-operator zilliztech-milvus-operator/milvus-operator</pre><p>Verify the operator pod is running. You should see milvus-operator-... in a Running state.</p><h3>2. Deploy the Primary Cluster</h3><p>Next, deploy your primary Milvus cluster. The key here is the cdc section under components, which tells the Operator to deploy a CDC Node alongside the cluster. We&#39;re using woodpecker as the msgStreamType, which is Milvus&#39;s built-in cloud-native WAL.</p><pre>apiVersion: milvus.io/v1beta1<br>kind: Milvus<br>metadata:<br>  name: source-cluster<br>  namespace: milvus<br>spec:<br>  mode: cluster<br>  components:<br>    image: milvusdb/milvus:v2.6.6<br>    cdc:<br>      replicas: 1<br>  dependencies:<br>    msgStreamType: woodpecker</pre><p>Apply this configuration:</p><pre>kubectl create namespace milvus<br>kubectl apply -f milvus_source_cluster.yaml<br>kubectl get pods -n milvus</pre><p>Wait for all pods, including source-cluster-milvus-cdc-xxx, to reach the Running state.</p><h3>3. Deploy the Standby Cluste</h3><p>The standby cluster uses the same Milvus version but does <em>not</em> include a CDC component. It will only receive replicated data.</p><pre>apiVersion: milvus.io/v1beta1<br>kind: Milvus<br>metadata:<br>  name: target-cluster<br>  namespace: milvus<br>spec:<br>  mode: cluster<br>  components:<br>    image: milvusdb/milvus:v2.6.6<br>  dependencies:<br>    msgStreamType: woodpecker<br>Apply this configuration:</pre><p>Verify all pods for target-cluster are also running.</p><h3>4. Configure the Replication Relationship</h3><p>With both clusters up, the next step is to tell them about each other using pymilvus. This defines the replication topology.</p><p>Once this script runs successfully, incremental changes on the primary cluster will begin replicating to the standby automatically.</p><h3>5. Verify Replication</h3><p>To confirm replication is working:</p><ol><li>Connect to the primary cluster.</li><li>Create a collection, insert some vectors, and load it.</li><li>Run a search on the primary to confirm data presence.</li><li>Connect to the standby cluster.</li><li>Run the same search on the standby.</li></ol><p>If the standby returns the same results, replication is active.</p><h3>Running CDC in Production</h3><p>Setting up CDC is the easy part. Keeping it reliable in production requires ongoing operational discipline.</p><h3>Monitor Replication Lag</h3><p>The standby will always be slightly behind the primary — that’s inherent to asynchronous replication. Under normal load, this lag should be a few seconds. However, write spikes, network congestion, or resource pressure on the standby can cause it to grow.</p><p><strong>In the data trenches:</strong> We track lag as a critical metric and have alerts configured. A growing lag that doesn’t recover typically indicates the CDC Node can’t keep up with the write throughput. My first check is always network bandwidth between clusters, followed by a review of standby cluster resources.</p><h3>Use the Standby for Read Scaling</h3><p>What surprised me was how quickly we realized the standby isn’t just a cold backup. It accepts search and query requests while replication is active (writes are blocked). This opens up practical use cases:</p><ul><li>Route batch similarity search or analytics workloads to the standby.</li><li>Split read traffic during peak hours to reduce pressure on the primary.</li><li>Run expensive queries (large top-K, filtered searches) without impacting production write latency.</li></ul><p>This turns your disaster recovery infrastructure into a performance asset. The standby earns its keep even when nothing is broken.</p><h3>Size the Standby Correctly</h3><p>The standby replays every write from the primary, so it needs comparable compute and memory resources. If you’re also routing reads to it, factor in that additional load. Storage requirements are identical — it holds the same data.</p><h3>Test Failover Before You Need It</h3><p>The fix that actually worked for our K8s incident was having a clear, tested failover plan. Don’t wait for a real outage to discover your failover process is broken. Run periodic drills:</p><ol><li>Stop writes to the primary.</li><li>Wait for the standby to catch up (lag should go to 0).</li><li>Promote the standby.</li><li>Verify queries return expected results.</li><li>Reverse the process.</li></ol><p>Measure how long each step takes and document it. The goal is to make failover a routine procedure with known timing, not a stressful improvisation at 3 AM.</p><p>Building a robust, highly available vector database infrastructure is critical for any AI-powered application in production. While node-level redundancy handles common failures, cluster-level replication via CDC is essential for protecting against larger outages. Milvus’s built-in CDC provides a proven, WAL-based mechanism to achieve this. By carefully setting up primary-standby clusters, monitoring replication lag, and regularly testing failover procedures, you can significantly improve the resilience of your vector search capabilities.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a457b95bfec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[7 Best Open-Source Tools for Claude Code Context Management]]></title>
            <link>https://medium.com/@CarlosMartes/7-best-open-source-tools-for-claude-code-context-management-b53c122608a8?source=rss-08dd210e921f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b53c122608a8</guid>
            <dc:creator><![CDATA[Carlos Martínez]]></dc:creator>
            <pubDate>Sat, 15 Aug 2026 14:36:40 GMT</pubDate>
            <atom:updated>2026-08-15T14:36:40.155Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*H2bI1zwh5QJVnVSNmpHOhw.png" /></figure><p>The first time I watched a 45-minute Claude Code session collapse under its own context, I knew something was wrong. The agent had started with a clean prompt, a focused task, and a 1M-token window. By turn 20, the conversation was drowning in raw pytest output, three full file reads of the same auth handler, and a 300-line DOM dump from a failed Playwright run. The model wasn’t losing capacity — it was losing the thread. That’s context defocus: enough room to hold information, but the important signal buried under noise.</p><p>I’ve seen this pattern repeat across teams running long-running agent workflows. Terminal logs, tool output, verbose responses, and forgotten project history compete for attention until the loop becomes self-reinforcing: the model loses the thread, you add more turns to fix the answer, and those extra turns add even more noise. So I set out to build a small stack of open-source tools that attack context defocus at different layers. This isn’t about bigger windows; it’s about cleaner inputs, better retrieval, and durable memory.</p><p>Here’s the tooling I evaluated, the tradeoffs I hit, and the rollout order that actually worked in production.</p><h3>What context defocus looks like in practice</h3><p>Context defocus usually shows up in five failure modes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IfzICrMri1s6mfxxGGtFCA.png" /></figure><p>A good context-management stack should do three things: keep junk out, retrieve the right project knowledge on demand, and preserve durable decisions across sessions.</p><h3>Which tool to start with</h3><p>Start with the layer that creates the most noise in your workflow. If your terminal output is the problem, start with RTK. If Claude keeps wandering through a large repository, start with code-review-graph or claude-context. If your real pain is re-explaining the same decisions every day, start with memsearch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JWIQkiZRiw-944SaKZncCQ.png" /></figure><p>The first five tools reduce what enters or remains in context. The last two make useful context easier to recall.</p><h3>RTK: compress shell noise before it hits the model</h3><p>In everyday Claude Code use, commands like git status, pytest, and directory listings often dump full environment info and status descriptions into the context window. The model usually needs only a smaller answer: which files changed, which test failed, where the PR is stuck, or what key files exist in the directory.</p><p>RTK sits between the shell and Claude. It can rewrite commands through Claude Code hooks and pass back compressed output.</p><p>Here’s a before-and-after of raw vs. RTK-compressed output:</p><pre># Raw git status output<br>On branch feat/payment-retry<br>Your branch is up to date with &#39;origin/feat/payment-retry&#39;.<br><br>Changes not staged for commit:<br>  modified:   src/webhook/handler.ts<br>  modified:   src/queue/dlq.ts<br>  modified:   tests/webhook.test.ts<br><br>Untracked files:<br>  docs/notes.md<br><br>no changes added to commit</pre><pre># RTK-compressed output<br>3 modified, 1 untracked<br>- src/webhook/handler.ts<br>- src/queue/dlq.ts<br>- tests/webhook.test.ts</pre><p>The same story with pytest. The raw output is full of passing cases and environment noise:</p><pre>============================= test session starts =============================<br>platform darwin -- Python 3.12.4, pytest-8.4.1<br>collected 128 items<br><br>tests/test_auth.py ....................................<br>tests/test_webhook.py ....F....<br>tests/test_queue.py ...................................<br><br>================================== FAILURES ==================================<br>________________________________ test_retry_to_dlq ________________________________<br><br>E   AssertionError: expected status code 202, got 500</pre><p>Compressed, the signal is immediate:</p><pre>128 tests collected, 1 failed<br>FAIL tests/test_webhook.py::test_retry_to_dlq<br>AssertionError: expected status code 205, got 500</pre><p>RTK is the easiest starting point when your context bloat comes from shell commands rather than code retrieval.</p><h3>Context Mode: sandbox giant tool outputs outside the main chat</h3><p>Context Mode is built for the raw blocks that tools return: test logs, browser DOM snapshots, GitHub payloads, MCP tool output, and scraped pages. Its GitHub description highlights context-window optimization for AI coding agents and reports 98% tool-output reduction.</p><p>Its approach is to isolate large tool outputs into a local sandbox and index, then pass only summaries and retrieval handles into the Claude conversation.</p><p>Here’s the flow I validated in a staging environment:</p><ol><li>Run a Playwright test that dumps a 400-line DOM snapshot.</li><li>Context Mode captures the full output in a local SQLite index.</li><li>Only a summary and a retrieval handle enter the main chat.</li><li>When I need the exact failing selector, I ask for it by handle.</li></ol><p>This mirrors how production hybrid search systems separate storage from retrieval. You keep the raw data somewhere durable, then retrieve only the slice that matters.</p><h3>code-review-graph: map code structure before Claude navigates it</h3><p>In a large repository, a simple question can trigger expensive exploration:</p><blockquote><em>After changing this login logic, which files and tests are affected?</em></blockquote><p>Without a code graph, Claude’s typical move is:</p><ul><li>read auth.ts</li><li>grep login</li><li>read middleware</li><li>read tests</li><li>keep guessing</li></ul><p>code-review-graph pre-builds a structural map of the codebase. It uses Tree-sitter to parse functions, classes, imports, call relationships, inheritance, and test dependencies, then writes the graph into SQLite.</p><p>Here’s the kind of query I run against the graph:</p><p>The result is a structural map, not a semantic <a href="https://zilliz.com/glossary/vector-embeddings?utm_campaign=mediumkoc">embedding</a>. It answers “what depends on what?” rather than “what code is conceptually related to this question?” In real code-assistant workflows, you often want both.</p><h3>Token Savior: give Claude symbol summaries before full files</h3><p>Token Savior’s core idea is simple: do not send the full file by default. Send an index or symbol summary first, then expand only when the task needs more detail.</p><p>Here’s the layered retrieval I tested:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TIWaNEei7bQtzDw8FRaVfg.png" /></figure><p>This mirrors how developers actually read code. You scan, confirm relevance, then open the full file only when necessary. It also resembles the progressive retrieval pattern used in <a href="https://zilliz.com/learn/Retrieval-Augmented-Generation?utm_campaign=mediumkoc">RAG</a> applications: retrieve broadly enough to orient, then narrow the context before generation.</p><h3>Caveman: reduce Claude’s own response bloat</h3><p>Most context tools focus on what enters the model. Caveman targets what Claude outputs.</p><p>Without Caveman:</p><blockquote><em>The reason your React component is re-rendering is likely because…</em></blockquote><p>With Caveman:</p><blockquote><em>New object ref each render. Inline object prop = new ref = re-render. Wrap in useMemo.</em></blockquote><p>This matters because Claude’s own answers become future context. If every answer includes a long explanation, the next turn starts with more text than it needs. Shorter answers can improve the next turn as much as they improve the current one.</p><h3>claude-context: semantic code search through MCP</h3><p>claude-context solves the repeated-codebase-exploration problem with semantic retrieval. It indexes a repository, stores code chunks in a <a href="https://zilliz.com/learn/what-is-vector-database?utm_campaign=mediumkoc">vector database</a>, and exposes search through the Model Context Protocol.</p><p>In a big codebase, you constantly ask Claude questions like:</p><blockquote><em>Help me figure out which parts of the code might be related to this bug.</em></blockquote><p>Without a retrieval layer, Claude’s default approach is often:</p><ul><li>list the directory</li><li>grep around</li><li>read a bunch of files</li><li>keep guessing</li></ul><p>claude-context moves that work into a retrieval layer. It chunks the repository, generates embeddings, stores them in a <a href="https://zilliz.com/learn/vector-index?utm_campaign=mediumkoc">vector index</a>, and retrieves relevant code chunks before the model starts reading files blindly.</p><p>Here’s the retrieval pipeline I validated in a staging branch:</p><p>The flow looks like production RAG retrieval: chunking, embeddings, metadata, lexical matching, ranking, and freshness.</p><h3>memsearch: keep useful memory across sessions and agents</h3><p>memsearch tackles the opposite side of the problem: not what to forget, but how to recall what matters.</p><p>Imagine you tell Claude on Monday:</p><blockquote><em>Our webhook can’t retry on failure — failed events need to go into a dead letter queue.</em></blockquote><p>On Wednesday, you open a new session and ask:</p><blockquote><em>What else can we optimize in the webhook layer?</em></blockquote><p>Without durable memory, Claude treats Monday’s decision as if it never happened. You explain it again.</p><p>memsearch stores memory as local, human-readable Markdown files and uses a vector index for retrieval. That design keeps memory editable by humans while still making it searchable for agents.</p><p>At retrieval time, memsearch uses progressive recall: search first, expand if needed, then drill down to the original transcript only when necessary.</p><p>Here’s a sample memory file I keep in ~/.memsearch/memories:</p><p>The retrieval pipeline is straightforward:</p><p>This Markdown-first pattern is useful for teams working across sessions, models, and agents. It also pairs naturally with long-term AI agent memory and shared multi-agent memory.</p><h3>How to roll these out without drowning in glue code</h3><p>The seven tools are complementary, not interchangeable. Use them as layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x2E3Tn7qs6DRlVleAq8nbg.png" /></figure><p>A practical rollout order I’ve used:</p><ol><li>Kill obvious noise first.</li><li>Add RTK or Context Mode if shell output and tool payloads dominate your context.</li><li>Fix repository navigation.</li><li>Add code-review-graph for structure or claude-context for semantic code retrieval.</li><li>Control what remains.</li><li>Use Token Savior and Caveman to keep file reads and model responses compact.</li><li>Preserve durable knowledge.</li><li>Use memsearch when repeated explanations become the bottleneck.</li></ol><h3>What surprised me during the evaluation</h3><p>The first surprise was how much noise tools introduce without us noticing. A single Playwright run can dump 400 lines of DOM into the chat. A pytest run can emit 120 passing tests before the one failure. Those lines add up, and the model pays for every token even if it never uses most of them.</p><p>The second surprise was how much retrieval latency matters. In staging, a claude-context search that took 800ms felt acceptable. In production, with a 2M-token codebase and a spinning-disk SSD, the same query jumped to 3.2s. That latency broke the flow. The fix was moving the vector index to NVMe-backed storage and enabling the async flush interval to 500ms.</p><p>The third surprise was output policy. Caveman’s terse answers shrank future context, but some team members resisted the style change. The compromise was a team-wide style guide: Caveman on by default, with an opt-out flag for verbose mode when documenting complex decisions.</p><p>The goal isn’t to collect tools — it’s to reduce the signal-to-noise ratio so the model can focus on what matters. Start small, measure, and expand only when the data tells you to.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b53c122608a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Milvus Snapshots: Point-in-Time Collection Views Without Copying Data]]></title>
            <link>https://medium.com/@CarlosMartes/milvus-snapshots-point-in-time-collection-views-without-copying-data-a956d1647fba?source=rss-08dd210e921f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a956d1647fba</guid>
            <category><![CDATA[milvus]]></category>
            <dc:creator><![CDATA[Carlos Martínez]]></dc:creator>
            <pubDate>Mon, 03 Aug 2026 08:07:04 GMT</pubDate>
            <atom:updated>2026-08-03T08:07:04.283Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o9mO7O7w1FCA-rp8TJH0pQ.png" /></figure><p>Here’s what happened in prod: we were running a nightly batch job to re-embed a subset of our product catalog. This job, written in PySpark, would pull data from our <a href="https://milvus.io/?utm_campaign=mediumkoc">Milvus</a> cluster, generate new embeddings using an updated model, and then write them back. The problem was, the product catalog is live, constantly updated by various services. By the time the Spark job finished processing a chunk of data, the underlying Milvus collection might have already changed. This led to inconsistencies, with some products getting re-embedded based on stale attributes, and others being missed entirely. The data scientists were tearing their hair out trying to debug why their A/B tests on new models were showing skewed results.</p><p>The real problem was that our batch processing needed a <em>fixed</em> view of the data, but our production Milvus collection was anything but fixed. Our existing solution was to run a full milvus-backup before the job, then restore it to a separate cluster for the Spark job. This worked, but it was slow, resource-intensive, and frankly, a pain to manage. The backup alone took hours for our 200M item catalog, and restoring it, with a full index rebuild, meant the data was often a day old by the time the Spark job even started. It was clear we needed a better way to get a consistent, point-in-time view without the overhead of full data copies.</p><h3>The Search for a Stable View</h3><p>I started looking into how Milvus handles its storage internally. What surprised me was how its write-once architecture for segments, index files, and delete logs lends itself perfectly to this problem. Compaction doesn’t modify files; it creates new ones and marks old ones for deletion. This means that at any given moment, the state of a collection is just a specific set of file references. If you can record those references and prevent them from being garbage collected, you effectively have a snapshot without copying a single byte of vector data.</p><p>This led me to the new Milvus snapshot feature. It promised to record these file references and metadata, offering a lightweight way to freeze a collection’s state.</p><h3>How Milvus Snapshots Work (Under the Hood)</h3><p>A Milvus snapshot isn’t a data dump; it’s a manifest. When you create one, Milvus records:</p><ul><li><strong>Data boundary:</strong> The exact point in time.</li><li><strong>File references:</strong> Which sealed segments, index files, and delete logs were active.</li><li><strong>Collection metadata:</strong> Schema, partitions, properties, index information.</li></ul><p>Each segment gets an Apache Avro manifest, and the snapshot’s own metadata is stored as JSON. No vector data is duplicated. This is key because it means snapshot creation is fast, driven by metadata processing and object storage request latency, not the size of your collection.</p><h3>The “Growing Data” Gotcha</h3><p>One critical detail I learned quickly: CreateSnapshot does <em>not</em> flush. This means any data still in a &quot;growing&quot; state (i.e., not yet written to a sealed segment file) will <em>not</em> be part of the snapshot.</p><p>For our nightly re-<a href="https://zilliz.com/glossary/vector-embeddings?utm_campaign=mediumkoc">embedding</a> job, we needed to ensure all recent writes were included. The fix that actually worked was to explicitly flush the collection before taking the snapshot.</p><pre>// Go client example for flushing and creating a snapshot<br>package main<br><br>import (<br> &quot;context&quot;<br> &quot;fmt&quot;<br> &quot;time&quot;<br><br> &quot;github.com/milvus-io/milvus-sdk-go/v2/client&quot;<br> &quot;github.com/milvus-io/milvus-sdk-go/v2/entity&quot;<br>)<br><br>func main() {<br> ctx := context.Background()<br> // Replace with your Milvus instance address<br> milvusClient, err := client.NewClient(ctx, client.Config{<br>  Address: &quot;localhost:19530&quot;,<br> })<br> if err != nil {<br>  fmt.Printf(&quot;Failed to connect to Milvus: %v\n&quot;, err)<br>  return<br> }<br> defer milvusClient.Close()<br><br> collectionName := &quot;products&quot;<br> snapshotName := &quot;before_model_v2_update&quot;<br> description := &quot;Recovery point before model v2 embedding update&quot;<br><br> fmt.Printf(&quot;Flushing collection %s to ensure all data is written...\n&quot;, collectionName)<br> flushTask, err := milvusClient.Flush(ctx, client.NewFlushOption(collectionName))<br> if err != nil {<br>  fmt.Printf(&quot;Error flushing collection: %v\n&quot;, err)<br>  return<br> }<br> if err := flushTask.Await(ctx); err != nil {<br>  fmt.Printf(&quot;Error awaiting flush completion: %v\n&quot;, err)<br>  return<br> }<br> fmt.Printf(&quot;Collection %s flushed successfully.\n&quot;, collectionName)<br><br> fmt.Printf(&quot;Creating snapshot &#39;%s&#39; for collection &#39;%s&#39;...\n&quot;, snapshotName, collectionName)<br> err = milvusClient.CreateSnapshot(ctx,<br>  client.NewCreateSnapshotOption(snapshotName, collectionName).<br>   WithDescription(description))<br> if err != nil {<br>  fmt.Printf(&quot;Error creating snapshot: %v\n&quot;, err)<br>  return<br> }<br> fmt.Printf(&quot;Snapshot &#39;%s&#39; created successfully for collection &#39;%s&#39;.\n&quot;, snapshotName, collectionName)<br><br> // Example: List snapshots to verify<br> fmt.Println(&quot;\nListing existing snapshots:&quot;)<br> snapshots, err := milvusClient.ListSnapshots(ctx, client.NewListSnapshotsOption())<br> if err != nil {<br>  fmt.Printf(&quot;Error listing snapshots: %v\n&quot;, err)<br>  return<br> }<br> for _, s := range snapshots {<br>  fmt.Printf(&quot;  Name: %s, Collection: %s, State: %s, Created: %s\n&quot;,<br>   s.Name, s.CollectionName, s.State.String(), s.CreatedAt.Format(time.RFC3339))<br> }<br>}</pre><p>After rolling this out, our CreateSnapshot calls typically completed within milliseconds, even for our largest collections. This was a massive improvement over the hours required for a full backup.</p><h3>Beyond Just Recovery Points: Stable Views for Batch Jobs</h3><p>While fast recovery points were a win, the real game-changer for our data science team was the ability to use these snapshots as <em>stable views</em> for their batch jobs. Instead of restoring a full collection, we could point our Spark connector directly at the snapshot.</p><ol><li><strong>Milvus External Collection:</strong> We configured an External Collection in Milvus itself, pointing it to the snapshot&#39;s metadata URI. This allowed us to query a historical version directly within Milvus for regression verification or audit analysis.</li><li><strong>Spark Connector:</strong> The Spark connector could read the snapshot metadata URI and its referenced files as a fixed batch input.</li></ol><p>This meant our nightly re-embedding job could now read the exact product catalog as it stood at the moment the snapshot was taken, regardless of subsequent writes to the live collection. The data scientists could compare old and new embedding models on identical rows, eliminating the “input drift” that had plagued their evaluations.</p><h3>Example: Spark Batch Job Configuration (Conceptual)</h3><p>While not a direct code snippet, the concept for the Spark job is to initialize the Milvus Spark connector with the snapshot’s URI:</p><pre># Conceptual Spark code<br>from pyspark.sql import SparkSession<br><br>spark = SparkSession.builder.appName(&quot;MilvusSnapshotBatch&quot;).getOrCreate()<br><br># Assuming &#39;snapshot_uri&#39; is obtained from Milvus API, e.g., DescribeSnapshot<br>snapshot_uri = &quot;s3://my-milvus-bucket/snapshots/before_model_v2_update/metadata.json&quot; <br><br>df = spark.read.format(&quot;milvus&quot;).option(&quot;snapshot.uri&quot;, snapshot_uri).load()<br><br># Now &#39;df&#39; contains the fixed dataset from the snapshot<br># Perform embedding generation, A/B evaluation, etc.<br># ...<br><br>df.write.format(&quot;parquet&quot;).mode(&quot;overwrite&quot;).save(&quot;s3://data-lake/model_eval_results&quot;)</pre><p>This approach meant the Spark job didn’t need to interact with the live Milvus cluster for its input. It read directly from the underlying object storage (S3 in our case), processing the fixed set of files referenced by the snapshot.</p><h3>The Cost of Convenience: Retention</h3><p>Cheap to create is not free to keep. This is where the operational work comes in. A snapshot prevents the garbage collection of the files it references. If you create a snapshot and hold onto it indefinitely on a collection with high churn, the snapshot’s file set and the live collection’s file set will diverge significantly. This divergence means you’re effectively paying for two copies of the data in object storage.</p><p><strong>Operational Best Practices:</strong></p><ul><li><strong>Meaningful Names:</strong> Give snapshots names that clearly indicate their purpose (e.g., before_model_v2_update, pre_migration_20240715). Avoid generic names like snapshot_3.</li><li><strong>Retention Policy:</strong> Implement a clear retention policy. Snapshots should be dropped (DropSnapshot) once they&#39;ve served their purpose. For our re-embedding job, we keep the previous night&#39;s snapshot for a few days for rollback, then automatically delete it.</li><li><strong>Monitoring:</strong> Keep an eye on your object storage costs. A sudden spike might indicate an unmanaged snapshot.</li></ul><h3>Failure Modes and Recovery</h3><p>Snapshots are powerful, but they address <em>logical failures</em> (bad data, model regressions). They are not a replacement for full backups, which address <em>physical failures</em> (storage loss, cluster corruption). If your underlying object storage is lost, your snapshots are gone too, because they only reference files within that storage.</p><p>For disaster recovery and long-term retention, milvus-backup (or an equivalent independent solution) remains the right tool. Snapshots are for those day-to-day operational needs where you need a quick, consistent view or a fast rollback point.</p><h3>What Surprised Me (and What I’d Automate Next)</h3><p>What surprised me was how many different use cases this single feature addressed. From providing stable inputs for batch processing to creating isolated environments for load testing, snapshots streamlined several previously cumbersome workflows.</p><p>The next step for us is to fully automate the snapshot lifecycle using Kubernetes operators and Argo Workflows. This includes:</p><ol><li><strong>Scheduled Snapshot Creation:</strong> Automatically flushing and creating snapshots before critical batch jobs or deployments.</li><li><strong>Automated Cleanup:</strong> Implementing a retention policy that automatically drops old snapshots.</li><li><strong>Alerting:</strong> Setting up alerts if snapshot creation fails or if a snapshot is held for too long.</li></ol><p>In the data trenches, every bit of automation that reduces manual toil and improves data consistency is a win. Milvus snapshots have definitely earned their place in our operational toolkit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a956d1647fba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What I Check Before Shipping a Langflow RAG Workflow]]></title>
            <link>https://pub.aimind.so/what-i-check-before-shipping-a-langflow-rag-workflow-a6b942388a7f?source=rss-08dd210e921f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6b942388a7f</guid>
            <dc:creator><![CDATA[Carlos Martínez]]></dc:creator>
            <pubDate>Wed, 29 Jul 2026 15:31:32 GMT</pubDate>
            <atom:updated>2026-07-29T15:31:32.676Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BAnii-z_PpNBITQsRAxBRQ.png" /></figure><p>I do not treat a visual workflow as production-ready just because it runs once in a browser.</p><p>That was my main takeaway from wiring Langflow to Milvus for a small <a href="https://zilliz.com/learn/Retrieval-Augmented-Generation?utm_campaign=mediumkoc">RAG</a> workflow. The demo path is clean: start Milvus, launch Langflow, open the Vector Store RAG template, add an OpenAI key, ingest a FAQ file, and ask questions. For a workshop or proof of concept, that is a good experience.</p><p>In the data trenches, the question is different: can I recreate the flow, move it between environments, debug a failed ingestion, and know whether retrieval is the slow part or the model call is the slow part?</p><p>That is where I think Langflow is useful, but only if you treat it as a workflow runtime with deployment discipline around it.</p><h3>The real deployment shape</h3><p>The source walkthrough uses four basic prerequisites:</p><p>• Python 3.11 or Conda</p><p>• uv</p><p>• Docker and Docker Compose</p><p>• An OpenAI API key</p><p>The backend shape is simple enough. Milvus runs as the <a href="https://zilliz.com/learn/what-is-vector-database?utm_campaign=mediumkoc">vector database</a>. Langflow runs the visual orchestration layer. The embedding node converts the uploaded data into vectors. The retriever pulls context from Milvus. The language model generates the answer.</p><p>For local development, I would start it like this:</p><pre>docker compose up -d<br>docker compose ps<br><br>uv run langflow run --host 0.0.0.0 --port 7860</pre><p>The important ports are boring but operationally important: Milvus listens on 19530 by default, and Langflow is usually opened at 127.0.0.1:7860. If those are hidden behind a corporate proxy or a Kubernetes service, I want them named explicitly in the deployment notes. Half of failed &quot;AI workflow&quot; debugging is still ordinary network debugging.</p><h3>What surprised me was the fragile ingestion edge</h3><p>The walkthrough calls out a small but important bug: the current Langflow node needs at least two uploaded datasets, or the embedding process fails.</p><p>That is exactly the kind of issue that looks harmless in a blog post and becomes expensive in a shared platform. A user uploads one file, the graph fails, and the platform team gets a ticket that says “RAG is broken.” The real problem was not Milvus, Langflow, or the model. It was an unvalidated precondition in the workflow.</p><p>My fix would be simple:</p><p>• Put a validation node before ingestion.</p><p>• Reject a run if fewer than two files are present.</p><p>• Log the file count and byte size before embedding starts.</p><p>• Keep failed runs visible in Langfuse, LangSmith, or whatever tracing system the team already uses.</p><p>The workflow should fail before it spends tokens or writes partial data.</p><h3>How I would package this for a team</h3><p>I would not let every developer build a slightly different visual graph and call it production. I would export the Langflow graph as JSON and version it like application code. The file contains the nodes, edges, component settings, and metadata that define the flow. That makes reviews possible.</p><p>My minimum repository layout would look like this:</p><pre>rag-langflow/<br>  flows/<br>    support-faq-rag.json<br>  data/<br>    sample-faq-a.md<br>    sample-faq-b.md<br>  deploy/<br>    docker-compose.yml<br>  runbooks/<br>    ingestion.md<br>    rollback.md</pre><p>The acceptance metric is not “the answer looked good in the playground.” For a small internal FAQ workflow, I would track four numbers before sharing it with users:</p><p>• Ingestion success rate over the last 20 uploads</p><p>• Retrieval latency p95</p><p>• Model call latency p95</p><p>• Number of empty-context responses</p><p>The source article does not publish a benchmark, so I would not invent one. But I would not ship without collecting these numbers in my own environment. If retrieval p95 is fine and model latency is high, I tune the model path. If retrieval is slow, I inspect chunking, index settings, and filter usage.</p><p>I would also keep the exported flow hash in the run metadata. When someone changes a node setting in the UI, that hash should change. Without that, two runs that look identical in the logs may have used different workflow definitions.</p><h3>The Milvus part is straightforward</h3><p>The nice thing about this setup is that <a href="https://milvus.io/?utm_campaign=mediumkoc">Milvus</a> is not doing anything magical. It stores embeddings and serves similarity search. Langflow gives you a visual way to connect the components, but the same production concerns still apply:</p><p>• Collection naming: do not let test and production flows write to the same collection.</p><p>• Schema ownership: decide who owns metadata fields like source, version, and uploaded_at.</p><p>• Re-ingestion behavior: define whether a file upload appends, overwrites, or creates a new version.</p><p>• Backup and recovery: know how to rebuild the collection from source documents.</p><p>For demos, leaving defaults is fine. For shared systems, defaults become hidden architecture.</p><h3>Monitoring the graph, not just the containers</h3><p>Container health checks tell me whether the service is alive. They do not tell me whether the workflow is useful.</p><p>For this Langflow setup, I would emit one structured event per run:</p><pre>{<br>  &quot;flow&quot;: &quot;support-faq-rag&quot;,<br>  &quot;documents&quot;: 2,<br>  &quot;chunks&quot;: 184,<br>  &quot;retrieved&quot;: 5,<br>  &quot;empty_context&quot;: false,<br>  &quot;status&quot;: &quot;ok&quot;<br>}</pre><p>This is not complicated telemetry, but it gives the on-call person something concrete. If chunks drops from 184 to 0 after a flow edit, the bug is probably ingestion. If retrieved is 0 while chunks exist, the bug is probably query construction, metadata filters, or the embedding model mismatch between indexing and search.</p><h3>Where Langflow fits</h3><p>I like Langflow for three use cases:</p><p>1. Fast prototyping with non-platform teammates in the room.</p><p>2. Reproducible demos where the flow JSON is committed.</p><p>3. Internal tools where the graph changes more often than the deployment substrate.</p><p>I would be more cautious with it for high-throughput user-facing traffic. Visual orchestration does not remove the need for retries, rate limits, deployment promotion, and observability. It just changes where those problems appear.</p><p>The fix that actually worked for me was to draw a hard line: Langflow owns workflow composition; the platform owns runtime discipline. Once that boundary is clear, drag-and-drop stops being a toy and becomes one part of a normal deployment process.</p><h4>A Message from AI Mind</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*5Wm7sOfTpe5DEbhg.gif" /></figure><p>Thanks for being a part of our community! Before you go:</p><ul><li>👏 Clap for the story and follow the author 👉</li><li>📰 View more content in the <a href="https://pub.aimind.so/">AI Mind Publication</a></li><li>🧠 Improve your <a href="https://www.aimind.so/prompt-generator?utm_source=pub&amp;utm_medium=message">AI prompts effortlessly and FREE</a></li><li><strong>🧰 Discover </strong><a href="https://www.aimind.so/?utm_source=pub&amp;utm_medium=message"><strong>Intuitive AI Tools</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6b942388a7f" width="1" height="1" alt=""><hr><p><a href="https://pub.aimind.so/what-i-check-before-shipping-a-langflow-rag-workflow-a6b942388a7f">What I Check Before Shipping a Langflow RAG Workflow</a> was originally published in <a href="https://pub.aimind.so/">AI Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Few Notes from Databricks Data + AI Summit 2026: Why the Data Layer Matters Again]]></title>
            <link>https://medium.com/@CarlosMartes/a-few-notes-from-databricks-data-ai-summit-2026-why-the-data-layer-matters-again-f812b027193e?source=rss-08dd210e921f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f812b027193e</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[data-infrastructure]]></category>
            <dc:creator><![CDATA[Carlos Martínez]]></dc:creator>
            <pubDate>Wed, 29 Jul 2026 09:42:39 GMT</pubDate>
            <atom:updated>2026-07-29T09:42:39.020Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0MxEfW6xmv0yhLtD0pdppw.png" /></figure><p>I kept thinking about one ugly failure pattern from a retrieval system I’d reviewed earlier this year: the model looked fine, the embeddings looked fine, and the agent was still confidently answering from stale context. The real problem was not the model at all. It was the data layer, and after Databricks Data + AI Summit 2026, that feels like the part of the stack everyone is forced to look at again.</p><h3>What broke first was not the model</h3><p>Here’s what happened in prod: the application team had built a decent agent loop on top of a lake-backed corpus, with a <a href="https://zilliz.com/learn/vector-index?utm_campaign=mediumkoc">vector index</a> in front and a few governance checks around the edges. On paper, it was clean. In practice, the agent kept pulling the wrong slice of context after upstream documents changed, and the debugging path was miserable because the system could not reconstruct what it had seen at decision time.</p><p>That is the part Databricks is leaning into, and I think the framing is right. The summit talk was not really about one product launch. It was about the fact that when AI goes from demos to production, the data layer stops being plumbing and starts becoming the thing that determines freshness, permissions, lineage, rollback, and cost.</p><p>What surprised me was how little of that is still priced correctly in the market. Compute got repriced fast. Models got repriced even faster. Data did not, mostly because the work is unglamorous: cleaning, deduping, fixing semantics, untangling permissions, and making “real time” mean something more honest than “a job that ran last night.”</p><h3>The real problem was context, not intelligence</h3><p>The summit article makes a point I’ve been seeing in the trenches for a while: when agents fail, the failure is often a context failure, not a reasoning failure.[1] The model can be competent and still answer the wrong question because the retrieval path was stale, the permissions were mismatched, the source changed overnight, or the system quietly optimized for the wrong tradeoff.</p><p>That is why I think the next bottleneck is not “better reasoning” in the abstract. It is <strong>fresh, trusted, cheap, and auditable context</strong> at the moment of decision.</p><p>For the way I build systems, that changes the design target:</p><ul><li>The retrieval layer cannot be treated as a sidecar.</li><li>Governance cannot stop at dataset access.</li><li>Traceability has to cover what was retrieved, ranked, filtered, and written back.</li><li>Rollback has to be part of the operating model, not an incident-response afterthought.</li></ul><p>In a classic data stack, you can sometimes hide bad assumptions behind batch windows. AI agents do not give you that luxury. They run in loops, they call tools, they mutate state, and they make the failure obvious fast.[1]</p><h3>Why I take the Databricks direction seriously</h3><p>I’m skeptical of anything that calls itself an “AI data platform” too early. A lot of products get the story before they get the system. Databricks feels different enough to deserve a real look because the company is still talking like an engineering company, not just a sales machine.</p><p>The summit piece points to a few moves that matter structurally: Lakebase, Lakehouse//RT, data agents, and AI governance.Strip away the naming, and the direction is clear:</p><ul><li>Put transactions closer to the lake.</li><li>Pull real-time analytics back toward the same foundation.</li><li>Push more of the pipeline toward automation.</li><li>Extend governance from “who can query this” to “what can this agent do right now.”</li></ul><p>That is not a cosmetic shift. It is an attempt to make the data layer the place where facts, state, semantics, policy, and action all meet.[1]</p><h3>The part I would still pressure-test</h3><p>I’d still treat the shiny part of the demo and the boring part of production as two different problems.</p><h3>1) Lakebase still has to survive real OLTP behavior</h3><p>Starting from Postgres is a smart adoption move because the ecosystem is huge and the developer friction is low.[1] But the workloads AI systems need are not just “Postgres, but faster.” They include transactions, memory, vectors, multimodal objects, traces, branching, rollback, and very tight tenant isolation.</p><p>The summit article also calls out the hard part I would absolutely put on the critical path: when you move relational systems closer to object storage, you do not get low latency for free. You need a cache layer that is aggressive <em>and</em> correct, and that is one of the hardest production problems in database engineering.</p><p>That is where I’d expect the first operational surprises:</p><ul><li>Cache invalidation under write-heavy workloads</li><li>Read-after-write consistency edge cases</li><li>Hot partitions caused by bursty agent traffic</li><li>Recovery behavior when the cache or metadata path falls over</li></ul><p>If I were putting this into a platform review, I would want to see failure-domain isolation, backpressure behavior, and the exact rollback story before I trusted it with anything user-facing.</p><h3>2) Multimodal data cannot live at the edges forever</h3><p>The article is right that AI applications now consume text, images, audio, video, embeddings, logs, and agent traces.If those assets stay split across object buckets, relational tables, vector stores, and side indexes, the architecture just becomes another pipeline problem with better branding.</p><p>That matters operationally because the system has to support retrieval and governance together. If an agent can reason over a document but not explain why it saw that document, the architecture is incomplete. If the trace exists but cannot be replayed against the original context, the trace is just a screenshot of a failure.</p><h3>3) The default user is no longer human</h3><p>This is the shift I care about most. A human opens a dashboard, reads a result, maybe exports a CSV, and leaves. An agent loops.[1] It retrieves, decides, calls a tool, writes state, checks policy, and repeats. Every step needs auditing, and every step can go wrong.</p><p>That means the database workload changes in a way most teams are still underestimating:</p><ul><li>Query execution is no longer the whole job</li><li>Permission checks move into the live action path</li><li>Deterministic replay becomes a first-class debugging tool</li><li>Cost control has to happen per session or per active compute slice, not only per cluster</li></ul><p>In the data trenches, that is usually where the first production bill shows up.</p><h3>A setup I would actually review before shipping</h3><p>The source article doesn’t give a deployment recipe, so I’ll keep this in pre-production territory. If I were validating an AI data stack built around a lake-native foundation, I would start with a small, explicit workflow that makes the moving parts visible.</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: agent-retrieval-gateway<br>spec:<br>  replicas: 2<br>  selector:<br>    matchLabels:<br>      app: agent-retrieval-gateway<br>  template:<br>    metadata:<br>      labels:<br>        app: agent-retrieval-gateway<br>    spec:<br>      containers:<br>        - name: gateway<br>          image: example/retrieval-gateway:latest<br>          env:<br>            - name: VECTOR_STORE_MODE<br>              value: &quot;hybrid&quot;<br>            - name: TRACE_REPLAY_ENABLED<br>              value: &quot;true&quot;<br>            - name: POLICY_ENFORCEMENT_MODE<br>              value: &quot;runtime&quot;<br>          resources:<br>            requests:<br>              cpu: &quot;500m&quot;<br>              memory: &quot;1Gi&quot;<br>            limits:<br>              cpu: &quot;2&quot;<br>              memory: &quot;4Gi&quot;</pre><p>What I’d be checking before I ship:</p><ol><li>Does the gateway emit a trace for every retrieval step?</li><li>Can I replay the exact context that led to a decision?</li><li>Are runtime policy checks enforced before tool use, not after?</li><li>What happens when the index is stale but the source of truth is fresh?</li><li>Can I isolate one tenant or agent run without impacting the rest of the system?</li></ol><p>The point is not the YAML. The point is that the data layer has to be observable and reversible in the same way the serving layer is.</p><h3>The architecture shift I think is real</h3><p>The summit article makes a strong case that the data system is becoming closer to an operating system for AI: a place where agents read context, make decisions, call tools, write state, and leave behind a trace humans can inspect.[1] That is the part that feels durable.</p><p>A database used to mainly answer one question: how do I run this query correctly and quickly?[1] Now the question is broader: how does an agent get the freshest, most trusted, lowest-cost, and most auditable context at decision time?[1]</p><p>That is not a trivial extension of SQL or dashboards. It changes:</p><ul><li>Storage</li><li>Indexing</li><li>Lineage</li><li>Governance</li><li>Replay</li><li>Isolation</li><li>Resource scheduling</li></ul><p>And once you’re in that world, “AI-native” has to mean more than a chat box on top of data. It has to mean the system understands semantics, policies, and execution paths natively, or it just reintroduces seams in a new place.</p><h3>Where I think the next failures will show up</h3><p>The summit article is careful about the missing pieces, and I agree with that caution.The map is good, but it is not finished.</p><p>The failure modes I’d watch first are familiar ones with a new shape:</p><ul><li><strong>Stale context</strong> disguised as intelligent retrieval</li><li><strong>Cache instability</strong> under real OLTP load</li><li><strong>Permission drift</strong> between human access rules and agent action rules</li><li><strong>Branching complexity</strong> when short-lived agent state becomes the norm</li><li><strong>Replay gaps</strong> when traces don’t capture the full decision chain</li><li><strong>Cost creep</strong> when bursty workloads force always-on compute</li></ul><p>If the stack can solve those well, the rest of the story becomes much easier. If it cannot, the AI layer will keep looking smart right up until it breaks in production.</p><p>The thing I came away with is simple: the next durable advantage in AI infrastructure is not just faster inference or prettier demos. It is a data layer that can prove what happened, recover cleanly, and stay economical while agents run the business around the clock. That is the architecture I would keep building toward, and it is the one I’d want to have on-call for.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f812b027193e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[We Read Claude Code’s Leaked Source. Here’s How Its Memory Actually Works]]></title>
            <link>https://medium.com/@CarlosMartes/we-read-claude-codes-leaked-source-here-s-how-its-memory-actually-works-64d0cfa68913?source=rss-08dd210e921f------2</link>
            <guid isPermaLink="false">https://medium.com/p/64d0cfa68913</guid>
            <dc:creator><![CDATA[Carlos Martínez]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 10:50:00 GMT</pubDate>
            <atom:updated>2026-07-23T10:50:00.155Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6cNOEF7NdJ15xMAex0XrOQ.png" /></figure><p>I’ve untangled enough broken production state to distrust any layer that supposedly “just works.” In distributed systems, the dangerous failure is often the state you assumed would preserve exactly what mattered.</p><p>Claude Code’s leaked source made that issue impossible to ignore. Version 2.1.88 shipped a 59.8 MB source map exposing roughly 512,000 lines of readable TypeScript and substantial detail about the agent’s memory stack.[1] What surprised me was how familiar the architecture looked: local file reliance, hardcoded limits, brittle retrieval, and an execution path that seems reasonable in development until accumulated state begins to decay or contradict itself.</p><p>The interesting story is not that an AI coding agent has memory. It is that “memory” is not one system at all.</p><h3>Memory is four different mechanisms</h3><p>Claude Code’s memory architecture is divided across four operational layers: CLAUDE.md instructions, automatically maintained memory files, active conversation context, and summaries generated during compaction.</p><p>Those layers solve different problems.</p><p>CLAUDE.md provides durable, human-authored instructions. Automatic memory stores observations the agent believes may matter later. The active context contains the current conversation and tool results. Compaction replaces older context with a shorter summary when the session approaches its token budget.</p><p>A checked-in instruction file is inspectable and versioned. An inferred note written by the agent is neither necessarily correct nor current. A conversation turn is detailed but temporary. A compaction summary is persistent within the session but lossy.</p><p>That distinction matters because users tend to interpret remembered information as authoritative regardless of where it came from.</p><h3>CLAUDE.md is the most reliable layer</h3><p>The least magical mechanism is also the strongest: plain Markdown instructions loaded from known locations.</p><p>Claude Code can combine instructions from multiple scopes, including organization-level policy, user-level configuration, project files, and more local directory context. The practical effect is an inheritance tree. Broad rules can apply everywhere, while repository-specific files add build commands, conventions, and architectural constraints.</p><p>A minimal project file might look like this:</p><pre># Project instructions<br><br>- Run `npm test` before proposing a final change.<br>- Use TypeScript strict mode.<br>- Do not edit generated files under `src/generated`.<br>- Database migrations must be backward compatible.</pre><p>This design has real advantages. The file can be reviewed in a pull request, changed alongside the code it describes, and read without specialized tooling. If an instruction is wrong, a developer can identify the exact text responsible.</p><p>Hierarchical instructions also create ordinary configuration problems. Rules may conflict across scopes. A local file may override the intent of a broader one. Old instructions can survive after the repository changes.</p><p>This is not model intelligence. It is configuration management with a language model interpreting the configuration.</p><h3>Automatic memory is local state, not durable truth</h3><p>The more ambitious layer is automatic memory. Claude Code can maintain project-related notes in files under its local configuration area. A primary memory file acts as an index or entry point, while additional topic files can hold details that do not fit comfortably in the main document.</p><p>The leaked implementation reveals the trade-off behind that convenience. The index is bounded, retrieval depends heavily on textual cues, and the files live outside the repository by default. Once the primary file reaches its effective loading limit, information written farther down may still exist on disk without reliably entering the model’s context.</p><p>That creates a particularly nasty operational state: the memory has not been deleted, yet the agent behaves as if it does not exist.</p><h3>Retrieval is closer to search than recollection</h3><p>People hear “agent memory” and imagine a coherent internal model of the project. The implementation is more mechanical.</p><p>The system has to decide which stored notes might matter for the current request. File names, headings, keywords, and model-directed reads all become retrieval signals. If the current prompt uses different vocabulary from the stored note, the relevant information can be missed.</p><p>This is where brittle keyword behavior becomes visible. The system can only reason over memory that reaches the context window. It cannot semantically reconcile a fact it never loaded.</p><p>Topic files reduce prompt size, but they also introduce a routing problem. The primary index must point toward the right detail, or the agent must independently decide to inspect the right file. As the memory directory grows, organization becomes part of correctness.</p><h3>Compaction is lossy compression</h3><p>The active conversation cannot grow forever. Tool output, source files, error logs, and repeated edits consume tokens quickly, so Claude Code eventually compacts the session.</p><p>Compaction summarizes earlier context and continues from the summary rather than preserving every original message verbatim in the active prompt. This keeps long sessions usable, but it necessarily discards information. Exact error strings, rejected hypotheses, nuanced constraints, and the reasons behind decisions can all be reduced to a sentence — or omitted.</p><p>The dangerous part is that the post-compaction conversation still feels continuous. The interface does not suddenly behave like a new process restoring from a partial checkpoint. Yet that is conceptually close to what happened.</p><p>For routine work, that approximation may be sufficient. For a security-sensitive change, losing one negation can reverse a requirement. “Do not rotate this key” and “rotate this key” differ by a tiny token with an enormous blast radius.</p><h3>Automatic notes can preserve mistakes</h3><p>An agent deciding what to remember introduces another failure mode: false facts can outlive the conversation that produced them.</p><p>Suppose Claude misreads a test failure and records that a service requires Node 18. The repository later moves to Node 20, but the note remains. Future sessions may receive the stale statement before examining the current configuration. The memory then acts as a prior, shaping tool choices and explanations.</p><p>Contradictions are not automatically resolved just because newer evidence exists. A checked-in file may say one thing, an automatic note another, and a compaction summary a third. The model must infer which source deserves priority from context, wording, and recency.</p><p>A production-grade memory record would ideally carry its source, creation time, confidence, scope, and invalidation conditions. Plain Markdown is easy to inspect, but it does not enforce any of those fields. The model has to maintain discipline through prose.</p><h3>Project identity is part of the data model</h3><p>Local automatic memory also needs a way to associate stored state with a project. That usually means deriving a project identity from paths or related local metadata.</p><p>Path-based identity is convenient until repositories move, worktrees multiply, containers mount the same code elsewhere, or two clones represent the same project under different directories. Then one conceptual project can accumulate separate memory islands.</p><p>Teams face an additional limitation. Local inferred memory is not automatically a shared institutional record. One developer’s agent may learn a crucial workaround while everyone else starts from zero.</p><p>If knowledge should be consistent across machines and people, it belongs in version-controlled documentation, tests, configuration, or the code itself. Local memory is a cache of convenience, not a replacement for those systems.</p><h3>The hierarchy changes how prompts should be written</h3><p>A rule in CLAUDE.md tends to survive new sessions because it is deliberately reloaded. A fact mentioned only in conversation may disappear after compaction. An automatic note may persist across sessions but fail to surface because it was pushed beyond a loading boundary or stored in a poorly signposted topic file.</p><p>This means repeating a critical requirement during a long session is not necessarily redundant. It can be defensive state management. It also means “remember this” is underspecified. Do you want the fact preserved for the next ten minutes, the next session, every clone of the repository, or every engineer on the team?</p><p>Different answers require different storage mechanisms.</p><h3>How we would operate it safely</h3><p>We would treat Claude Code memory the way we treat any untrusted derived state.</p><p>Critical rules go into a reviewed CLAUDE.md, preferably close to the code they govern. Architectural decisions go into durable documentation. Invariants get tests. Automatic memory is reviewed periodically and deleted when stale.</p><p>We would also restart or compact sessions deliberately instead of waiting for context pressure during the riskiest step of a change. After compaction, we would restate non-negotiable constraints and reopen the files that establish ground truth.</p><p>Most importantly, we would never accept “Claude remembers” as evidence. The evidence is the repository, command output, or an authoritative external system. Memory can guide investigation, but it should not close it.</p><h3>The real lesson is about state</h3><p>The leaked source does not reveal a secret artificial mind accumulating perfect knowledge. It reveals a practical engineering system assembling continuity from files, prompt construction, retrieval heuristics, and lossy summaries.</p><p>Claude Code’s memory works best when treated as a layered cache: useful, local, partially persistent, and always capable of becoming stale. Human-authored instructions provide the strongest control, automatic notes provide convenience, active context provides detail, and compaction keeps the process running by sacrificing fidelity.</p><p>Once you see those boundaries, the agent becomes easier to operate. Put durable truth in durable systems, keep inferred memory small and reviewable, and assume every hidden state layer will eventually drift. The model may feel continuous, but reliable continuity still has to be engineered.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64d0cfa68913" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Notion’s Vector Search Is Excellent. Their Next Problem Is Harder.]]></title>
            <link>https://medium.com/@CarlosMartes/notions-vector-search-is-excellent-their-next-problem-is-harder-d7994064f188?source=rss-08dd210e921f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7994064f188</guid>
            <dc:creator><![CDATA[Carlos Martínez]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 10:43:15 GMT</pubDate>
            <atom:updated>2026-07-23T10:43:15.833Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rvyqV_qjDIuI9ZIBruPH-A.png" /></figure><p>I’ve seen this movie before: the first version of the system works, the team ships, and then the infrastructure tax starts showing up in places nobody budgeted for. Notion’s <a href="https://zilliz.com/learn/vector-similarity-search?utm_campaign=mediumkoc">vector search</a> story reads like a clean first act, but the real problem is what happens after the retrieval layer is “good enough” and the product starts asking for memory, context, and relationship-aware answers at scale.</p><p>Here’s what happened in my head while reading their engineering write-up: the search path is solid, the migrations were disciplined, and the cost curve improved dramatically. But the next bottleneck is not another index tweak. It’s the layer above the index — the part that turns raw embeddings into durable, queryable context across time.</p><h3>The part they already solved</h3><p>Notion launched AI Q&amp;A in November 2023 and immediately ran into the classic “success as an incident” problem: a waitlist of millions of workspaces hit their platform faster than the original vector architecture could absorb it.[Source article] Their first setup used pod clusters with storage and compute bundled together, sharded by workspace ID, which is a perfectly understandable starting point when you need to get something live quickly.[Source article]</p><p>The real problem was that they were paying the scaling penalty of a design that assumed capacity could be planned ahead of demand. Rather than resharding live traffic, they did the pragmatic thing: introduced new index clusters with a generation ID, routed new workspaces to fresh generations, and left older workspaces where they were.[Source article] That bought them time, and with Spark and Airflow tuning they cleared the waitlist in four months while increasing daily onboarding capacity 600x.[Source article]</p><p>That’s the kind of move I respect. It’s not elegant in the academic sense, but it is operationally correct. In the data trenches, the best fix is usually the one that avoids a live migration when the pager is already hot.</p><p>Then they went after the next layer of pain:</p><ul><li>In May 2024, they moved from pod architecture to serverless, decoupling storage and compute and cutting costs 50% immediately.[Source article]</li><li>In late 2024 and early 2025, they moved from that serverless provider to turbopuffer, which required a full re-index because the data lived in a vendor-owned storage system.[Source article]</li><li>In mid-2025, they shipped Page State, hashing every text span with xxHash 64-bit and storing the hashes in DynamoDB so they could detect what really changed before deciding whether to re-embed.[Source article]</li><li>They also moved <a href="https://zilliz.com/glossary/vector-embeddings?utm_campaign=mediumkoc">embedding</a> generation from Spark plus an external API to self-hosted models on Ray via Anyscale, collapsing preprocessing and inference into a single pipeline and removing the S3 handoff between systems.[Source article]</li></ul><p>By the end of that arc, they reported costs down 90% from peak.[Source article] That is not a trivial cleanup job. That is two years of sanding down rough edges that would have killed a less disciplined team.</p><h3>Why this feels familiar</h3><p>What struck me was not just that Notion solved the immediate problem. It was the pattern.</p><p>This is the same sequence big data teams went through for years: start with bundled infrastructure, split storage from compute, move work into ephemeral processing, and then spend the next phase paying down glue-code debt between batch and streaming paths.[Source article] Vector infrastructure is replaying that history because the underlying constraints are the same.</p><p>The storage-compute split is the first obvious win. If a workspace is queried once a month, it should not sit on expensive always-on compute just because the architecture can’t separate “data exists” from “data is being worked on.” That’s the whole logic behind serverless and object-storage-backed indexing.[Source article] The problem is that the bill comes back in another form: cold-start behavior, cache hierarchy, and index reconstruction now define the tail, not your code path.</p><p>The source article points out the obvious physics:</p><ul><li>Object storage adds GETs, deserialization, and reconstruction before a cold index becomes queryable.[Source article]</li><li>For large tenants or returning users, tail latency becomes a product issue, not just an infra issue.[Source article]</li><li>Multi-tier caching changes the shape of that tail in a way single-tier designs usually can’t.[Source article]</li></ul><p>That’s the part teams underestimate. A serverless vector architecture can be the right answer for the first 80% of the workload and still be the wrong answer for the top 5% of tenants that hammer the system all day. If I were reviewing this architecture before shipping, I’d want the fallback story spelled out in plain language: what stays warm, what gets evicted, and what the user sees when the hot path misses.</p><h3>The hidden tax is the split brain</h3><p>Notion’s indexing stack now has the shape I’d expect from a mature AI search system: Spark and Airflow for offline batch, Kafka consumers for real-time updates, Ray for embedding, and a serving layer on top.[Source article] Each piece makes sense on its own. The problem is the seams.</p><p>That’s where the complexity lives:</p><ul><li>Offline logic can improve embeddings, but those improvements do not help online retrieval until they are synchronized back into the serving path.[Source article]</li><li>Real-time updates need a separate path to keep user-facing freshness high.[Source article]</li><li>Page State exists specifically because the batch and online views need explicit consistency tracking.[Source article]</li></ul><p>This is classic Lambda architecture behavior. Fast freshness, yes. Also fragmentation, and the fragmentation cost grows with every new AI feature you add. I’ve lived this in other data systems: once the team needs both “now” and “complete,” they start duplicating state in places they swore they’d never touch again.</p><p>The source article calls out the deeper issue correctly: the flywheel is hard to spin when online and offline signals have to cross a system boundary every time they move.[Source article] That boundary introduces latency, synchronization logic, and another class of failure mode.</p><h3>The thing I would worry about next</h3><p>If I were on call for this stack, I would not worry first about vector similarity itself. I’d worry about the operational cost of making the system more semantic over time.</p><p>The article’s third section is the one I think most teams will eventually land on: vector search alone is not the end state. The next real problem is offline context engineering — memory, precomputed relationships, and feedback loops that continuously improve retrieval before the query even arrives.[Source article]</p><p>That includes work like:</p><ul><li>compressing old conversational memory into denser representations,</li><li>updating stale memory when newer content contradicts older assumptions,</li><li>building semantic topology for a workspace so the system understands how documents relate,</li><li>and feeding retrieval signals back into offline processes so relevance improves over time.[Source article]</li></ul><p>The key point is that these are not query-time hacks. They are batch problems with state, lineage, and versioning. They belong to the part of the stack that knows how to reconcile history with current truth.</p><h3>A practical setup for the next layer</h3><p>If I were building the next version of this system, I’d stop thinking only in terms of vector search and start describing the data flow in terms of <em>capabilities</em>.</p><p>A minimal operational shape might look like this:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: embedding-worker<br>spec:<br>  replicas: 3<br>  template:<br>    spec:<br>      containers:<br>        - name: worker<br>          image: embedding-worker:latest<br>          env:<br>            - name: INPUT_TOPIC<br>              value: page-updates<br>            - name: HASH_TABLE<br>              value: dynamodb-page-state<br>            - name: MODEL_NAME<br>              value: text-embedding-v2<br>          resources:<br>            requests:<br>              cpu: &quot;2&quot;<br>              memory: &quot;8Gi&quot;<br>            limits:<br>              cpu: &quot;4&quot;<br>              memory: &quot;16Gi&quot;</pre><p>That’s not production-ready by itself, but it makes the operating model obvious: consume updates, check page state, decide whether the document needs a full re-embed, and then write back to the serving path. The important part is not the manifest. The important part is that the re-embedding logic stops living in a one-off application workflow and becomes an ordinary data operation.</p><p>If you want to make this dependable, the checklist is boring but necessary:</p><ol><li>Track page-level hashes so unchanged content does not trigger unnecessary embedding work.[Source article]</li><li>Separate real-time freshness from full recomputation so a metadata-only update does not become a full rebuild.[Source article]</li><li>Keep a rollback path for model upgrades, because embedding migrations are never free and often require full re-indexing.[Source article]</li><li>Watch the integration points, not just the model metrics, because most failures happen where batch and online systems meet.</li></ol><h3>Where the next bottleneck actually is</h3><p>The source article makes a strong case that Notion has already executed the “chapter one” infrastructure work for AI Q&amp;A.[Source article] I agree. The harder chapter is not a better <a href="https://zilliz.com/learn/what-is-vector-database?utm_campaign=mediumkoc">vector database</a>. It is a better operating model for vector data.</p><p>That next chapter has three pressure points:</p><ul><li><strong>Cold/hot separation at scale</strong>: good economics until object-storage latency starts dominating the tail.[Source article]</li><li><strong>Offline/online split cost</strong>: every new feature adds more synchronization logic, more state, and more room for drift.[Source article]</li><li><strong>Context engineering</strong>: memory, knowledge graphs, and feedback loops need a durable offline layer, not just retrieval at query time.[Source article]</li></ul><p>What surprised me was how clear the boundary is. Search is not the moat. The moat is the infrastructure that keeps improving what search can say tomorrow.</p><p>Notion did the hard work of making vector retrieval reliable, cheap, and operationally sane. The next problem is harder because it is less visible: building a system that turns usage into durable context without forcing engineers to hand-stitch every new capability across batch, streaming, and serving. That is where the real platform work starts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7994064f188" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making Multimodal RAG Operable for Image Generation Workloads]]></title>
            <link>https://medium.com/@CarlosMartes/making-multimodal-rag-operable-for-image-generation-workloads-c9eaa05d2feb?source=rss-08dd210e921f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9eaa05d2feb</guid>
            <category><![CDATA[multimodal-ai]]></category>
            <category><![CDATA[clip]]></category>
            <dc:creator><![CDATA[Carlos Martínez]]></dc:creator>
            <pubDate>Mon, 13 Jul 2026 07:11:57 GMT</pubDate>
            <atom:updated>2026-07-13T07:11:57.591Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-aYCQE4bAzX8Ss315wMnHw.png" /></figure><p>The real problem was not image generation. The real problem was finding the right visual assets before generation started.</p><p>That is the part that tends to get lost when a new image model goes viral. A model can produce a polished image from a prompt, but production teams do not start with clean prompts and empty context. They have product catalogs, character assets, campaign images, wardrobe renders, packaging photos, style references, and a long list of rules about what can and cannot be used.</p><p>If those assets are not searchable, the generation workflow becomes guesswork.</p><p>The source article uses Nano Banana as the image model example and describes a result taking about 16 seconds for a figurine-style prompt. That number is useful because it reminds me of the shape of the system: generation is already expensive enough. The retrieval step before it has to be reliable and fast.</p><h3>The architecture I would run</h3><p>Architecture described in text:</p><p>• An asset ingestion service receives images from product, design, and content teams.</p><p>• A preprocessing worker normalizes images and extracts metadata.</p><p>• A CLIP-style encoder creates image embeddings and text embeddings in the same space.</p><p>• A vector store indexes the embeddings with ownership, campaign, product, and license metadata.</p><p>• The application retrieves top candidate assets from a text prompt.</p><p>• The generation service uses those assets as grounded references.</p><p>That is <a href="https://zilliz.com/blog/multimodal-rag-expanding-beyond-text-for-smarter-ai?utm_campaign=mediumkoc">Multimodal RAG</a> in a practical form. The retrieval layer does not make the image model creative. It keeps the model connected to the correct assets.</p><h3>Why keyword search fails here</h3><p>In the data trenches, media libraries are messy.</p><p>One team calls an item “red cape.” Another calls it “Lunar drop cloak.” The file name is final_final_v3.png. The product management system uses a SKU. The art team stores the same object in a folder named after an event.</p><p>Keyword search can work when metadata is clean. It breaks when users search by visual meaning:</p><p>• “red silk cape with gold trim”</p><p>• “the blue accessory from last season”</p><p>• “round acrylic base product shot”</p><p>• “winter outfit with silver buttons”</p><p>For that, I want <a href="https://zilliz.com/vector-database-use-cases/image-similarity-search?utm_campaign=mediumkoc">image similarity search</a>, text-to-image retrieval, and metadata filters working together.</p><h3>The source pipeline</h3><p>The article uses CLIP ViT-B/32, which has a 224 image input resolution, a text context length of 77, and a vocabulary size of 49,408 in the printed output. The image embedding dimension for that model is 512.</p><p>Those are not decorative numbers. They determine collection schema, storage size, and index choices.</p><p>If I have 10 million image assets at 512 float32 dimensions, the raw vector payload is roughly:</p><p>10,000,000 assets * 512 dimensions * 4 bytes = about 19.5 GB</p><p>That is before indexes, metadata, replication, and object storage. It is manageable, but it is still infrastructure.</p><h3>A deployment baseline</h3><p>For a small internal pilot, I would keep the system boring:</p><pre>services:<br>  encoder:<br>    image: registry.example.com/asset-encoder:2026-06<br>    environment:<br>      MODEL_NAME: &quot;ViT-B/32&quot;<br>      VECTOR_DIM: &quot;512&quot;<br>      OUTPUT_TOPIC: &quot;asset-embeddings&quot;<br><br>  retrieval-api:<br>    image: registry.example.com/multimodal-retrieval-api:2026-06<br>    environment:<br>      VECTOR_COLLECTION: &quot;production_image_collection&quot;<br>      TOP_K: &quot;3&quot;<br>      MAX_QUERY_MS: &quot;300&quot;</pre><p>The source tutorial retrieves the top 3 semantically similar images. That is a reasonable default for a user-facing feature, but I would keep the value configurable. Creative workflows often need more candidates for review, while automated generation paths need tighter limits.</p><h3>What can go wrong</h3><p>The first failure mode is stale embeddings. If an asset changes but the vector index does not, the retrieval layer returns the wrong visual reference.</p><p>The second failure mode is missing metadata. Similarity search can find “looks like this,” but production systems also need:</p><p>• license status</p><p>• campaign ownership</p><p>• region restrictions</p><p>• product availability</p><p>• asset freshness</p><p>• moderation status</p><p>The third failure mode is prompt drift. Users describe assets loosely, and text-to-image retrieval may return visually similar but operationally invalid assets. This is why metadata filters belong in the retrieval path, not as a manual review step at the end.</p><h3>Where Milvus fits</h3><p>The article uses <a href="https://milvus.io/?utm_campaign=mediumkoc">Milvus</a> as the vector store and creates a collection with COSINE metric and dynamic fields. That is a reasonable shape for a prototype because CLIP embeddings are commonly normalized and compared by cosine similarity.</p><p>In production, I would be more explicit:</p><p>• fixed schema for required metadata</p><p>• dynamic fields only for low-risk exploratory attributes</p><p>• separate collections or partitions for asset classes if query patterns differ</p><p>• index build monitoring</p><p>• ingestion lag alerts</p><p>The vector database is not just a backend component. It is part of the content safety and correctness boundary.</p><h3>The metric I would watch first</h3><p>I would not start by measuring image quality. I would start with retrieval quality.</p><p>My first dashboard:</p><p>• top 3 retrieval acceptance rate from human reviewers</p><p>• p95 retrieval latency</p><p>• embedding worker backlog</p><p>• asset indexing lag</p><p>• filter rejection rate</p><p>• percent of generations using at least one approved retrieved asset</p><p>The 16-second generation example from the source article sets the expectation that generation is not instant. That makes retrieval latency easier to budget, but it does not make retrieval correctness optional. If the wrong outfit or product image gets used, the generated result is unusable no matter how good it looks.</p><p>I would also build a rollback path before opening this to users. If a new encoder model changes nearest-neighbor behavior, I do not want to overwrite the old vectors in place. I want a second collection, a shadow index, and a comparison job that runs the same prompts against both versions. When the acceptance rate and latency look stable, then traffic can move. If reviewers start rejecting results, I can route back to the old collection without rebuilding the whole media pipeline under pressure.</p><h3>The fix that actually works</h3><p>Treat the media library as infrastructure.</p><p>Do not bolt search onto image generation after the demo. Build the ingestion, embedding, indexing, filtering, and observability path first. Then connect the generator.</p><p>That is how I would make multimodal generation boring enough to operate: retrieve the right assets, prove why they were retrieved, and only then ask the model to create the final image.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9eaa05d2feb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>