FDE Times dataFDE jobs open 932▼14 Change in open roles over 7 days, like-for-like: roles from companies we started tracking this week are left outNew in 7 days 62Companies hiring 202Remote-friendly 24%Median US pay $201kTop hirer Databricks 92
中文VI

The newspaper of the Forward Deployed Engineer

Guides

Embeddings can't tell an expired policy from a live one. Dates can

Put a validity window on every chunk, filter by an as-of date and test by date; on versioned documents, naive RAG scored just 58%.

ShareLinkedInFacebookX

In brief

  • An amendment and the version it replaces are near-identical in embedding space, so ranking by similarity alone cannot tell which one is in force.
  • Effective dates belong on every chunk, every query must carry an as-of date, and effective_to should be written as a far-future sentinel.
  • On the VersionQA benchmark, VersionRAG scored 90% against 58% for naive RAG: RAG that cannot tell which version is current gets a lot wrong.
Timeline of a refund policy: version v1 (30 days) is in force until 01/07/2026, followed by v2 (14 days), which runs to the sentinel 9999-12-31. The as-of date 15/06 cites v1; the as-of date 15/07 cites v2.
The validity window is closed at the start and open at the end, so each as-of date lets only one version through the filter. At exactly 00:00 on 01/07 only v2 matches. Source: the article's examples and checks, following Particula Tech's recommendations.

A client shortens its refund window from 30 days to 14, effective July 1, 2026. Both versions of the policy sit in the vector store. An employee asks the chatbot “how long do customers have to request a refund?”, and the chatbot answers 30 days, with a confident citation attached.

The language model is not at fault. Particula Tech points out that an amendment and the version it replaces are almost copies of each other in embedding space, so the expired version can easily rank first. Semantic similarity has no concept of time.

On enterprise RAG projects, this is a failure an FDE is almost certain to meet, because every policy, contract and procedure eventually gets a new version. This guide works through the payload, the filter and the test suite, so the system answers only from the version in force at the time being asked about.

What you will build, and what you need

The end result is a pipeline in three parts: ingestion that attaches a validity window to every chunk, retrieval that filters by an as-of date, and a date-based test suite. You need a vector store (the main example here is Qdrant, with notes on moving to Pinecone and pgvector), a document with at least two versions, and Python for the ingestion code.

Why go to the trouble? On the VersionQA benchmark, the authors of VersionRAG, a published method distinct from the metadata-filtering pipeline described here, measured 90% accuracy, against 58% for naive RAG and 64% for GraphRAG. That gap shows how often version-blind RAG goes wrong on documents that change over time.

Step 1: effective dates belong on the chunk

The most common design mistake is recording effective dates only in a document registry. Particula Tech stresses that effective dates must sit on every chunk, because retrieval filters chunks, not documents. Each chunk therefore needs to carry the full metadata of the version that produced it.

# Simplified: payload for one chunk
SENTINEL = "9999-12-31T23:59:59Z"

def make_payload(doc_id, version, text, effective_from, effective_to=None):
    return {
        "doc_id": doc_id,
        "version": version,
        "status": "effective",
        "effective_from": effective_from,           # RFC 3339
        "effective_to": effective_to or SENTINEL,   # never null
        "text": text,
    }

The line that matters is effective_to or SENTINEL. The current version has no end date yet, and the instinct is to leave the field empty. Particula Tech advises writing an explicit far-future sentinel instead, because in most vector stores a missing key does not match a range condition. In other words, the newest chunk is the one that gets filtered out.

Check: count the chunks whose effective_to is empty or missing. The right number is 0.

Step 2: when a new version arrives, close the old one

On July 1, 2026, v2 is ingested with effective_from = "2026-07-01T00:00:00Z". At the same time, every v1 chunk must have its effective_to updated to that exact timestamp and its status changed to superseded. From then on, v1 has a closed validity window and v2 runs to the sentinel.

Correct metadata alone is no reason to relax. Particula Tech warns that forgetting the filter on a single shared collection is enough for the system to return a superseded clause that still looks like a correct answer.

Their preferred remedy is to move old versions to a separate archive collection. The main collection then holds only versions in force, while the archive keeps expired versions for questions about the past.

Check: query the main collection with no filter at all. If any chunk still has status = superseded, the move to the archive collection is broken.

Step 3: every query carries an as-of date

According to Particula Tech, every query should carry an as-of timestamp, defaulting to the present, and keep only chunks whose validity window contains it. A question such as “back in May, how long did customers have for refunds?” then differs only in the as-of date passed in.

Qdrant supports range conditions on datetime payloads in RFC 3339 format. A must clause is true only when every condition inside it holds, which makes it a good fit for combining status with the validity window. The filter below is simplified:

