<?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 Alex Chen on Medium]]></title>
        <description><![CDATA[Stories by Alex Chen on Medium]]></description>
        <link>https://medium.com/@alexchen3292?source=rss-e3addf5b02b1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*t0poWAR2ObEbG5mHoaciCg.png</url>
            <title>Stories by Alex Chen on Medium</title>
            <link>https://medium.com/@alexchen3292?source=rss-e3addf5b02b1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 15:13:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alexchen3292/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[The Smallest HNSW Encoding Can Hide the Largest Rebuild Bill]]></title>
            <link>https://levelup.gitconnected.com/the-smallest-hnsw-encoding-can-hide-the-largest-rebuild-bill-9e5d817ced8f?source=rss-e3addf5b02b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e5d817ced8f</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[milvus]]></category>
            <category><![CDATA[database-internals]]></category>
            <category><![CDATA[hnsw]]></category>
            <dc:creator><![CDATA[Alex Chen]]></dc:creator>
            <pubDate>Wed, 02 Dec 2026 17:18:34 GMT</pubDate>
            <atom:updated>2026-12-02T17:18:34.785Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*whvRLJqFH_JTToOo" /></figure><p>I want an index comparison to survive the next rebuild. A configuration that searches efficiently after an expensive training phase may still be unsuitable for a collection whose representation changes frequently. The operational cost appears before the first production query, and it returns whenever the index must be replaced.</p><p>The <a href="https://milvus.io/blog/choosing-the-right-hnsw-index-in-milvus.md?utm_campaign=mediumkoc">Milvus HNSW comparison</a> makes that lifecycle visible by examining full-precision HNSW, scalar quantization, product quantization, and product residual quantization. Its measurements cover representation size, recall, throughput, and construction cost. I would use those results to select experiments, rather than choosing an encoding from its theoretical byte count.</p><p>My starting question is where information and work move when compression becomes more aggressive. Some cost disappears from the base vector representation. Some returns through wider search, a retained refinement representation, or more training. Understanding those movements is more useful than describing an index as simply smaller or faster.</p><h3>Separate the encoding from the complete index</h3><p>The source’s 768-dimensional example makes the arithmetic straightforward. Float32 vectors require 3,072 payload bytes each. An eight-bit scalar representation requires 768. A product-quantized representation with 96 subquantizers and eight bits per code requires 96 bytes. Two residual stages with the same code budget require 192 bytes.</p><p>Those numbers describe encodings, not total resident memory. They exclude graph connections, codebooks, metadata, allocator behavior, and any representation retained for refinement. The difference becomes especially important when the base encoding is small enough that graph and refinement storage dominate the budget.</p><p>This local calculation is useful for checking a proposed configuration before running it. It is intentionally limited to payload arithmetic. I would keep it beside measured resident memory and index-file size, rather than presenting its result as a forecast for the whole serving process.</p><pre>dim, m, nbits, nrq = 768, 96, 8, 2<br>assert dim % m == 0<br>payload_bytes = {<br>    &quot;fp32&quot;: dim * 4,<br>    &quot;sq8&quot;: dim,<br>    &quot;pq&quot;: m * nbits / 8,<br>    &quot;prq&quot;: m * nbits * nrq / 8,<br>}<br>print(payload_bytes)</pre><h3>Account for what construction changes</h3><p>Using the same graph parameters does not guarantee the same graph. A different vector representation can change distance comparisons during construction and therefore change which neighbors become connected. Compression affects more than the score assigned to a fixed set of candidates at the end of search.</p><p>That makes a simple experiment valuable: build each candidate from the same frozen data and record the exact encoding and graph settings. Do not mix an index built before a data refresh with another built afterward. The comparison should make it possible to attribute a changed result to a changed configuration.</p><p>The source tested Milvus 2.6.17 with PyMilvus 2.6.15 and fixed graph construction settings. Those version and environment details belong with the measurements. A later release may alter implementation behavior, so reproducing the experiment requires more than copying the index type and assuming the rest of the path stayed constant.</p><h3>Treat refinement as retained data</h3><p>Refinement recomputes distances for a candidate set using another representation. It can improve the final order, but the representation has to be available somewhere. An aggressively compressed base index followed by float32 refinement is not a system that stores only the small compressed codes.</p><p>For a separate trial collection with an existing vector field and no conflicting index, the following configuration uses SQ6 with SQ8 refinement. It follows the parameter structure in the <a href="https://milvus.io/docs/v2.6.x/hnsw-sq.md?utm_campaign=mediumkoc">HNSW_SQ documentation</a>. The collection must already contain suitable data; the code deliberately does not replace a live index.</p><pre>import os<br>from pymilvus import MilvusClient<br><br>client = MilvusClient(uri=os.environ[&quot;MILVUS_URI&quot;],<br>                      token=os.environ[&quot;MILVUS_TOKEN&quot;])<br>collection = &quot;hnsw_sq_trial&quot;<br>index_params = client.prepare_index_params()<br>index_params.add_index(<br>    field_name=&quot;embedding&quot;, index_name=&quot;sq6_refined&quot;,<br>    index_type=&quot;HNSW_SQ&quot;, metric_type=&quot;COSINE&quot;,<br>    params={&quot;M&quot;: 16, &quot;efConstruction&quot;: 200,<br>            &quot;sq_type&quot;: &quot;SQ6&quot;, &quot;refine&quot;: True,<br>            &quot;refine_type&quot;: &quot;SQ8&quot;},<br>)<br>client.create_index(collection_name=collection, index_params=index_params)<br>client.load_collection(collection_name=collection)</pre><p>I would measure this configuration against both a full-precision reference and a simpler SQ8 configuration without refinement. That comparison asks whether a second representation buys enough useful quality to justify its storage and execution cost. It also avoids assuming refinement is mandatory whenever a compressed configuration initially misses a recall target.</p><h3>Distinguish exploration from candidate expansion</h3><p>The search parameter ef controls graph exploration. The refinement multiplier controls how many candidates are requested for the final rescoring stage relative to the requested result count. They address different constraints, and increasing one is not a universal substitute for increasing the other.</p><p>Here is a small parameter sweep using a stored query vector. It demonstrates request construction only. A production evaluation needs a fixed query corpus, exact reference neighbors, repeated runs, concurrency controls, and latency distributions. The printed result count below is not a recall measurement.</p><pre>import json<br>from pathlib import Path<br><br>query = json.loads(Path(&quot;query-vector.json&quot;).read_text())<br>assert len(query) == 768<br>for ef in (256, 512):<br>    for refinement in (1, 2):<br>        result = client.search(<br>            collection_name=collection, anns_field=&quot;embedding&quot;,<br>            data=[query], limit=100,<br>            search_params={&quot;params&quot;: {<br>                &quot;ef&quot;: ef, &quot;refine_k&quot;: refinement,<br>            }},<br>        )<br>        print({&quot;ef&quot;: ef, &quot;refine_k&quot;: refinement,<br>               &quot;returned&quot;: len(result[0])})</pre><p>I would retain the full result IDs for every query. Two configurations with similar average recall may fail on different requests, and the application’s hardest cohort may be hidden in that average. When the index feeds another reranker, evaluate coverage at the actual shortlist size passed downstream rather than substituting a convenient top-ten metric.</p><h3>Put the rebuild inside the capacity plan</h3><p>One result in the source deserves operational attention: its tested PRQ build took approximately 89.6 minutes without refinement, compared with seconds to a few minutes for several SQ and PQ configurations in that environment. This is the authors’ observation, not a timing I reproduced or a fixed property of every PRQ configuration.</p><p>A long build affects more than a maintenance schedule. It can extend the period during which two index versions need capacity, increase the time required to recover from a failed build, and delay an urgent representation change. I would estimate that overlap explicitly instead of budgeting only for the final resident index.</p><p>The <a href="https://github.com/JackLCL/milvus-hnsw-quantization-cohere-1m-experiments?utm_campaign=mediumkoc">experiment repository</a> is useful for inspecting the original setup and results. For a local reproduction, I would separately record training, construction, loading, and warmup. Combining them into one duration can obscure whether the next operational improvement belongs in the encoding, the build pipeline, or the serving infrastructure.</p><h3>Select an index the team can operate</h3><p>My decision record would contain three gates. First, the configuration must meet retrieval quality on the required query cohorts. Second, it must sustain the service’s concurrency and latency targets. Third, its build and replacement process must fit the team’s recovery and update windows. A failure at any gate disqualifies an attractive headline result.</p><p>I would test replacement under constrained spare capacity, including a failed build and a delayed load. The old collection should continue serving until the candidate is validated, with writes and deletions accounted for before routing changes. Encoding efficiency does not remove the need for a controlled replacement procedure.</p><p>Next, I want to compare a wider SQ8 search with SQ6 plus SQ8 refinement under the same rebuild schedule and serving load. The useful outcome is a measured lifecycle cost: how much capacity, time, and operational margin each configuration consumes while delivering the quality the application actually requires.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e5d817ced8f" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/the-smallest-hnsw-encoding-can-hide-the-largest-rebuild-bill-9e5d817ced8f">The Smallest HNSW Encoding Can Hide the Largest Rebuild Bill</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Smaller Vector Index Is Only Useful at the Recall You Need]]></title>
            <link>https://levelup.gitconnected.com/a-smaller-vector-index-is-only-useful-at-the-recall-you-need-457bdcea9614?source=rss-e3addf5b02b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/457bdcea9614</guid>
            <category><![CDATA[vector-search]]></category>
            <category><![CDATA[database-indexing]]></category>
            <category><![CDATA[milvus]]></category>
            <category><![CDATA[database-internals]]></category>
            <category><![CDATA[vector-database]]></category>
            <dc:creator><![CDATA[Alex Chen]]></dc:creator>
            <pubDate>Sun, 29 Nov 2026 21:48:47 GMT</pubDate>
            <atom:updated>2026-11-29T21:48:47.060Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ian7eZNMr-7vXleM" /></figure><p>I would not choose a compressed index from its smallest memory number. The useful question is how much memory it needs while meeting the application’s recall target and latency budget. A configuration that fits comfortably in RAM can still be expensive if serving useful answers requires a much wider search.</p><p>That is the question I would bring to the <a href="https://milvus.io/blog/blog-svs-in-milvus-reshaping-the-recallmemoryspeed-trade-off.md?utm_campaign=mediumkoc">SVS Vamana evaluation in Milvus</a>. The article compares compressed graph indexes across several datasets and operating points. Its results are evidence about that setup, rather than a substitute for measuring another corpus on another machine.</p><p>The interesting engineering idea is to spend fewer bytes on graph traversal, then spend more precision on the candidates that survive. I want to separate that mechanism from the benchmark headline, and turn it into a test that can fail before it becomes a production dependency.</p><h3>Start with an operating point</h3><p>Recall is part of the workload definition. Before measuring throughput, I would fix the query set, the number of requested neighbors, the distance metric, and the exact reference results. Otherwise two runs can produce attractive numbers while answering meaningfully different questions. A faster result at a lower recall target is not a free improvement.</p><p>The source reports a useful example on its Cohere one-million-vector dataset. At 99% recall and top ten, SVS LeanVec reached 7,252 queries per second, compared with 1,590 for HNSW SQ8. Those are the authors’ measurements, taken with 100 client threads on an Intel Xeon 6 setup, using a prerelease Milvus commit. I have not reproduced them here.</p><p>I would record that environment beside the result, then repeat the comparison at the application’s actual concurrency. Queueing, filters, returned payloads, and other processes all change the serving envelope. The target is not the best number an index can produce in isolation; it is the largest sustainable workload that still satisfies the contract.</p><h3>Understand what gets compressed</h3><p>A graph search repeatedly evaluates candidate distances. If every hop touches a wide representation, memory movement can become a large part of the work. LeanVec reduces dimensionality for its primary representation and quantizes it. A second, full-dimensional but still quantized representation supports refinement of the surviving candidates.</p><p>I find that distinction more useful than calling the second representation high precision. It is more faithful than the traversal representation, but it is not an uncompressed float32 copy. Its cost still belongs in the budget. So do graph edges, allocator overhead, scalar fields, replicas, and temporary memory during loading.</p><p>The following calculation is an illustrative payload estimate, not a resident-memory forecast. It assumes a 768-dimensional input, a primary dimension of 256, four bits per primary dimension, and eight bits per secondary dimension. It deliberately excludes graph storage and implementation overhead so the arithmetic remains inspectable.</p><pre>original_dim = 768<br>primary_dim = 256<br>primary_bits = 4<br>secondary_bits = 8<br><br>payload_bytes = (<br>    primary_dim * primary_bits / 8<br>    + original_dim * secondary_bits / 8<br>)<br>fp32_bytes = original_dim * 4<br>print({&quot;payload_bytes&quot;: payload_bytes,<br>       &quot;fp32_bytes&quot;: fp32_bytes,<br>       &quot;payload_ratio&quot;: payload_bytes / fp32_bytes})</pre><h3>Make the build an explicit dependency</h3><p>The source describes an opt-in build with SVS enabled, rather than assuming support in a default container image. I would confirm that requirement against the chosen release and record the resulting image digest before comparing anything. A test configuration that nobody can rebuild is a weak foundation for an operational decision.</p><p>For an existing collection with a compatible vector field, the source’s factory-string approach exposes graph degree, reduced dimension, construction window, and the training mode. This snippet is a configuration example for an SVS-enabled deployment. It assumes the collection already exists, contains representative data, and has no conflicting index on the target field.</p><pre>import os<br>from pymilvus import MilvusClient<br><br>client = MilvusClient(uri=os.environ[&quot;MILVUS_URI&quot;],<br>                      token=os.environ[&quot;MILVUS_TOKEN&quot;])<br>collection = &quot;svs_trial&quot;<br>index = client.prepare_index_params()<br>index.add_index(<br>    field_name=&quot;embedding&quot;,<br>    index_type=&quot;FAISS&quot;,<br>    index_name=&quot;svs_trial_index&quot;,<br>    metric_type=&quot;L2&quot;,<br>    params={<br>        &quot;faiss_index_name&quot;: &quot;SVSVamana64,LeanVec4x8_256&quot;,<br>        &quot;construction_window_size&quot;: 200,<br>        &quot;ood_training&quot;: True,<br>    },<br>)<br>client.create_index(collection_name=collection, index_params=index)<br>client.load_collection(collection_name=collection)</pre><p>I would also keep the training inputs and their provenance. A configuration change that alters training can change build time as well as search behavior. It should be reviewed as a new index artifact, with a separately measured load peak and a known way back to the previous serving configuration.</p><h3>Sweep search effort instead of guessing</h3><p>The <a href="https://milvus.io/docs/search_with_svs_vamana.md?utm_campaign=mediumkoc">SVS index documentation</a> describes the search window and buffer settings. The buffer capacity must accommodate the search window. I would sweep a small set of paired values, keeping data, metric, query vectors, and requested result count fixed. Each run needs its own recall measurement.</p><p>The next fragment reads a real query vector from a local JSON file. It is a smoke-test loop, not a concurrent benchmark. A single query cannot establish throughput, tail latency, or general recall. Its purpose is to make the parameter change visible and to catch an invalid setup before launching a larger evaluation.</p><pre>import json<br>from pathlib import Path<br>from time import perf_counter<br><br>query_vector = json.loads(Path(&quot;query-vector.json&quot;).read_text())<br>assert len(query_vector) == 768<br>for window in (50, 100, 200):<br>    started = perf_counter()<br>    hits = client.search(<br>        collection_name=collection,<br>        anns_field=&quot;embedding&quot;,<br>        data=[query_vector],<br>        limit=10,<br>        search_params={&quot;params&quot;: {<br>            &quot;search_window_size&quot;: window,<br>            &quot;search_buffer_capacity&quot;: window,<br>        }},<br>    )[0]<br>    print(window, len(hits), (perf_counter() - started) * 1000)</pre><p>For the full run, I would preserve per-query results and latencies. An average can hide a hard subset of queries, particularly when indexed documents and user queries follow different distributions. A useful evaluation reports those subsets explicitly, so an improvement on common requests does not conceal a regression on rare ones.</p><h3>Compare capacity at matched quality</h3><p>Throughput per GiB can be a useful secondary measure, but only after the quality and latency requirements pass. I would divide sustainable throughput by the memory actually needed for the serving deployment, and state which components are included. Index-only memory and total process memory answer different budgeting questions.</p><p>The <a href="https://github.com/zilliztech/VectorDBBench?utm_campaign=mediumkoc">VectorDBBench project</a> provides a starting point for repeatable comparisons. I would retain its run configuration along with raw measurements, rather than copying a single chart into a decision document. Repetition matters because loading state and concurrent background work can shift the result.</p><p>I would also measure how capacity changes when one replica is unavailable. A system sized to fit only under its normal replica count may have no useful margin during maintenance. Compression can create headroom, but it does not remove the need to test the degraded configuration and the cost of bringing a replacement online.</p><h3>Keep the index reversible</h3><p>My acceptance criteria would cover more than successful index creation: the agreed recall floor, latency at target load, resident and peak memory, build duration, and recovery behavior. I would keep the original serving path available while a shadow workload evaluates the candidate. No user request should depend on an unmeasured assumption about a factory string.</p><p>The next experiment I would run is a paired sweep of reduced dimension and search window on the hardest query cohort. That should reveal whether a little more representation fidelity saves enough traversal work to justify its memory cost, and whether the result survives realistic filters and payload retrieval.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=457bdcea9614" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/a-smaller-vector-index-is-only-useful-at-the-recall-you-need-457bdcea9614">A Smaller Vector Index Is Only Useful at the Recall You Need</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Before You Index a Video, Decide What a Search Hit Means]]></title>
            <link>https://levelup.gitconnected.com/before-you-index-a-video-decide-what-a-search-hit-means-e24e6ea9a81d?source=rss-e3addf5b02b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e24e6ea9a81d</guid>
            <category><![CDATA[milvus]]></category>
            <category><![CDATA[vector-search]]></category>
            <category><![CDATA[search]]></category>
            <category><![CDATA[data-modeling]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Alex Chen]]></dc:creator>
            <pubDate>Wed, 18 Nov 2026 16:18:32 GMT</pubDate>
            <atom:updated>2026-11-18T16:18:32.086Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*r5krJ2EkF4gbkhQr" /></figure><p>A video search result can be correct and still be useless. Returning the right recording does not tell the viewer where to start watching. Returning an excellent eight-second clip does not necessarily identify the recording that best answers a broader question. I would treat these as different retrieval contracts before choosing an index or tuning a distance metric.</p><p>The same distinction appears in document collections and product catalogs. A passage can explain a document’s relevance, while several passages together establish its usefulness. One photograph can match a visual query, while the product remains the thing the application sells. The schema has to preserve both the parent identity and the evidence that supports it.</p><h3>Separate identity from the unit of relevance</h3><p>The <a href="https://milvus.io/blog/milvus-3-0-structarray.md?utm_campaign=mediumkoc">StructArray engineering article</a> describes a Milvus 3.0 representation that keeps typed elements inside a parent entity. It distinguishes entity-level embedding-list retrieval from element-level retrieval that returns the parent and a matching offset. It also describes predicates whose conditions must hold on the same element.</p><p>That is the source-specific capability I want to examine. The broader design question is what an application promises when it returns a hit. Does it promise a useful document, a useful passage, or a document containing at least one qualifying passage? Those contracts require different relevance judgments. A single benchmark labeled recall can conceal all three.</p><p>I would write the answer shape first. A clip-level response needs a stable recording identifier, a locator for the clip, and enough provenance to reconstruct the evidence. An entity-level response needs a parent score and an explanation policy. It may include representative clips, but those clips are evidence rather than independent results competing for every slot.</p><h3>Correlation is a correctness requirement</h3><p>Consider a synthetic recording with two clips. One shows a kitchen with low confidence. The other shows a street with high confidence. A request for a confidently labeled kitchen should reject the recording. Checking whether any clip is a kitchen and whether any clip has high confidence would accept it incorrectly.</p><p>The following dependency-free example makes the difference explicit. It illustrates predicate semantics rather than a database API, and the values are invented test data.</p><pre>clips = [<br>    {&quot;scene&quot;: &quot;kitchen&quot;, &quot;confidence&quot;: 0.35},<br>    {&quot;scene&quot;: &quot;street&quot;, &quot;confidence&quot;: 0.98},<br>]<br><br>independent = (<br>    any(c[&quot;scene&quot;] == &quot;kitchen&quot; for c in clips)<br>    and any(c[&quot;confidence&quot;] &gt; 0.8 for c in clips)<br>)<br>correlated = any(<br>    c[&quot;scene&quot;] == &quot;kitchen&quot; and c[&quot;confidence&quot;] &gt; 0.8<br>    for c in clips<br>)<br><br>assert independent is True<br>assert correlated is False<br>print({&quot;independent&quot;: independent, &quot;correlated&quot;: correlated})</pre><p>The error is not approximate retrieval. Both computations are exact; they answer different questions. Raising a search budget cannot repair a predicate that combines evidence from unrelated elements. I would keep this fixture in a schema compatibility test because a refactor from objects to parallel arrays can introduce precisely this mistake.</p><h3>Parent diversity needs its own test</h3><p>Suppose one recording has hundreds of similar clips and another has a single excellent match. A flat clip ranking can fill its first page with the first recording. Deduplicating that page afterward may leave very few unique parents. Increasing the requested hit count can help, but it does not establish a general parent-recall guarantee.</p><p>An evaluation should therefore measure unique useful parents alongside useful elements. I would record which parent disappeared during candidate generation, which disappeared during grouping, and which was removed by the final display limit. Without those intermediate sets, a ranking change can look like an embedding regression when it actually changed the grouping budget.</p><p>This is also a product decision. For a surveillance review tool, several adjacent clips from one recording might be useful. For a catalog search page, repeated images of the same product might be frustrating. I would ask the interface owner to define acceptable repetition before implementing a universal deduplication rule in the backend.</p><h3>An offset is meaningful within a version</h3><p>An array position is convenient, but it is not automatically a permanent identifier. If an ingest job inserts a new clip at the beginning, later offsets move. A saved search result that points to offset twelve may now point somewhere else. Stable playback links require a versioned parent or an application-level element identifier.</p><p>I would preserve a source revision, segmentation version, and element locator in the indexing manifest. A result can then resolve against the same revision that produced its vector. This is a proposed application discipline, not a claim that a database automatically coordinates external video assets, clipping tools, or content delivery caches.</p><p>Deletes deserve the same attention. Removing a parent should invalidate its displayed evidence and any cached result pages. Replacing one element should have a documented indexing path. The test should read the changed parent back and query the affected content, rather than treating an acknowledged write as proof that every application cache is current.</p><h3>Compare storage designs through their update paths</h3><p>A parent row with nested elements and separate rows for each element can both represent the data. The operational differences become visible when metadata changes. Repeating parent attributes across every element can make a simple ownership change fan out. Keeping them together can produce larger parent updates. Neither cost should be assumed away.</p><p>Before committing to either design, I would replay a workload containing append-only records, edited elements, parent metadata changes, and complete deletions. Measure bytes written, indexing delay, request size, and retry behavior for each operation. Use the observed element-count distribution; an average hides a small population of unusually large parents that can dominate resource use.</p><p>Memory estimates also need an explicit scope. Raw vectors are only one term. Metadata, graph links, indexing workspace, replicas, and application buffers all consume resources. A compact representation at rest can still create a large transient allocation when an application materializes an entire parent for every hit.</p><h3>Make the evaluation explain a failure</h3><p>My smallest useful test collection would contain single-element parents, multi-element parents, repeated content, contradictory labels, and an updated parent revision. Each test query would specify both the expected parent set and the evidence elements that justify it. I would add empty and missing-value cases only according to the deployed schema’s documented support.</p><p>Then I would separate semantic quality from structural correctness. A poor match can be a model problem. A high-confidence label borrowed from another element is a data-model problem. A playback link pointing to the wrong revision is an identity problem. One aggregate success percentage cannot tell an engineer which layer to fix.</p><p>The <a href="https://milvus.io/docs?utm_campaign=mediumkoc">Milvus documentation</a> is the place to check the exact API and supported types for the deployed release. I would pin the server and SDK together for a reproduction instead of assuming every nested-search example applies to an older collection or client.</p><p>Next, I want to compare parent recall under highly uneven element counts. I would also test how revision-aware result links behave while the same parent is being resegmented and reindexed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e24e6ea9a81d" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/before-you-index-a-video-decide-what-a-search-hit-means-e24e6ea9a81d">Before You Index a Video, Decide What a Search Hit Means</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Fast Regex Filter Starts with Fewer Candidates, Not a Clever Pattern]]></title>
            <link>https://levelup.gitconnected.com/a-fast-regex-filter-starts-with-fewer-candidates-not-a-clever-pattern-eacb18d0298f?source=rss-e3addf5b02b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/eacb18d0298f</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[observability]]></category>
            <category><![CDATA[database-performance]]></category>
            <category><![CDATA[regex]]></category>
            <category><![CDATA[milvus]]></category>
            <dc:creator><![CDATA[Alex Chen]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 16:48:55 GMT</pubDate>
            <atom:updated>2026-11-09T16:48:55.791Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y2_cI2LlWAMPYirq" /></figure><p>When a log search feels slow, the tempting fix is to rewrite the regular expression. Sometimes that is justified. Often the expensive part is that the system is asking the expression to inspect almost every message. I would investigate the number of strings reaching exact verification before treating syntax as the primary performance variable.</p><p>There are two separate questions here: which messages are allowed to match, and how much work is needed to find them? Mixing these questions makes an optimization difficult to review. A shortcut that discards valid messages is not an acceptable speedup, while a perfectly safe shortcut may still cost more than the work it removes.</p><h3>The useful boundary is candidate generation versus verification</h3><p>The <a href="https://milvus.io/blog/milvus-3-0-regex-filtering.md?utm_campaign=mediumkoc">Milvus 3.0 regex design</a> describes RE2-based matching, with NGRAM candidate reduction for patterns whose required literals can be extracted safely. Exact verification still decides the final result. Some pattern classes fall back instead of using that acceleration path.</p><p>That separation gives me a practical review framework. Candidate generation may admit false positives, because verification removes them. It must not discard a true match. A condition that seems intuitively related to the pattern is insufficient; it has to be necessary for every matching string.</p><p>Take a pattern that requires ERROR before timeout. A message containing both words in the opposite order is a reasonable candidate but an invalid final match. A candidate generator does not need to solve ordering. It needs to preserve enough possibilities that the verifier can solve it correctly.</p><h3>Build a correctness fixture before measuring throughput</h3><p>This small Python program demonstrates the two stages with synthetic log messages. Python’s regex engine is used only to make the example runnable; it is not a substitute for testing RE2 syntax and behavior on the target server.</p><pre>import re<br><br>messages = [<br>    &quot;ERROR E1042: checkout timeout&quot;,<br>    &quot;timeout occurred before ERROR was emitted&quot;,<br>    &quot;INFO checkout completed&quot;,<br>    &quot;ERROR connection refused&quot;,<br>]<br>pattern = re.compile(r&quot;ERROR.*timeout&quot;)<br><br>candidates = [<br>    message for message in messages<br>    if &quot;ERROR&quot; in message and &quot;timeout&quot; in message<br>]<br>verified = [message for message in candidates if pattern.search(message)]<br>baseline = [message for message in messages if pattern.search(message)]<br><br>assert verified == baseline<br>assert len(candidates) == 2<br>assert len(verified) == 1<br>print({&quot;candidates&quot;: len(candidates), &quot;matches&quot;: len(verified)})</pre><p>I would extend this fixture with empty strings, case variants, Unicode text, and messages containing line breaks. Anchors and multiline behavior deserve explicit tests rather than assumptions carried over from a command-line tool. The fixture should also include invalid patterns so the application exercises error handling before a user encounters it during an incident.</p><h3>A result count does not explain the workload</h3><p>Imagine two patterns that both return ten messages. One reaches exact verification with twelve candidates; the other reaches it with a million. Their result sizes look identical to the application, yet their execution costs can be very different. Monitoring only returned rows would miss the distinction entirely.</p><p>I would record candidate counts when the available diagnostics expose them, together with elapsed time, CPU, and bytes read. When candidate counts are unavailable, controlled datasets can still reveal the trend. Vary the frequency of required literals while preserving message length and query structure, then compare indexed and unindexed behavior.</p><p>The important experiment changes one factor at a time. Increasing string length, concurrency, and match frequency simultaneously can produce a graph that looks realistic but explains very little. A useful benchmark first isolates the mechanism, then tests whether the same conclusion survives a representative production workload.</p><h3>Start with the cheapest expression that states the requirement</h3><p>If the request is for one exact service name, equality expresses that contract more clearly than a regular expression. If the requirement is a simple prefix, a prefix-capable operation may be easier to audit. Regex becomes useful when the structure itself matters: character classes, ordering, repetition, or alternatives.</p><p>This is not an argument for manually predicting every optimizer decision. It is an argument for readable application intent. Someone responding to an outage should be able to tell whether a filter requests an exact identifier, a substring, or a complete pattern match without reverse-engineering an unnecessarily complicated expression.</p><p>I would also keep user values separate from expression structure. Where the SDK supports filter parameters, those parameters are preferable to assembling syntax through string concatenation. This does not make arbitrary user patterns cheap, so request-size limits, timeouts, and workload controls remain part of the application design.</p><h3>Negative predicates need missing-value tests</h3><p>An application often wants messages that do not contain a particular signature. It is easy to interpret that as every row except the positive matches. Missing values complicate that reasoning. A record without the field may not belong to either the positive or negative set under database null semantics.</p><p>My test cases would name that policy explicitly: reject missing messages, include them through a separate condition, or treat them as ingestion errors. The intended choice belongs in the query contract. It should not emerge accidentally from a client library converting missing values into empty strings during serialization.</p><p>The same concern applies to JSON paths whose value has an unexpected type. A source changing a message from a string to an object can alter filter behavior even when the outer document remains valid JSON. Schema monitoring is therefore relevant to retrieval correctness, not just ingestion hygiene.</p><h3>Indexes have a maintenance cost</h3><p>An index that helps a selective incident query may still be a poor default for every text field. Its build work, storage footprint, ingestion overhead, and cache behavior need to be measured alongside query latency. The operator paying for the index may not be the team submitting the most expensive query.</p><p>I would compare the workload over a full operating cycle: indexing fresh data, serving repeated incident queries, running less selective exploratory searches, and removing expired records. Warm repeated queries alone can flatter an index whose first-query or maintenance behavior matters more to the actual service.</p><p>A rollout should preserve a baseline query corpus and a way to compare returned identifiers. Latency improvements are meaningful only after the result contract survives. If the candidate path and the baseline disagree, I would stop interpreting the performance chart and investigate correctness first.</p><p>For release-specific syntax, the <a href="https://milvus.io/docs?utm_campaign=mediumkoc">Milvus documentation</a> should be checked against the installed server. Next, I want to measure where candidate reduction stops repaying index overhead, especially for common literals under concurrent ingestion.</p><p>There is one final measurement I would keep beside latency: the fraction of requests that use the accelerated path. A fast result on a narrow pattern family does not describe a workload dominated by patterns that cannot be pruned. Report that coverage together with correctness checks and index maintenance cost.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eacb18d0298f" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/a-fast-regex-filter-starts-with-fewer-candidates-not-a-clever-pattern-eacb18d0298f">A Fast Regex Filter Starts with Fewer Candidates, Not a Clever Pattern</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design Tenant Search Around Its Lifecycle, Not Just Its Vector Count]]></title>
            <link>https://medium.com/@alexchen3292/design-tenant-search-around-its-lifecycle-not-just-its-vector-count-baf3724589b3?source=rss-e3addf5b02b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/baf3724589b3</guid>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[milvus]]></category>
            <dc:creator><![CDATA[Alex Chen]]></dc:creator>
            <pubDate>Fri, 06 Nov 2026 10:03:27 GMT</pubDate>
            <atom:updated>2026-11-06T10:03:27.198Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NWDRgpy-WndvYYf1" /></figure><p>A search benchmark can look healthy while the product around it is difficult to operate. Queries finish quickly, yet onboarding a customer takes too long. Deleting a workspace leaves stale retrieval results. A previously inactive project returns slowly on its first request. None of these problems is captured by a single queries-per-second number.</p><p>For a service that hosts many independent customer datasets, I would start the design review with those lifecycle operations. The useful unit of capacity is an active dataset with a particular update rate, access pattern, and recovery requirement. Counting vectors remains necessary, but it does not describe the whole workload.</p><p>The <a href="https://milvus.io/blog/productionizing-semantic-search-how-we-built-and-scaled-vector-infrastructure-at-airtable.md?utm_campaign=mediumkoc">Airtable engineering case study</a> provides a concrete reference. The authors describe using Milvus for semantic retrieval, assigning each base to a partition, and bounding partition counts by spreading bases across collections and clusters. They report that roughly 25% of their stored data was accessed or updated within a week. Those are observations from Airtable’s deployment, not capacity promises for another service.</p><p>The following design exercise asks what an engineering team should measure before adopting any similar layout. It does not reproduce Airtable’s internal implementation or claim a new benchmark.</p><h3>Make the tenant lifecycle explicit</h3><p>Write down the states a dataset can occupy: registered, ingesting, searchable, updating, unloading, deleting, and recovering. Then describe which requests are permitted in each state. A user should not receive a normal empty search response when ingestion has never completed.</p><p>The transition into searchable deserves particular attention. Receiving an ingestion acknowledgment, finishing index construction, loading the required data, and meeting an application’s visibility requirement are separate milestones. Define the milestone your product actually promises, then test it using a known record that a query must find.</p><p>Deletion also needs an observable end condition. A database operation can succeed while an application cache still contains earlier results. Track the deletion through retrieval, caches, generated summaries, and source hydration. Include retries in that process so a partial failure cannot leave an apparently deleted tenant available through another path.</p><h3>Separate placement from authorization</h3><p>Placement answers where a request should run. Authorization answers whether the caller may read the dataset. Combining both decisions in one unchecked client parameter makes a convenient routing interface into a potential access-control problem.</p><p>I would resolve the tenant from an authenticated application context, look up its current placement, and build the database request on the server. Store a placement revision so a request can identify whether it used an obsolete route during migration. An explicit migration state is easier to reason about than two services silently disagreeing about the active collection.</p><p>The <a href="https://milvus.io/docs/use-partition-key.md?utm_campaign=mediumkoc">Milvus partition-key documentation</a> describes hashing field values into a configured set of partitions. Different values can occupy the same physical partition. That mechanism must not be confused with an automatically enforced authorization boundary or a promise of one physical partition per customer.</p><p>Choose the isolation model against your actual requirements. A layout that makes deletion convenient may increase metadata-management work. A shared layout may use resources efficiently while requiring careful filtering and operational accounting. Neither tradeoff can be settled by the names of the features alone.</p><h3>Measure concentration, not only aggregate traffic</h3><p>A cluster-wide average can conceal one dataset that dominates writes or queries. Build a workload inventory that retains tenant-level rates while avoiding sensitive document contents. Include active document count, vector dimensions, update frequency, concurrent requests, and the distribution of result limits.</p><p>This small Python example calculates how concentrated a sample workload is. The numbers are synthetic request counts, not measurements from Airtable or Milvus. It requires only the standard library and performs no database operations.</p><pre>def concentration(counts, largest_n=2):<br>    if largest_n &lt; 1 or any(value &lt; 0 for value in counts.values()):<br>        raise ValueError(&quot;Use positive largest_n and nonnegative counts&quot;)<br>    total = sum(counts.values())<br>    ordered = sorted(counts.items(), key=lambda item: (-item[1], item[0]))<br>    share = sum(value for _, value in ordered[:largest_n]) / total if total else 0.0<br>    return {&quot;total&quot;: total, &quot;largest_share&quot;: share, &quot;largest&quot;: ordered[:largest_n]}<br><br>sample = {&quot;workspace-a&quot;: 700, &quot;workspace-b&quot;: 200, &quot;workspace-c&quot;: 70, &quot;workspace-d&quot;: 30}<br>report = concentration(sample)<br>assert report[&quot;total&quot;] == 1000<br>assert report[&quot;largest_share&quot;] == 0.9<br>print(report)</pre><p>Run the same calculation over writes, query volume, and time spent executing requests. A tenant with few slow queries can consume more capacity than a tenant with many cheap ones. Do not interpret request share as CPU share without measuring the relationship.</p><p>Retain a time dimension as well. A daily total hides a short burst that fills a queue. Placement decisions should consider the period during which tenants compete for resources, rather than assuming their peaks occur at different times.</p><h3>Give inactive data a product contract</h3><p>Before unloading inactive data, define what the next caller experiences. Can the first search wait while data becomes available? Should the UI show preparation progress? Is a timeout preferable to serving an incomplete answer? These choices belong in the service contract.</p><p>I would test synchronized reactivation: many inactive tenants return at once after a scheduled event. That workload can stress storage reads and index loading even when steady-state query capacity looks comfortable. Include the cost of repeatedly loading and unloading datasets near your inactivity threshold.</p><p>A practical policy needs hysteresis. If a dataset is unloaded immediately after a brief idle interval, occasional activity can create repeated work. Measure the load cost and access intervals, then select a threshold based on the latency and resource budget. Keep an override for datasets with contractual availability requirements.</p><h3>Treat source hydration as part of retrieval correctness</h3><p>A search result often contains an identifier that an application resolves against its source database. The index and source can temporarily disagree after an edit. Decide what happens when a hit points to a removed row, a newer revision, or a record whose permissions changed.</p><p>One useful test injects a controlled update between retrieval and hydration. The desired behavior is not necessarily a perfectly synchronized snapshot; it is the behavior the product documents. For example, the application might discard inaccessible rows and report that fewer results are available.</p><p>Version your embedding configuration alongside the content revision. Two indexes with the same dimensions can still use incompatible representations. Migration should specify which query encoder belongs to each searchable index, including the rollback path.</p><h3>Make recovery a separate workload</h3><p>Recovery competes with ordinary traffic for storage, network bandwidth, and compute. Define which datasets return first, how the service reports partial availability, and how much reconstruction work may run concurrently. Test that policy under an intentionally limited resource budget.</p><p>For acceptance, measure onboarding time, time to become searchable, deletion completion, first-query latency after inactivity, and recovery progress alongside steady-state search latency. Keep results grouped by workload class so a healthy average does not hide a broken lifecycle operation.</p><p>The next experiment I would run combines a tenant migration with concurrent updates and permission changes. Passing that test would establish something a fast nearest-neighbor benchmark cannot: that the service still finds the right customer’s current data while its placement changes.</p><p>Editorial disclosure: Prepared for Zilliz’s Medium content program. The engineering case study is attributed to its original authors; the design recommendations and synthetic example are editorial analysis.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baf3724589b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Cut Vector Database Costs by Up to 80%: A Practical Optimization Guide]]></title>
            <link>https://medium.com/everyday-ai/how-to-cut-vector-database-costs-by-up-to-80-a-practical-optimization-guide-e00b096cff54?source=rss-e3addf5b02b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e00b096cff54</guid>
            <dc:creator><![CDATA[Alex Chen]]></dc:creator>
            <pubDate>Tue, 15 Sep 2026 18:09:15 GMT</pubDate>
            <atom:updated>2026-09-15T18:09:15.791Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bODa3CBT-i0u7bLDa5XdYg.png" /></figure><p>In my work building <a href="https://zilliz.com/glossary/semantic-search?utm_campaign=mediumkoc">semantic search</a> engines, I’ve often seen the same pattern emerge: a <a href="https://zilliz.com/learn/what-is-vector-database?utm_campaign=mediumkoc">vector database</a> prototype performs beautifully, then hits production, and suddenly the cloud bill for the vector store skyrockets. I’ve encountered situations where the vector database infrastructure costs can become a significant portion of the overall application spend, sometimes second only to the <a href="https://zilliz.com/glossary/large-language-models-(llms)?utm_campaign=mediumkoc">LLM</a> API calls themselves. This isn’t a problem with the database software itself, which is often open source; it’s about the underlying infrastructure resources it consumes.</p><p>I wanted to understand precisely where these costs originate and, more importantly, how to mitigate them without sacrificing core functionality. My initial analysis, looking at a typical <a href="https://zilliz.com/learn/Retrieval-Augmented-Generation?utm_campaign=mediumkoc">RAG</a> setup with 100 million 768-dimensional float32 vectors, consistently pointed to memory as the dominant cost driver, accounting for 85–90% of the total. Network and storage, while present, are often marginal in comparison. This observation immediately told me that any significant cost optimization effort had to focus squarely on memory usage.</p><h3>Why Vector Search Demands So Much Memory</h3><p>Coming from a traditional database background, where disk-based B-trees and OS page caches efficiently manage large datasets, the memory requirements of <a href="https://zilliz.com/learn/vector-similarity-search?utm_campaign=mediumkoc">vector search</a> can be quite counter-intuitive. Vector indexes, such as <a href="https://zilliz.com/learn/hierarchical-navigable-small-worlds-HNSW?utm_campaign=mediumkoc">HNSW</a> or IVF, are designed for lightning-fast approximate nearest neighbor (ANN) searches. To achieve millisecond-level latencies, these indexes often need to reside predominantly in RAM. The sheer volume of floating-point data and the complex graph or tree structures of these indexes contribute directly to this memory footprint.</p><p>Let’s break down the memory calculation for our hypothetical 100M vector, 768-dimension, float32 dataset:</p><ol><li><strong>Raw Data Size</strong>: 100M vectors * 768 dimensions * 4 bytes/dimension ≈ 307 GB</li><li><strong>HNSW Index Overhead</strong>: A typical HNSW index can add a multiplier of 1.5x to 2.0x. Let’s use 1.8x. 307 GB * 1.8 ≈ 553 GB</li><li><strong>Total with System Overhead</strong>: Accounting for OS overhead, caches, and general headroom, this could easily push the total memory requirement to around 768 GB.</li></ol><p>This means a single collection could require multiple large cloud instances. For example, on AWS, this might translate to three r6i.8xlarge instances (each with 256 GB RAM) to house the data, leading to a substantial monthly compute bill. My goal was to find practical ways to bring this number down.</p><h3>1. Choosing the Right Index: A Significant Lever</h3><p>The single most impactful change I’ve identified for memory reduction is selecting an appropriate <a href="https://zilliz.com/learn/vector-index?utm_campaign=mediumkoc">vector index</a>. This choice alone can lead to a 4–6x difference in memory usage for the same dataset. Many teams, myself included, often gravitate towards HNSW initially due to its reputation for excellent query speed. However, this often comes at a premium.</p><p>I set up an experiment to compare various index types using a representative dataset. My focus was on the trade-offs between memory footprint, query speed, and recall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1s_LptIj3wHwzIvek_YWzw.png" /></figure><p>My observation: switching from HNSW to IVF_SQ8 is often a sweet spot. IVF_SQ8 quantizes float32 values into uint8, achieving roughly 4x compression. In my tests, this typically reduced memory costs by about 70%, with only a 2-3% drop in recall (e.g., from 97% to 94-95%). For many RAG workloads, this trade-off is entirely acceptable and significantly impacts the bottom line.</p><p>Here’s an example of how you might create an IVF_SQ8 index in a vector database like <a href="https://milvus.io/?utm_campaign=mediumkoc">Milvus</a>:</p><pre>from pymilvus import Collection, FieldSchema, CollectionSchema, DataType<br><br># Assume &#39;my_collection&#39; already exists with a &#39;vector&#39; field<br>collection = Collection(&quot;my_collection&quot;)<br><br># Define index parameters for IVF_SQ8<br>index_params = {<br>    &quot;index_type&quot;: &quot;IVF_SQ8&quot;,<br>    &quot;metric_type&quot;: &quot;L2&quot;,<br>    &quot;params&quot;: {&quot;nlist&quot;: 1024} # nlist is a parameter for IVF-based indexes<br>}<br><br># Create the index on the &#39;vector&#39; field<br>collection.create_index(<br>    field_name=&quot;vector&quot;,<br>    index_params=index_params<br>)<br><br>print(&quot;IVF_SQ8 index created successfully.&quot;)</pre><p>If you’re already running HNSW in production and cost is a concern, I strongly recommend creating a test collection with IVF_SQ8 and measuring the recall on your actual query patterns. The results often surprise teams with how little accuracy is lost for such a substantial cost saving.</p><h3>2. Beyond In-Memory: MMap and Tiered Storage</h3><p>Even with an efficient index, keeping <em>all</em> data in memory might be overkill. Not every vector or index segment is accessed with the same frequency. This led me to explore strategies that leverage local disk and object storage more effectively. Two mechanisms, MMap and tiered storage, offer substantial memory reductions, often in the range of 60–80%.</p><p>The core principle behind both is simple: don’t load everything into RAM unless it’s actively needed. The distinction lies in how they manage the data that isn’t resident in memory.</p><h3>MMap (Memory-Mapped Files)</h3><p>MMap works by mapping data files from local disk directly into the process’s address space. The entire dataset still resides on the node’s local disk, but the operating system handles loading specific pages into memory only when they are accessed. Before MMap, all data is typically downloaded from object storage (like S3 or MinIO) to the QueryNode’s local disk.</p><ul><li><strong>Memory Usage</strong>: Drops significantly, often to 10–30% of full-load mode.</li><li><strong>Latency</strong>: Remains stable and predictable because the data is on local disk, avoiding network fetches during queries.</li><li><strong>Trade-off</strong>: The local disk must be large enough to hold the <em>entire</em> dataset. This can still be substantial for very large collections.</li></ul><h3>Tiered Storage</h3><p>Tiered storage takes this concept further by treating the local disk as a cache for “hot” data, with object storage as the primary, authoritative layer. Data is fetched from object storage only when a cache miss occurs.</p><ul><li><strong>Memory Usage</strong>: Can drop to less than 10% of full-load mode.</li><li><strong>Local Disk Usage</strong>: Also drops, as only frequently accessed data is cached (typically 10–30% of the total).</li><li><strong>Trade-off</strong>: Cache misses introduce latency (50–200ms) due to fetching data from object storage over the network.</li></ul><p>Here’s a comparison of the data flow and resource usage:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*61j0pFh_XBJkZ252MB0kwg.png" /></figure><p>Both MMap and tiered storage heavily rely on local disk I/O, so using NVMe SSDs with high IOPS (ideally above 10,000) is crucial for performance.</p><p>For a latency-sensitive application where P99 latency must be under 20ms, MMap is generally preferable because all data is already on local disk. However, if cost is the absolute priority and occasional latency spikes are acceptable, or if your dataset is so large that a single node’s local disk cannot hold it all, then tiered storage becomes the better choice. It’s also superior for workloads with a clear hot/cold data access pattern.</p><p>Configuring MMap in a system like <a href="https://zilliz.com/cloud?utm_campaign=mediumkoc">Zilliz Cloud</a> or self-<a href="https://zilliz.com/cloud?utm_campaign=mediumkoc">managed Milvus</a> involves modifying the milvus.yaml file:</p><pre>queryNode:<br>  mmap:<br>    vectorField: true   # Enable mmap for raw vector data<br>    vectorIndex: true   # Enable mmap for vector index data (major savings)<br>    scalarField: true   # Enable mmap for scalar fields (e.g., metadata)<br>    scalarIndex: true   # Enable mmap for scalar index data<br>    growingMmapEnabled: false # Keep incremental data in memory for new writes</pre><p>This configuration tells the query node to map the specified data types directly from disk. The vectorIndex setting is particularly important as the index often represents the largest memory consumer.</p><h3>3. The Hidden Cost of High-Dimensional Embeddings</h3><p>This optimization is often overlooked but has a linear impact on costs: <a href="https://zilliz.com/glossary/vector-embeddings?utm_campaign=mediumkoc">embedding</a> dimensions. Every increase in dimension directly scales memory, storage, and compute requirements. A 1536-dimensional <a href="https://zilliz.com/blog/choosing-the-right-embedding-model-for-your-data?utm_campaign=mediumkoc">embedding model</a>, for instance, demands roughly 4x more infrastructure than a 384-dimensional model for the same number of vectors.</p><p>Query costs scale similarly. <a href="https://zilliz.com/blog/similarity-metrics-for-vector-search?utm_campaign=mediumkoc">Cosine similarity</a> calculations are O(D), meaning 768-dimensional vectors require about twice the compute of 384-dimensional vectors per query. In high QPS scenarios, this difference directly translates to needing fewer compute nodes.</p><p>My advice here is pragmatic: don’t assume you need the largest embedding model available. Conduct an experiment with a representative sample of your queries (1 million vectors is usually sufficient) and evaluate the lowest-dimension model that still meets your accuracy requirements. I’ve found that many teams discover 768-dimensional embeddings perform just as well as 1536-dimensional ones for their specific use cases, leading to substantial savings.</p><p>If you’re already committed to a high-dimensional model, techniques like PCA (Principal Component Analysis) can reduce dimensions by stripping out redundant features. Matryoshka embeddings also offer a way to truncate to the first N dimensions while largely preserving quality. These are worth exploring before resorting to re-embedding your entire dataset.</p><h3>4. Data Lifecycle Management: Compaction and TTL</h3><p>While not as dramatic as index selection or memory mapping, proper data lifecycle management prevents insidious cost creep. Vector databases often use an append-only storage model. When data is “deleted,” it’s typically marked for deletion rather than immediately removed. Over time, this “dead data” accumulates, wasting storage and forcing queries to scan more irrelevant data.</p><h3>Compaction</h3><p>Compaction is the background process that cleans this up. It merges smaller segments, physically removes deleted data, and rewrites compacted files. This is crucial if you have frequent writes and deletes (e.g., product catalogs, real-time logs) or if your segment count grows uncontrollably.</p><p>A failure mode I’ve observed is when compaction is not properly configured or scheduled. It’s an I/O-intensive operation, and if it competes with high-volume production queries, it can lead to performance degradation. Scheduling it during off-peak hours or carefully tuning its triggers is essential.</p><h3>TTL (Time To Live)</h3><p>For data with a natural expiration, TTL is a cleaner solution than manual deletions. You set a lifetime for your data, and the system automatically marks it for deletion when it expires. Compaction then handles the physical removal. This is particularly useful for logs, session data, or time-sensitive RAG where older documents become less relevant.</p><p>Here’s an example of setting a TTL for a collection:</p><pre>from pymilvus import Collection<br><br>collection = Collection(&quot;my_collection&quot;)<br><br># Set a TTL of 7 days (604800 seconds) for the collection<br># Data older than this will be automatically marked for deletion<br>collection.set_properties({&quot;collection.ttl.seconds&quot;: 604800})<br><br>print(&quot;Collection TTL set to 7 days.&quot;)</pre><p>Together, compaction and TTL ensure your system doesn’t silently accumulate waste, preventing unexpected storage and query performance issues.</p><p>My journey through optimizing vector database costs has reinforced a few key principles: memory is the primary cost driver, and intelligent index selection, combined with smart memory management strategies, offers the most significant leverage. Starting with an IVF_SQ8 index, then exploring MMap or tiered storage, and finally evaluating embedding dimensions and data lifecycle management, provides a clear path to substantial cost reductions. These aren&#39;t &quot;magic bullets&quot; but rather engineering trade-offs that, when understood and applied judiciously, can dramatically improve the operational efficiency of vector search systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e00b096cff54" width="1" height="1" alt=""><hr><p><a href="https://medium.com/everyday-ai/how-to-cut-vector-database-costs-by-up-to-80-a-practical-optimization-guide-e00b096cff54">How to Cut Vector Database Costs by Up to 80%: A Practical Optimization Guide</a> was originally published in <a href="https://medium.com/everyday-ai">Everyday AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Deep Dive into Data Addressing in Storage Systems: From HashMap to HDFS, Kafka, and Iceberg]]></title>
            <link>https://medium.com/@alexchen3292/a-deep-dive-into-data-addressing-in-storage-systems-from-hashmap-to-hdfs-kafka-and-iceberg-c7735365da4e?source=rss-e3addf5b02b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7735365da4e</guid>
            <dc:creator><![CDATA[Alex Chen]]></dc:creator>
            <pubDate>Sun, 30 Aug 2026 13:33:26 GMT</pubDate>
            <atom:updated>2026-08-30T13:33:26.281Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*h9FXttcJHuExmZoURlyAtQ.png" /></figure><p>Last month I spent three days debugging a query that should have taken milliseconds but was hitting 40-second timeouts. The network graphs looked fine — bandwidth wasn’t saturated. CPU utilization hovered around 30%. Disk I/O wasn’t pegged. Yet every lookup triggered thousands of S3 API calls, and the latency kept climbing.</p><p>The real bottleneck wasn’t moving data. It was <em>finding</em> it.</p><p>That investigation led me back to a fundamental question I’d been taking for granted: how do storage systems actually locate data before they read it? The answer — data addressing — turns out to be the dominant cost in most distributed queries, and understanding it explains why some systems scale gracefully while others collapse under their own metadata.</p><p>Data addressing is the process of translating a logical identifier — a key, an offset, a predicate — into the physical location of bytes on storage. At scale, this translation dominates query latency. You can model total cost simply:</p><p><strong>Total addressing cost = metadata accesses + data accesses</strong></p><p>Nearly every storage optimization I’ve studied targets this equation. The techniques vary across systems, but the goal stays constant: locate data with as few high-latency operations as possible.</p><p>In this article I’ll trace that idea from in-memory data structures through distributed file systems and into modern lakehouse engines. I’ll show how HashMap, HDFS, Kafka, <a href="https://milvus.io/?utm_campaign=mediumkoc">Milvus</a>, and Iceberg all solve variations of the same problem — and why object storage forces a complete rethink of addressing strategies.</p><h3>Three Core Addressing Techniques</h3><p>Across every system I’ve examined, most addressing optimizations fall into three patterns:</p><p><strong>Computation</strong> — Derive the data’s location directly from a formula instead of scanning or traversing structures to find it.</p><p><strong>Caching</strong> — Keep frequently accessed metadata or indexes in memory to avoid repeated high-latency reads from disk or remote storage.</p><p><strong>Pruning</strong> — Use range information or partition boundaries to rule out files, shards, or nodes that cannot contain the result.</p><p>Throughout this discussion, an <em>access</em> means any operation with real system-level cost: a disk read, a network call, or an object storage API request. Nanosecond-level CPU computation doesn’t count. What matters is reducing the number of I/O operations — or turning expensive random I/O into cheaper sequential reads.</p><h3>HashMap: The Foundation of Computed Addressing</h3><p>To make addressing concrete, consider the classic Two Sum problem: given an array of integers and a target value, return the indices of two numbers that sum to the target.</p><p>The brute-force approach scans every pair — O(n²). The optimized solution uses a HashMap to replace scanning with direct lookup — O(n). Here’s the key difference:</p><pre>public int[] twoSum(int[] nums, int target) {<br>    Map&lt;Integer, Integer&gt; map = new HashMap&lt;&gt;();<br>    for (int i = 0; i &lt; nums.length; i++) {<br>        int complement = target - nums[i];<br>        if (map.containsKey(complement)) {<br>            return new int[]{map.get(complement), i};<br>        }<br>        map.put(nums[i], i);<br>    }<br>    return null;<br>}</pre><p>Instead of searching for a match, you compute what you need and go directly to its location. Once the location can be derived, traversal disappears.</p><p>A HashMap stores key-value pairs in an array. Given a key, it applies a hash function, calculates an array index, and jumps directly to that slot. No scanning required. Arrays provide constant-time access because of a simple addressing formula:</p><p><strong>element_address = base_address + index × element_size</strong></p><p>Given an index, the memory address is computed with one multiplication and one addition — fixed cost regardless of array size. A linked list, by contrast, must be traversed node by node: O(n) in the worst case.</p><p>This is the simplest form of the principle that drives all the systems in this article: avoid scans by deriving locations through computation.</p><h3>HDFS: In-Memory Metadata at Cluster Scale</h3><p>HDFS is a distributed storage system designed for very large files across clusters of machines. Given a file path and byte offset, it needs to find the right data block and the DataNode that stores it.</p><p>HDFS solves this with a deliberate design choice: keep all filesystem metadata in memory. The NameNode loads the entire filesystem tree — directory structure, file-to-block mappings, and block-to-DataNode mappings — into RAM. Because metadata never touches disk during reads, HDFS resolves all addressing questions through in-memory lookups only.</p><pre>class FSDirectory {<br>    INodeDirectory rootDir;<br>    INodeMap inodeMap;<br>}<br><br>class INodeFile extends INode {<br>    BlockInfo[] blocks;<br>}<br><br>class BlocksMap {<br>    GSet&lt;Block, BlockInfo&gt; blocks;<br>}</pre><p>Consider reading data at the 200 MB offset of /user/data/bigfile.txt, with a default block size of 128 MB. The client sends one RPC to the NameNode. The NameNode resolves the file path and computes that offset 200 MB falls in the second block (128–256 MB range)—entirely in memory. The NameNode returns the DataNodes storing that block, and the client reads directly from the nearest DataNode.</p><p>Total cost: one RPC, a few in-memory lookups, one data read. Metadata never hits disk during this process, and each lookup is constant-time.</p><h3>Kafka: Sparse Indexing and Sequential Layout</h3><p>Kafka is designed for high-throughput message streams. Given a message offset, it needs to locate the exact byte position on disk — without turning reads into random I/O.</p><p>Kafka combines sequential storage with a sparse, in-memory index. Instead of searching through data, it computes an approximate location and performs a small, bounded scan.</p><p>Messages are organized as Topic → Partition → Segment. Each partition is an append-only log split into segments, each consisting of a .log file storing messages sequentially and a .index file acting as a sparse index. The .index file is memory-mapped, so index lookups are served directly from memory without disk I/O.</p><pre>class LocalLog {<br>    ConcurrentNavigableMap&lt;Long, LogSegment&gt; segments;<br>    <br>    LogSegment floorEntry(long offset) {<br>        return segments.floorEntry(offset);<br>    }<br>}<br><br>class LogSegment {<br>    FileRecords log;<br>    LazyIndex&lt;OffsetIndex&gt; offsetIndex;<br>    long baseOffset;<br>}</pre><p>Suppose a consumer reads the message at offset 500,000. Kafka resolves this in three steps: locate the segment via TreeMap lookup, look up position in sparse index via binary search, then perform a sequential read from the log — at most one index interval of about 4 KB.</p><p>Total: one in-memory segment lookup, one index lookup, one short sequential read. No random disk access.</p><p>The key insight: Kafka doesn’t index every message. It indexes approximately every 4 KB of data. This keeps the index small enough to fit in memory while bounding the sequential scan to a predictable, tiny range.</p><h3>Why Object Storage Changes Everything</h3><p>From HashMap to HDFS and Kafka, we’ve seen addressing in memory and in classic distributed storage. As workloads evolve, the requirements keep rising. Modern systems handle multi-field filters, <a href="https://zilliz.com/learn/vector-similarity-search?utm_campaign=mediumkoc">similarity search</a>, and complex predicates — not just simple keys and offsets. Data increasingly lives in S3-compatible stores where each access is an API call with fixed latency on the order of tens of milliseconds — even for a few kilobytes.</p><p>At this point, latency — not bandwidth — is the bottleneck. A single S3 GET request costs around 50 ms regardless of how much data it returns. If a query triggers thousands of such requests, total latency balloons. Minimizing API fan-out becomes the central design constraint.</p><h3>Milvus: From Field-Level to Segment-Level Storage</h3><p>Milvus is a <a href="https://zilliz.com/learn/what-is-vector-database?utm_campaign=mediumkoc">vector database</a> designed for similarity search over embeddings. Its early storage design stored each field separately in binlog files across segments. For a collection with 100 fields, 1,000 segments, and 5 binlog files per field, that’s 500,000 files. Even if a query touches only three fields, that’s 15,000 object storage API calls. At 50 ms per S3 request, serialized latency reaches 750 seconds — over 12 minutes for a single query.</p><p>To fix this, Milvus V2 organizes data by <em>segment</em> instead of by field, consolidating data into segment-based Parquet files. The file count drops from N × fields × binlogs to approximately N (one file group per segment). Fields are grouped by size: small scalar fields stored together, large fields like dense vectors split into dedicated files. All files belong to the same segment, and rows are aligned by index across files. For a query like SELECT id, vector FROM collection WHERE id = 123, the system fetches the segment list, reads Parquet footers to extract row group statistics, then reads only the id column from the small-field file and only the vector column from the large-field file. File counts drop by more than 10×, API calls by over 10×, and query latency falls from minutes to seconds.</p><h3>Iceberg: Metadata-Driven File Pruning</h3><p>Apache Iceberg manages analytical tables over massive datasets in lakehouse systems. When a table spans thousands of data files, the challenge is narrowing a query to just the relevant files — without scanning everything.</p><p>Iceberg’s answer: decide which files to read <em>before </em>any data I/O happens, using layered metadata. Iceberg uses a four-layer architecture: metadata.json points to the current snapshot and manifest lists, manifest lists contain partition-level statistics, manifest files contain file-level statistics (min/max values, row counts), and data files are the actual Parquet files. Each layer filters out irrelevant data before the next is consulted.</p><pre>metadata.json<br>  ↓<br>manifest-list.avro<br>  ↓<br>manifest-xyz.avro<br>  ↓<br>data-abc.parquet</pre><p>Consider: SELECT * FROM orders WHERE date=&#39;2024-01-15&#39; AND amount&gt;1000. Read metadata.json (1 I/O), read the manifest list and apply partition-level filters to skip entire partitions (1 I/O), read manifest files and use file-level statistics to eliminate files that can&#39;t match the query (2 I/O), then read only the three remaining data files (3 I/O). Instead of scanning all 1,000 data files, Iceberg completes the lookup in 7 I/O operations—avoiding over 94% of unnecessary reads.</p><h3>Three Principles Behind Efficient Data Addressing</h3><p><strong>Computation Always Beats Search.</strong> Across every system I’ve examined, the most effective optimization follows the same rule: compute where the data is instead of searching for it. HashMap computes an array index from hash(key) instead of scanning. HDFS computes the target block from a file offset instead of traversing filesystem metadata. Kafka computes the relevant segment and index position instead of scanning the log. Iceberg uses predicates and file-level statistics to compute which files are worth reading. Computation is arithmetic with a fixed cost. Search is traversal—comparisons, pointer chasing, or I/O—and its cost grows with data size.</p><p><strong>Minimize High-Latency Accesses.</strong> This brings us back to the core formula: <strong>Total addressing cost = metadata accesses + data accesses.</strong> Every optimization ultimately aims at reducing these high-latency operations: reduce file counts to limit API fan-out, use statistics to rule out data early, cache metadata in memory, and trade small sequential scans for fewer random reads.</p><p><strong>Statistics Enable Early Decisions.</strong> Recording simple information at write time — min/max values, partition boundaries, row counts — lets systems decide at read time which files are worth reading and which can be skipped entirely. This is a small investment with a large payoff. Statistics turn file access from a blind read into a deliberate choice. Whether it’s Iceberg’s manifest-level pruning or Parquet footer statistics, the principle is the same: a few bytes of metadata at write time can eliminate thousands of I/O operations at read time.</p><h3>Conclusion</h3><p>From Two Sum to HashMap, and from HDFS and Kafka to Milvus and Iceberg, one pattern keeps repeating: performance depends on how efficiently a system locates data. As data grows and storage moves from memory to disk to object storage, the mechanics change — but the core ideas don’t. The best systems compute locations instead of searching, keep metadata close, and use statistics to avoid touching data that doesn’t matter. Every performance win I’ve examined comes from reducing high-latency accesses and narrowing the search space as early as possible. When I finally fixed that 40-second query, the solution wasn’t a bigger instance or more parallelism — it was understanding how the system was addressing data and changing the storage layout so it could compute locations instead of searching for them. Query time dropped to 800 milliseconds. Whether you’re designing a <a href="https://zilliz.com/learn/vector-similarity-search?utm_campaign=mediumkoc">vector search</a> pipeline, building systems over <a href="https://zilliz.com/learn/introduction-to-unstructured-data?utm_campaign=mediumkoc">unstructured data</a>, or optimizing a lakehouse query engine, the same equation applies.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7735365da4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Access Control Guide: How to Configure RBAC for Production]]></title>
            <link>https://levelup.gitconnected.com/access-control-guide-how-to-configure-rbac-for-production-45ef20f6ef50?source=rss-e3addf5b02b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/45ef20f6ef50</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Alex Chen]]></dc:creator>
            <pubDate>Mon, 17 Aug 2026 15:19:11 GMT</pubDate>
            <atom:updated>2026-08-17T15:19:11.352Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*-wgs89348DlinM64H8E2aA.png" /></figure><p>I remember a particularly frustrating incident from a few years back. We were running a new <a href="https://zilliz.com/glossary/semantic-search?utm_campaign=mediumkoc">semantic search</a> service, still in a pre-production environment, and a junior engineer was trying to debug an indexing issue. He ran a cleanup script, intending to clear out some test data, but somehow the connection string got swapped. Before anyone realized, he had dropped a critical collection in our staging environment, wiping out a day’s worth of fresh embeddings. The postmortem was depressingly familiar: everyone was using a shared root account, and there were no granular access controls in place. It was a classic &quot;oops&quot; moment that highlighted a glaring gap in our system design.</p><p>Building <a href="https://zilliz.com/learn/vector-similarity-search?utm_campaign=mediumkoc">vector search</a> systems often leads us to prioritize index performance, throughput, and data scaling. Access control, it seems, is frequently relegated to an afterthought. But as these systems move from prototypes to core components of <a href="https://zilliz.com/learn/Retrieval-Augmented-Generation?utm_campaign=mediumkoc">RAG</a> pipelines and recommendation engines, the question of “who can do what” becomes critical. This is where Role-Based Access Control (RBAC) steps in.</p><h3>Understanding Role-Based Access Control</h3><p>RBAC is a security model that I’ve encountered across various database systems, from PostgreSQL to MongoDB. The core idea is simple: instead of assigning permissions directly to individual users, you group permissions into roles. Users are then assigned one or more roles, and their effective access is the sum of all permissions from their assigned roles.</p><p>The interesting thing here is how RBAC solves a fundamental scaling problem. Imagine managing permissions for dozens of microservices or team members. Granting and revoking individual permissions for each entity quickly becomes a maintenance nightmare. With RBAC, I can define a role once — say, “read-only access to all collections in the default database&quot; – assign it to ten different services, and then update that role in a single place when requirements change. This significantly reduces the operational overhead and the potential for configuration drift.</p><h3>How RBAC is Implemented in Vector Databases</h3><p>In my work with vector databases, I’ve observed that the RBAC model typically revolves around four core concepts:</p><ol><li><strong>Resource:</strong> This is the “thing” being accessed. It could be an entire instance, a specific database, or a particular collection.</li><li><strong>Privilege / Privilege Group:</strong> These define the actions that can be performed, such as Search, Insert, or DropCollection. Privilege groups bundle common actions, like COLL_RO for collection read-only operations.</li><li><strong>Role:</strong> A named set of privileges, scoped to specific resources. For example, a role_read_only might allow searching and querying all collections within the default database.</li><li><strong>User:</strong> This represents an account, which could be a human user or a service account for an application.</li></ol><p>The key takeaway is that access is never assigned directly to users. Users get roles, roles contain privileges, and privileges are scoped to resources. This layered approach ensures consistency and simplifies management.</p><p>When a client request hits the database, it typically goes through a series of checks:</p><ol><li><strong>Authentication:</strong> Is this a valid user with correct credentials?</li><li><strong>Role Check:</strong> Does this user have at least one role assigned?</li><li><strong>Privilege Check:</strong> Does any of the user’s assigned roles grant the requested action on the specific resource?</li></ol><p>If any of these checks fail, the request is rejected. This methodical process ensures that only authorized actions are executed.</p><h3>Enabling Authentication and Configuring RBAC</h3><p>By default, many <a href="https://zilliz.com/learn/what-is-vector-database?utm_campaign=mediumkoc">vector database</a> instances run with authentication disabled. This means any connection has full access, which is fine for local development but a significant security risk in production. The first step is always to enable authentication.</p><p>For an instance deployed via Docker Compose, I’d typically modify the [milvus](https://milvus.io/?utm_campaign=mediumkoc).yaml file:</p><pre>common:<br>  security:<br>    authorizationEnabled: true</pre><p>After enabling authorization and restarting the instance, every connection requires credentials. A default root user with a generic password is usually created. The very next step should be to change this default password. I use the pymilvus client for this:</p><pre>from pymilvus import MilvusClient<br># Connect with the default root account<br>client = MilvusClient(<br>    uri=&#39;http://localhost:19530&#39;,<br>    token=&quot;root:Milvus&quot; # Default password for Milvus<br>)<br># Change the password immediately<br>client.update_password(<br>    user_name=&quot;root&quot;,<br>    old_password=&quot;Milvus&quot;,<br>    new_password=&quot;&lt;your_strong_new_password&gt;&quot;<br>)</pre><p>Once authentication is secured, the typical workflow for configuring RBAC involves these steps:</p><ol><li><strong>Create Users and Roles:</strong> Never let services or team members use the root account. Create dedicated accounts for each user or service. While an admin role might exist, I prefer creating custom roles that precisely match our application&#39;s access patterns.</li></ol><pre>client.create_user(user_name=&quot;rag_writer_service&quot;, password=&quot;&lt;secure_password&gt;&quot;)<br>client.create_user(user_name=&quot;rag_reader_service&quot;, password=&quot;&lt;secure_password&gt;&quot;)<br>client.create_role(role_name=&quot;role_ingestion_rw&quot;)<br>client.create_role(role_name=&quot;role_search_ro&quot;)</pre><ol><li><strong>Grant Privileges to Roles:</strong> This is where granular control comes in. I grant individual privileges or privilege groups to a role, explicitly scoping them to specific resources (e.g., a particular collection or database). The collection_name and db_name parameters are crucial here; using * grants access to all.</li></ol><pre># Grant read/write access to the &#39;embeddings_collection&#39; for the ingestion role<br>client.grant_privilege_v2(<br>    role_name=&quot;role_ingestion_rw&quot;,<br>    privilege=&quot;COLL_RW&quot;, # Built-in privilege group for collection read/write<br>    collection_name=&#39;embeddings_collection&#39;,<br>    db_name=&#39;default&#39;,<br>)<br><br># Grant read-only access to the &#39;embeddings_collection&#39; for the search role<br>client.grant_privilege_v2(<br>    role_name=&quot;role_search_ro&quot;,<br>    privilege=&quot;COLL_RO&quot;, # Built-in privilege group for collection read-only<br>    collection_name=&#39;embeddings_collection&#39;,<br>    db_name=&#39;default&#39;,<br>)</pre><ol><li><strong>Assign Roles to Users:</strong> Finally, I assign the newly created roles to the appropriate users or service accounts. A user can hold multiple roles, and their effective permissions are the union of all assigned roles.</li></ol><h3>Auditing and Revoking Access</h3><p>Configuring access is only half the battle. Knowing what access exists and being able to revoke it efficiently is equally important. Stale permissions, whether from former team members or decommissioned services, silently accumulate and expand the attack surface.</p><p>To audit, I often use the client to describe users and roles:</p><p>Revoking privileges from a role or unassigning a role from a user follows a similar pattern to granting. It’s critical to clean up access promptly when roles change or services are retired. Unused accounts with active permissions are, in my experience, a common vector for unauthorized access because they are valid credentials that no one is actively monitoring.</p><h3>Best Practices for Production Environments</h3><p>Based on my experience, here are some principles that keep access control effective over time:</p><ul><li><strong>Lock Down the Root Account:</strong> Change the default root password immediately. In production, the root account should be used only for emergency operations and stored securely in a secrets manager, never hardcoded.</li><li><strong>Separate Environments Completely:</strong> Relying solely on RBAC to separate development, staging, and production environments is fragile. A single misconfigured connection string can lead to a dev service writing to production. Physical separation (distinct clusters, different credentials) elimiates this class of incident.</li><li><strong>Apply Least Privilege:</strong> This is a fundamental security principle. Give each user and service the absolute minimum access required to perform its function. Start with narrow permissions and only widen them when there’s a specific, documented need. While development environments can be more relaxed, production access should be strictly controlled and regularly reviewed.</li><li><strong>Clean Up Stale Access:</strong> Implement a process to regularly review and revoke access for individuals who have left the team or services that have been decommissioned.</li><li><strong>Scope Privileges to Specific Resources:</strong> Avoid granting collection_name=&#39;*&#39; unless a role genuinely requires access to every collection. In multi-tenant setups or systems with multiple data pipelines, scope each role to only the collections it operates on. This limits the blast radius if credentials are compromised.</li></ul><p>The overhead of authentication and authorization checks in a vector database is generally negligible. It involves in-memory lookups that add microseconds, not milliseconds, to request latency. The security benefits far outweigh this minimal performance impact. Implementing a robust RBAC strategy from the outset is a proactive measure that prevents costly security incidents and ensures the integrity of your vector search applications as they scale.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45ef20f6ef50" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/access-control-guide-how-to-configure-rbac-for-production-45ef20f6ef50">Access Control Guide: How to Configure RBAC for Production</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why ColPali Changes the Document Retrieval Tradeoff]]></title>
            <link>https://medium.com/@alexchen3292/why-colpali-changes-the-document-retrieval-tradeoff-04374f9070e6?source=rss-e3addf5b02b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/04374f9070e6</guid>
            <dc:creator><![CDATA[Alex Chen]]></dc:creator>
            <pubDate>Mon, 10 Aug 2026 07:58:00 GMT</pubDate>
            <atom:updated>2026-08-10T07:58:00.799Z</atom:updated>
            <content:encoded><![CDATA[<p>The interesting thing about ColPali is that it moves document retrieval away from text extraction as the first assumption.</p><p>Most PDF retrieval systems I have worked with start the same way: run OCR, detect layout, split text into chunks, embed the chunks, and hope the chunking step preserved the important evidence. That pipeline is understandable, but it is also brittle. Tables get flattened. Captions detach from figures. Text inside images may disappear. Page layout, which often carries meaning, gets treated as noise.</p><p>ColPali takes a different path. It treats each document page as an image and retrieves from visual page representations directly. That makes it worth studying, even if the storage and compute costs are not trivial.</p><h3>The baseline pipeline loses structure</h3><p>In a standard <a href="https://zilliz.com/learn/Retrieval-Augmented-Generation?utm_campaign=mediumkoc">RAG</a> setup for PDFs, the retrieval path usually looks like this:</p><p>1. Extract text with OCR or a PDF parser.</p><p>2. Detect layout enough to avoid obvious ordering mistakes.</p><p>3. Chunk the extracted text.</p><p>4. Generate one dense vector per chunk.</p><p>5. Search by vector similarity.</p><p>This works for clean reports. It works less well for visually dense documents: scanned forms, financial statements, research papers, invoices, and slides. The problem is not only OCR accuracy. The problem is that the document representation has already thrown away layout before retrieval starts.</p><p>ColPali keeps the page as the unit of representation.</p><h3>What ColPali actually stores</h3><p>The source article describes ColPali as a model built on PaliGemma-3B with a ColBERT-style late interaction strategy. Instead of producing a single dense vector for a page, it produces many vectors.</p><p>The page is rendered as an image. By default, that page is split into a 32 by 32 grid, producing 1024 patches. Each patch becomes a 128-dimensional vector. A text query is also represented as multiple token vectors in the same retrieval space.</p><p>That means a page is not one vector. A page is a small matrix of vectors.</p><p>This is the core tradeoff:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YBaHzyesQbdywcZ56Hw54g.png" /></figure><p>In my experiments with retrieval systems, the hidden cost is often not the model call. It is the representation you commit to storing.</p><h3>Late interaction is the important part</h3><p>ColPali uses a “sum of maximum similarities” scoring method. For each query token vector, it finds the most similar patch vector on the page. Then it sums those best matches into a document score.</p><p>Here is a simplified version of that scoring idea:</p><pre>import numpy as np<br><br>def maxsim_score(query_vectors: np.ndarray, patch_vectors: np.ndarray) -&gt; float:<br>    # query_vectors: [query_tokens, dim]<br>    # patch_vectors: [page_patches, dim]<br>    similarities = query_vectors @ patch_vectors.T<br>    best_patch_per_query_token = similarities.max(axis=1)<br>    return float(best_patch_per_query_token.sum())</pre><p>This is not the full ColPali implementation, but it shows the shape of the computation. A single query token can match whichever page patch is most relevant. The model does not have to compress the entire page into one vector before ranking.</p><p>The benefit is fine-grained matching. The cost is that query-time scoring now depends on the number of query tokens and the number of patch vectors.</p><h3>Why this gets expensive</h3><p>The source article calls out two scaling problems: computational complexity and storage requirements.</p><p>Storage grows with:</p><p>• Number of documents</p><p>• Number of pages per document</p><p>• Number of patches per page</p><p>• Vector dimensionality</p><p>If each page has 1024 patch vectors and each patch vector has 128 dimensions, the representation is much larger than one dense <a href="https://zilliz.com/glossary/vector-embeddings?utm_campaign=mediumkoc">embedding</a> per chunk. The article notes that ColBERT-like approaches can require 10x to 100x more storage than dense vector retrieval.</p><p>That number is not surprising. Multi-vector retrieval buys accuracy by keeping token-level or patch-level evidence around. The bill arrives in storage, memory bandwidth, and scoring time.</p><p>The compute side has a similar shape. The scoring operation compares query token vectors against page patch vectors. More query tokens or higher page resolution means more comparisons. Precision reduction, such as moving from 32-bit floats to 8-bit representations, is a practical optimization path, but it needs measurement. Quantization can reduce cost; it can also change ranking quality.</p><h3>Where I would use it</h3><p>I would not replace every PDF retriever with ColPali. For plain text-heavy documents, ordinary chunk retrieval is easier to operate and cheaper to serve.</p><p>I would consider ColPali when the document itself is visual:</p><p>• Scientific PDFs with equations, figures, and captions</p><p>• Invoices where table position matters</p><p>• Scanned forms</p><p>• Slide decks</p><p>• Product manuals with diagrams</p><p>In those cases, OCR-first retrieval may lose the exact signal the user is asking about.</p><h3>How I would evaluate it</h3><p>The evaluation should separate retrieval quality from generation quality. I would build a test set with page-level labels:</p><p>1. Query text</p><p>2. Relevant document ID</p><p>3. Relevant page number</p><p>4. Optional bounding region or explanation</p><p>Then I would measure retrieval before adding an LLM answer layer:</p><p>• Recall at 5 pages</p><p>• Recall at 10 pages</p><p>• Median and p95 scoring latency</p><p>• Storage per page</p><p>• Index build time per 1,000 pages</p><p>Only after retrieval is measurable would I plug it into a generation pipeline. Otherwise, a good language model can hide a mediocre retriever for too long.</p><h3>The engineering tradeoff</h3><p>ColPali is a good reminder that <a href="https://zilliz.com/learn/what-is-information-retrieval?utm_campaign=mediumkoc">information retrieval</a> is mostly about choosing the right representation.</p><p>If the source signal is text, dense text vectors are often enough. If the source signal is a visual document page, text extraction may be the wrong first step. ColPali keeps visual structure available to the ranker, but the cost profile changes materially.</p><p>What I found was that the design is less “better PDF RAG” and more “different retrieval primitive.” That is a useful distinction. A different primitive deserves a different storage model, a different benchmark, and a different failure analysis.</p><p>Next, I want to test how much precision reduction changes page-level recall on visually dense PDFs, especially when the page count moves from thousands to millions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04374f9070e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How RoboBrain Builds Long-Term Robot Memory]]></title>
            <link>https://medium.com/@alexchen3292/how-robobrain-builds-long-term-robot-memory-acb1b4e50471?source=rss-e3addf5b02b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/acb1b4e50471</guid>
            <category><![CDATA[long-term-thinking]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[robotics]]></category>
            <dc:creator><![CDATA[Alex Chen]]></dc:creator>
            <pubDate>Mon, 10 Aug 2026 07:56:50 GMT</pubDate>
            <atom:updated>2026-08-10T07:56:50.165Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4YxIwrvo_aYZIZnntsXZhQ.png" /></figure><p>A few weeks ago, a colleague working on robot task execution asked me to look at a failure that had nothing to do with inference quality. The robot could navigate, classify objects, and follow voice commands. But in a longer task, it would forget why it had deviated from its path, accept a blurry photo as final evidence, and then repeat the same mistake on the next run. I had spent the previous months building <a href="https://zilliz.com/glossary/semantic-search?utm_campaign=mediumkoc">semantic search</a> infrastructure, so I assumed the problem was retriever accuracy. It wasn’t. The retriever was fine. What was missing was the memory layer connecting planning, execution, and feedback.</p><p>That experience led me to examine how RoboBrain, Senqi AI’s embodied-intelligence operating system, structures long-term robot memory. The architecture is not a <a href="https://zilliz.com/learn/what-is-vector-database?utm_campaign=mediumkoc">vector database</a> bolted onto a robot stack. It is a task loop with three mechanisms: task objectification, tiered memory, and feedback writeback. They only work together.</p><h3>The Three Breakpoints in Robot Task Execution</h3><p>Software tasks can be bounded as input, process, and result. Robot tasks run against a moving physical state: blocked paths, changing light, battery limits, sensor noise, and operator rules. A simple instruction like “go check that area, photograph anything unusual, and notify me” requires planning before the task starts, adapting while it runs, and producing a useful result when it finishes.</p><p>In my experiments with this kind of pipeline, the failures consistently fall into three buckets.</p><p><strong>Task planning.</strong> A phrase like “go take a look” hides a lot of decisions: Which area? What should the robot photograph? What counts as unusual? What should it do if the shot fails? If the task layer cannot resolve those details into concrete fields — target area, inspection object, completion condition, failure policy, and return format — the task runs without direction from the start.</p><p><strong>Context routing.</strong> The robot stack may already contain the right information, but task execution depends on retrieving it at the right stage. Startup needs maps, area definitions, and operating rules. Mid-execution needs live sensor state. Exception handling needs similar cases from prior deployments. When those sources are mixed up, the system makes the right kind of decision with the wrong context.</p><p><strong>Data feedback.</strong> Without writeback, a robot can finish a run without improving the next one. There is no mechanism to decide whether an image is sharp enough, whether a path is still clear, or whether battery level is too low to continue. It executes, stops, and repeats the same failure next time.</p><h3>Task Objectification: Turning Intent into Shared State</h3><p>The first thing that stood out to me in RoboBrain’s design is that task planning is treated as a state problem, not a language problem. Before execution starts, RoboBrain turns each instruction into a task object: task type, target area, inspection object, constraints, expected output, current stage, and failure policy.</p><p>The point is not just parsing language. The point is giving every downstream module the same stateful view of the task.</p><pre> @dataclass<br>class TaskObject:<br>    task_type: str<br>    target_area: str<br>    inspection_object: str<br>    constraints: dict[str, str]<br>    expected_output: str<br>    failure_policy: str<br>    stage: str<br>    event_log: list[tuple[str, str]]<br><br>    def transition(self, event: str, reason: str) -&gt; None:<br>        self.stage = self._next_stage(event)<br>        self.event_log.append((event, reason))</pre><p>For a patrol example, the task object fills in the inspection type, the designated zone, anomalous items as the check object, battery &gt;= 20% as a constraint, a clear anomaly photo plus operator alert as the expected output, and return-to-base as the failure policy.</p><p>The stage field updates as the run changes. An obstacle moves the task from navigating to detouring or requesting_help. A blurry image moves it from inspecting to reshooting. A low battery moves it to terminating and return-to-base. Downstream modules no longer receive isolated commands. They receive the current task stage, its constraints, and the reason the stage changed.</p><h3>Tiered Memory: Routing Context to the Right Stage</h3><p>Task objectification fixes the entry point, but it does not solve retrieval. That is where tiered memory comes in. RoboBrain splits task-relevant information into three tiers so the right data reaches the right stage.</p><p><strong>Real-time state</strong> holds pose, battery, sensor readings, and environmental observations. It supports decisions at every control step.</p><p><strong>Short-term context</strong> records events within the current task: the obstacle the robot avoided two minutes ago, the photo it reshot, or the door it failed to open on the first try. It keeps the system from losing track of what just happened.</p><p><strong>Long-term semantic memory</strong> stores scene knowledge, historical experience, exception cases, and post-task writebacks. A particular parking area may require camera-angle adjustments at night because of reflective surfaces. A certain anomaly type may have a history of false positives and should trigger human review instead of an automatic alert.</p><p>The interesting thing here is that the long-term tier is not keyed by task ID or timestamp. The useful record is often the case that is semantically similar to the current scene, even if the task ID, location name, or wording is different. That makes it a <a href="https://zilliz.com/learn/vector-similarity-search?utm_campaign=mediumkoc">vector search</a> problem.</p><h3>Long-Term Memory as a Semantic Retrieval Problem</h3><p>Some robot memory can be queried by task ID, timestamp, or session metadata. Long-term operational experience usually cannot. None of the stored records — area rule descriptions, anomaly definitions, historical handling records, patrol summaries, experience writebacks — is naturally keyed by a structured field. All of it needs to be recalled by meaning.</p><p>Take a concrete example: a robot patrols a parking lot entrance at night. Glare from overhead lights makes anomaly detection unstable. Reflections keep getting flagged as anomalies. The system needs to recall reshoot strategies that worked under strong nighttime glare, camera-angle corrections from similar areas, and human-review conclusions that marked earlier detections as false positives. An exact-match query can find a known task ID or time window. It cannot reliably surface “the prior glare case that behaved like this one” unless that relationship has already been labeled.</p><p><a href="https://milvus.io/?utm_campaign=mediumkoc">Milvus</a>, for example, exposes filter expressions for scalar constraints and scalar queries for exact lookups. Combined with <a href="https://zilliz.com/glossary/anns?utm_campaign=mediumkoc">approximate nearest neighbor search</a>, that becomes hybrid search: semantic matching for meaning, structured filters for operational constraints.</p><pre>def retrieve_memory(query_embedding: list[float], area: str, task_type: str) -&gt; list[MemoryRecord]:<br>    expr = f&#39;area == &quot;{area}&quot; &amp;&amp; task_type == &quot;{task_type}&quot;&#39;<br>    result = collection.search(<br>        data=[query_embedding],<br>        anns_field=&quot;embedding&quot;,<br>        param={&quot;metric_type&quot;: &quot;COSINE&quot;, &quot;params&quot;: {&quot;ef&quot;: 128}},<br>        limit=10,<br>        expr=expr,<br>        output_fields=[&quot;scene_summary&quot;, &quot;handling_record&quot;, &quot;review&quot;],<br>    )<br>    return [MemoryRecord(**hit.entity) for hit in result[0]]</pre><p>What I found was that the filter layer is often where semantic memory becomes operational. Raw semantic similarity can pull up related cases, but the decision stage needs to constrain the search by area, task type, or time window. Otherwise retrieval is too broad to be trustworthy.</p><p>This pattern resembles retrieval-augmented generation, but adapted for physical-world decision-making rather than text generation. The robot is not retrieving documents to answer a question. It is retrieving prior experience to choose the next safe action.</p><h3>The Feedback Loop</h3><p>The final piece is writeback. RoboBrain writes navigation, perception, and action results back to the task object after each step, updating the stage field. The system reads those observations and decides the next move: detour if the path is unreachable, reshoot if the image is blurry, retry if the door will not open, or terminate if battery is low.</p><p>Execution becomes a cycle: execute, observe, adjust, execute again. The chain keeps adapting to environmental changes instead of cutting off the first time something unexpected shows up.</p><pre>def run_step(task: TaskObject, observation: Observation) -&gt; Action:<br>    if task.is_complete(observation):<br>        return writeback(task, &quot;complete&quot;, observation)<br><br>    if observation.needs_human_review:<br>        return request_takeover(task, observation)<br><br>    similar_cases = retrieve_memory(<br>        observation_embedding(observation),<br>        area=task.target_area,<br>        task_type=task.task_type,<br>    )<br>    return choose_action(task, observation, similar_cases)</pre><p>The writeback is not just an event log. Completed actions go through a quality check: is the image sharp enough, or should the robot reshoot? Is the path still clear, or should it detour? Is the battery above threshold, or should the task terminate? Those conclusions are written back to long-term memory for future runs.</p><p>Not everything goes into the vector database. Task IDs, timestamps, and session metadata live in a relational database. Raw runtime logs live in a logging system. Each storage system handles the query pattern it is built for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U4KkrUX1ILEc9K4Fs5_KQw.png" /></figure><p>As tasks run and scenes accumulate, the long-term memory layer feeds downstream processes: sample curation for model fine-tuning, broader data analysis, and cross-deployment knowledge transfer. The memory compounds into a data asset that gives every future deployment a higher starting point.</p><h3>What This Architecture Changes in Deployment</h3><p>Task objectification, tiered memory, and the feedback loop turn RoboBrain’s task loop into a deployment pattern: each task preserves state, each exception can retrieve prior experience, and each run can improve the next one. A robot patrolling a new building should not start from scratch if it has already handled similar lighting, obstacles, anomaly types, or operator rules elsewhere.</p><p>The deeper lesson is that memory is not just a storage layer. It is part of execution control. The system needs to know what it is doing, what just changed, what similar cases have happened before, and what should be written back for the next run. Retrieval quality matters, but only after the task loop is structured well enough to ask the right questions at the right stage.</p><p>Next, I want to test how this long-term memory tier behaves when multiple robots write feedback concurrently, and whether the same hybrid retrieval pattern holds up across cross-deployment knowledge transfer.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acb1b4e50471" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>