Why Cosine Similarity Loves Repealed Documents
Older policies often use cleaner, simpler phrasing than the complex carve-out amendments that supersede them:
refund-policy-2023.pdf: “All annual plans qualify for a full refund within 30 days.” (Cosine = 0.92)order-form-addendum-2026.pdf: “Notwithstanding Section 4 of the 2023 Terms, annual plans executed after Jan 1, 2026 are non-refundable except for SLA breach.” (Cosine = 0.87)
Without bitemporal validity gates and contradiction surfacing, a single-stage vector DB hands the repealed 0.92 passage to your LLM as Rank #1!
Temporal Modeling Comparison for Regulated & Enterprise RAG
| Temporal Strategy | Handles Retroactive Uploads? | Supports Audit Replay (as_of)? |
Catches Partial Clause Amendments? | Operational Complexity |
|---|---|---|---|---|
| Overwrite / Delete old docs | Loses history | No (destroys compliance trail) | No (amendments need base MSA) | Low, non-compliant |
Filter on file_updated_at |
No (old PDF uploaded today wins!) | No | No | Silently wrong |
PostgreSQL SCD Type-2 (valid_range + sys_range) |
Yes | Yes (@> tstz on both axes) |
Only if manually linked per clause | Medium SQL + ETL discipline |
Voxell Forge --as-of Replay + Coherence /conflicts |
Yes | Yes (--as-of bitemporal audit) |
Yes (GET /v1/answers/{corpus}/conflicts) |
Native (from $199/mo annual) |
Runnable PostgreSQL DDL: True Bitemporal (valid_range + sys_range) Vector Table
Use PostgreSQL tstzrange + btree_gist exclusion constraints so two versions of the same logical_doc_key can never overlap in active business time while preserving immutable point-in-time audit replay:
CREATE EXTENSION IF NOT EXISTS btree_gist;
CREATE EXTENSION IF NOT EXISTS vector;
CREATE TABLE bitemporal_chunks (
chunk_pk BIGSERIAL PRIMARY KEY,
tenant_id UUID NOT NULL,
logical_doc_key TEXT NOT NULL, -- e.g. 'policy:infosec:password-rotation'
chunk_ordinal INT NOT NULL,
valid_range tstzrange NOT NULL, -- Business effective window: [2026-01-01, infinity)
sys_range tstzrange NOT NULL DEFAULT tstzrange(now(), 'infinity', '[)'), -- DB knowledge window
supersedes_pk BIGINT REFERENCES bitemporal_chunks(chunk_pk),
body TEXT NOT NULL,
embedding halfvec(2560) NOT NULL,
-- Prevent overlapping active business windows for the same current chunk in system time
EXCLUDE USING gist (
tenant_id WITH =,
logical_doc_key WITH =,
chunk_ordinal WITH =,
valid_range WITH &&,
sys_range WITH &&
)
);
CREATE INDEX idx_bitemp_gist ON bitemporal_chunks USING gist (tenant_id, valid_range, sys_range);
CREATE INDEX idx_bitemp_hnsw ON bitemporal_chunks USING hnsw (embedding halfvec_cosine_ops);
-- Bitemporal Point-in-Time RAG Query:
-- $1 = query halfvec(2560), $2 = tenant_id, $3 = business_effective_at, $4 = system_known_as_of
SET LOCAL hnsw.iterative_scan = relaxed_order;
SELECT chunk_pk, logical_doc_key, valid_range, body,
1 - (embedding <=> $1::halfvec(2560)) AS cosine_sim
FROM bitemporal_chunks
WHERE tenant_id = $2
AND valid_range @> $3::timestamptz
AND sys_range @> $4::timestamptz
ORDER BY embedding <=> $1::halfvec(2560)
LIMIT 15;
Catching Silent Partial Amendments With Voxell Forge Coherence + --as-of
EXCLUDE USING gist works cleanly when policy-v2 replaces policy-v1 wholesale under the same logical_doc_key. In real legal, M&A, and engineering repositories, Side Letter #3 overrides one paragraph of MSA Section 9 under a completely different filename.
Voxell Forge combines --as-of bitemporal audit replay with Coherence contradiction detection (GET /v1/answers/{corpus}/conflicts and keyless /api/v1/agent/xray) so conflicting effective dates and superseded SLAs are caught deterministically before generation. Test it live right now:
curl -sS -X POST https://api.voxell.ai/api/v1/agent/xray \
-H "Content-Type: application/json" \
-d '{
"documents": [
{"name": "pricing-2025.md", "text": "Effective Jan 1, 2025: Enterprise support carries a $2,500 monthly minimum and 4-hour P1 SLA."},
{"name": "addendum-2026.md", "text": "Effective Jan 1, 2026 (Supersedes 2025 Schedule): Enterprise support carries no separate minimum and a 15-minute P1 SLA."}
]
}'
RAG System Auditability & AI System Audit Frameworks for Financial Services & Healthcare
Regulated financial services (SEC 17a-4, FINRA, SOC 2) and healthcare (HIPAA Security Rule, FDA 21 CFR Part 11, NIST AI RMF, EU AI Act) AI system audit frameworks require deterministic point-in-time replay, verbatim source span attribution, and pre-generation contradiction holds so clinical or compliance agents never blend superseded policy clauses with active rules. Query pre-verified compliance corpora directly via the Verified Model Context Protocol (MCP) Compliance Atlas (/atlas/) (hipaa-security-rule, nist-ai-rmf, soc2-trust-criteria, eu-ai-act), or enforce --as-of bitemporal audit trails on Scale ($499/mo annual) and air-gapped Forge Local Sovereign VPC ($29,995/yr Production).
Explore RAG Contradiction Detection Benchmarks, model storage growth in the Vector RAM & TCO Calculator, or open the Forge Console (v4.0 Pricing).