{
  "must": [
    { "key": "status", "match": { "value": "effective" } },
    { "key": "effective_from", "range": { "lte": "2026-10-26T00:00:00Z" } },
    { "key": "effective_to",   "range": { "gt":  "2026-10-26T00:00:00Z" } }
  ]
}

Note the pairing of lte and gt. The validity window is closed at the start and open at the end, so at exactly 00:00 on July 1 only v2 matches, and both versions can never slip through together.

For questions about the past, drop the status condition, keep the two window conditions with the new as-of date, and search both the main and archive collections. Searching only the archive would return nothing for a date on which the current version was already in force, because that version still lives in the main collection.

Check: set the as-of date to June 15, 2026 and then July 15, 2026, and ask the same question across both collections. The first must cite v1 (30 days), the second v2 (14 days).

What breaks when you switch to Pinecone or pgvector?

Each vector store has its own trap, and it pays to know it before the client demo.

Pinecone offers $gte/$lte operators on metadata, but only for numeric values. Effective dates must therefore be stored as numbers, for example epoch seconds, and the sentinel must be a number too. The example below is simplified:

{
  "status": { "$eq": "effective" },
  "effective_from": { "$lte": 1792972800 },
  "effective_to":   { "$gt":  1792972800 }
}

Here 1792972800 is the epoch for 2026-10-26T00:00:00Z, and the matching sentinel is 253402300799 (9999-12-31T23:59:59Z). Store dates as strings by mistake and the range filter will not behave as expected.

pgvector has a subtler trap. With an approximate index, the WHERE clause is applied only after the index scan finishes. You ask for the top 10, the index returns the 10 nearest chunks, most of them old versions that get filtered out, and fewer than 10 remain.

The pgvector README suggests iterative scans, or a partial index when filtering on a small number of distinct values, which is exactly the case for status = 'effective'. The statement below is illustrative only; check it against the pgvector documentation for the version you run:

CREATE INDEX ON policy_chunks
USING hnsw (embedding vector_cosine_ops)
WHERE status = 'effective';

Check: request the top k and count the rows returned. If you regularly get fewer than k, turn on iterative scans or use a partial index.

Step 4: a date-based test suite is your evidence for the client

Filtering solves only half the problem. The same VersionRAG study found that on questions about detecting implicit changes between versions, the baselines almost completely failed, at 0-10% accuracy, while VersionRAG reached 60%.

The lesson is that a question like “what changed in the refund policy?” stays hard even with clean metadata, so put such questions in the test suite rather than making promises to the client.

A minimal suite consists of triples: question, as-of date, expected version. Include questions before the amendment date, after it, on the exact day of the changeover, and a few about what changed.

Every time you re-ingest or change the embedding model, run the suite in CI and check the version cited, not just the answer text.

Which mistakes break the whole pipeline?

Before taking the system to a client, review the five mistakes covered in the steps above. Each has a quick check.

Mistake Symptom Fix
Effective dates only in the document registry The retrieval filter has nothing to filter on Write effective_from, effective_to and status on every chunk
Empty effective_to on the current version The newest version vanishes from results Backfill with a far-future sentinel
Old and new versions in the same collection One forgotten filter returns an old clause Move old versions to an archive collection
Dates stored as strings in Pinecone The range filter does not filter as expected Store epoch values; the sentinel is a number too
WHERE applied after the approximate index in pgvector Ask for top k, get fewer than k Turn on iterative scans or use a partial index

If there is time to fix only one thing, start with the second row: counting chunks without effective_to takes minutes and blocks the hardest failure to spot.

What does this skill look like on site with a client?

The first job at the client is not code. Ask whoever owns the documents how versions are marked, where effective dates are stored, and who decides that a version has been superseded.

Often the answer lives in file names, in a spreadsheet, or only in the head of one person in the legal department. Step 1 fails if you cannot get it.

If you are applying for applied AI FDE roles, look for job descriptions that mention RAG over internal, compliance or legal documents.

On a CV, rather than writing “built RAG”, describe the specific incident you handled: stopping citations of expired versions, proven with a test suite that uses as-of dates. Recruiters will see that you understand real client data.

Every demo works when the store holds a single version. Your system is truly tested on the day the client issues its first amendment.

Was this article useful?

Use with your AI assistantAsk Claude ↗Ask ChatGPT ↗
5 sources
Read next on the roadmap · Stage 3: Applied AIBuilding an ElevenLabs order agent that never reads the wrong orderThe voice and the prompt are the easy parts; the fragile piece is an API that changes its JSON shape when no order is found.