Preserve the knowledge.
Design the navigation.
Turn text into addressable meaning, build retrieval views over it, and return evidence with enough context to be understood.
Canonical knowledge
Source, atoms, hierarchy, relationships and provenance. Retain stable coordinates and source versions.
Retrieval & context views
A vector points to a target. The embedding input may include context. The evidence returned to the LLM may be larger still.
Keep these distinctions close
A statement is useful meaning, not just a sentence.
Formatting and punctuation are signals. Tables, clauses, abbreviations, quoted replies and OCR artifacts need domain-aware parsing. Preserve exact spans; extracted propositions are derived interpretations, not replacements for source text.
More dimensions do not mean more intelligence.
Vocabulary and grammar define an enormous symbolic possibility space. An embedding learns task-useful relationships among expressions. Ambient dimension is a storage and representation budget; intrinsic dimensionality and retrieval quality depend on the data, task and training. A “thought knot” is a metaphor, not something a single vector preserves faithfully.
Overlap has two different costs.
Overlapping canonical text need not be stored twice. But overlapping embedding inputs repeat computation. Extra sliding windows also create extra vectors; contextual padding of an unchanged set of targets does not itself increase vector count.
A matched padded vector does not prove the target matched.
A standard model pools the entire supplied text. Its nearest neighbor may be attracted by an adjacent statement. Target labels or delimiters do not guarantee target weighting. Compare against target-only vectors or use a model explicitly designed to return a contextualized vector per chunk.
Why this plan?
Open each fork to inspect its alternative. This is an explainable baseline to test, not a universal optimum.
Benchmark before committing
- Build representative queries with known relevant source spans.
- Add paraphrases and hard contrasts: negation, agent/patient swaps, time, exceptions, and quantities.
- Compare segmentation, target-only vs contextual representations, model families and supported dimensions.
- Measure Recall@K, nDCG, boundary misses, neighboring-context false positives, latency and bytes.
- Evaluate end-to-end citation accuracy and answer support on held-out queries.
“Patient denies diabetes” and “No history of diabetes” are not always equivalent. Preserve who asserted a fact, when, and whether it was denied, absent, historical or unknown.
The target has an address.
The context has a budget.
Choose a target statement. Adjacent statements can grow the embedding view, stopping at a section boundary, budget or usefulness limit.
Embedding view
Returned evidence
Fetch the target and useful neighbors from the canonical source after reranking. Merge intersecting ranges; cite original spans. Retrieval expansion is independent of the embedding budget.
Production boundary rules
Do not mix patients, documents, speakers, access scopes or unrelated encounters because there is spare capacity. Linked definitions or antecedents may justify deliberate non-adjacent context; record those references explicitly.
Demo token counts use a rough characters ÷ 4 estimate. Production counts require the model’s tokenizer over the final serialized input, including headings and prompts. Do not silently truncate an oversized atom.
What does the vector cost?
Raw payload only: no ANN graph, metadata, text, replicas or allocator overhead. The sliding-window estimate assumes fixed-size windows over a long corpus. Quantized formats need compatible model/index support and quality testing; arbitrary truncation is not Matryoshka shortening.
How similarity becomes search
cosine(q,x) = (q · x) / (‖q‖ ‖x‖)
For unit-normalized vectors, cosine equals the dot product. Exact scanning costs roughly N × d scalar products. ANN indexes such as HNSW or IVF trade recall, memory and latency to inspect fewer candidates. There is no universal corpus-size threshold for switching.
| Decision | Spend | Test |
|---|---|---|
| More dimensions | More bytes & arithmetic | Retrieval quality gain |
| Smaller / quantized vectors | Possible information loss | Recall and rerank recovery |
| More contextual text | More embedding tokens | Disambiguation vs topic dilution |
| More retrieval views | More vectors & maintenance | Coverage vs redundant results |
Choose a model by task
Compare hosted general-purpose, domain-specific, local/open-weight and chunk-aware contextual models. Evaluate domain/language fit, query/document encoding, privacy, throughput, supported dimensions, quantization, license and operational cost.
Vectors must use compatible model versions, dimension configuration and encoding conventions. Log these with tokenizer, preprocessing, normalization and view versions. Model migration usually requires re-embedding and a separate index.
The page runs on its own model.
Dataset controls update a serializable state. A pure JavaScript function turns that state into a plan and a decision trace. The UI renders those outputs; external JavaScript can drive the same state.
RagModel.derive(state) // pure decision function
RagModel.window(atoms, …) // boundary-aware context view
RagModel.costs(N, d, …) // raw storage & scan estimate
RagAtlas.getState() // current inputs
RagAtlas.setState({ dataset: "legal", sensitive: true })
RagAtlas.getPlan() // outputs + reasoning
// document emits "rag:change" after every state updateImport / edit state
Paste the exported state or full exported plan. Invalid fields are rejected before changing the interface.
Current decision plan
Preserve reproducibility
{
source: { documentId, sourceVersion, contentHash },
target: { unitIds, sourceSpans },
embeddingView: { targetIds, contextIds, viewVersion, inputHash },
embedding: { model, revision, dimensions, dtype, encodingMode },
provenance: { tokenizerVersion, parserVersion, createdAt }
}This is a conceptual record shape, not executable JSON. Offsets must declare their coordinate system (bytes, code points, etc.). Use stable IDs and source versions; rebuild affected views when target or context changes.