ertac.paprat.com
EN

← Writing

AI Tech Blogger and RAG: Start with Evidence, Then Decide What to Say

· 3 min read · English

Rewritten: . Rewritten with AI assistance. Examples and tool references follow the original publication period.

Suppose you want to write about a library’s caching behavior. A release note announces a new option. The reference documentation explains its default. An old tutorial recommends a workaround that the release has made unnecessary.

A language model given only the topic can blend these into one smooth, contradictory paragraph. Retrieval can help by bringing the actual documents into the writing context. It does not remove the need to decide which document applies.

Retrieval-augmented generation, or RAG, combines retrieved material with generation. The 2020 RAG paper introduced a particular formulation of that approach for knowledge-intensive language tasks. In a writing workflow, the useful promise is modest: make relevant evidence available when drafting a claim.

Start with a corpus small enough to inspect

Here is a runnable lexical-retrieval baseline using Python’s standard library. The three documents describe an invented library called CacheBox; they are example data, not real release history.

import re
from datetime import date

documents = [
    {
        "id": "release-2.0",
        "published": date(2024, 8, 1),
        "text": "CacheBox 2.0 adds a cache_enabled option for requests.",
    },
    {
        "id": "reference-2.0",
        "published": date(2024, 8, 1),
        "text": "In CacheBox 2.0, cache_enabled defaults to false.",
    },
    {
        "id": "tutorial-1.0",
        "published": date(2023, 6, 1),
        "text": "CacheBox 1.0 has no cache option; use an external cache.",
    },
]

def tokens(text):
    return set(re.findall(r"[a-z0-9_]+", text.lower()))

def retrieve(query, as_of, limit=2):
    query_tokens = tokens(query)
    scored = [
        (len(query_tokens & tokens(document["text"])), document)
        for document in documents
        if document["published"] <= as_of
    ]
    scored.sort(key=lambda pair: pair[0], reverse=True)
    return [document for score, document in scored if score > 0][:limit]

for document in retrieve("CacheBox 2.0 cache_enabled default", date(2024, 9, 23)):
    print(document["id"], "—", document["text"])

This returns the release and reference entries. It is not semantic search and does not call a generation model. Its limitations are visible: token overlap misses paraphrases, ties depend on input order, and it does not understand version compatibility.

That visibility is useful before adding embeddings or a vector database. We can establish what evidence the writer should receive and construct queries for which the retrieval should succeed or fail.

The writing step needs a contract too

Give the retrieved entries to a model with their identifiers and ask for claims supported by those entries. Require it to say when the material is insufficient. Then check the draft against the entries; an instruction to cite does not guarantee faithful citation.

For this example, the supported claim is that the invented version 2.0 adds an option that defaults to false. “Caching is enabled automatically” contradicts the reference. “The new cache is twice as fast” has no support at all.

Document date and software version are separate filters. An old document can remain authoritative for an old version. A new document can describe behavior irrelevant to the version being discussed. Recording both is more useful than blindly retrieving the newest page.

Retrieval does not supply the point of the article

The sources might justify a short migration note: remove an external workaround only after checking that the new behavior meets the application’s needs. They may not justify a long essay about the future of caching.

This is the editorial decision the pipeline cannot settle merely by retrieving more text. What question does the reader have? Which example would answer it? What remains uncertain? Is there enough new information to publish anything at all?

A useful technical-writing assistant should make unsupported claims conspicuous and source checking cheap. If its main achievement is turning three release notes into eight hundred fluent words, retrieval has improved the packaging more than the article.