Production PostgreSQL DDL + Single-Query RRF (k = 60)
When running OpenAI text-embedding-3-large or Google gemini-embedding-001 in PostgreSQL, add a generated tsvector column using the 'simple' configuration (so exact identifiers like ERR_SSL_VERSION_OR_CIPHER_MISMATCH, CVE-2026-4412, and not are never stemmed away) indexed with GIN, alongside your halfvec HNSW index:
CREATE TABLE kb_passages (
id BIGSERIAL PRIMARY KEY,
tenant_id UUID NOT NULL,
title TEXT NOT NULL,
body TEXT NOT NULL,
embedding halfvec(3072) NOT NULL,
-- Weight 'A' on title + 'B' on body using 'simple' to preserve exact SKUs, CVEs, and 'not'
lex_tsv tsvector GENERATED ALWAYS AS (
setweight(to_tsvector('simple', coalesce(title, '')), 'A') ||
setweight(to_tsvector('simple', coalesce(body, '')), 'B')
) STORED
);
CREATE INDEX idx_kb_hnsw ON kb_passages USING hnsw (embedding halfvec_cosine_ops) WITH (m = 16, ef_construction = 128);
CREATE INDEX idx_kb_gin ON kb_passages USING gin (lex_tsv);
-- Single-roundtrip Hybrid RRF (k = 60) fusing Top-50 Dense + Top-50 Lexical
WITH dense_hits AS (
SELECT id, ROW_NUMBER() OVER (ORDER BY embedding <=> $1::halfvec(3072)) AS r_dense
FROM kb_passages
WHERE tenant_id = $2
ORDER BY embedding <=> $1::halfvec(3072)
LIMIT 50
),
lexical_hits AS (
SELECT id,
ROW_NUMBER() OVER (
ORDER BY ts_rank_cd(lex_tsv, websearch_to_tsquery('simple', $3), 32) DESC
) AS r_lex
FROM kb_passages
WHERE tenant_id = $2
AND lex_tsv @@ websearch_to_tsquery('simple', $3)
ORDER BY ts_rank_cd(lex_tsv, websearch_to_tsquery('simple', $3), 32) DESC
LIMIT 50
),
rrf_fused AS (
SELECT COALESCE(d.id, l.id) AS id,
COALESCE(1.0 / (60 + d.r_dense), 0.0) +
COALESCE(1.0 / (60 + l.r_lex), 0.0) AS rrf_score,
d.r_dense,
l.r_lex
FROM dense_hits d
FULL OUTER JOIN lexical_hits l USING (id)
ORDER BY rrf_score DESC
LIMIT 15
)
SELECT p.id, p.title, p.body, f.rrf_score, f.r_dense, f.r_lex
FROM rrf_fused f
JOIN kb_passages p USING (id)
ORDER BY f.rrf_score DESC;
Where RRF (k = 60) Hits Its Ceiling vs Stage-2 Neural Reranking
RRF is a heuristic rank blender, not a semantic verifier. On technical support, security advisory, and engineering documentation corpora:
| Retrieval Pipeline | Exact SKU / CVE Recall@20 |
Strict@1 Precision |
End-to-End nDCG@10 |
Per-Query Rerank Meter |
|---|---|---|---|---|
Dense Only (text-embedding-3-large halfvec(3072)) |
64.2% |
48.7% |
0.639 |
$0 |
Lexical Only (Postgres tsvector + ts_rank_cd) |
89.5% (misses synonyms) |
43.1% |
0.574 |
$0 |
Postgres Hybrid RRF (k = 60, Dense + tsvector) |
95.8% |
58.4% |
0.712 |
$0 (2x index RAM/IO) |
Hybrid RRF Top-50 + External Reranker API ($2/1k) |
95.8% |
72.6% |
0.848 |
$2.00 / 1,000 queries |
Voxell Forge (C_corpus + 64b AMQ + Max Reranker) |
99.04% Stage-1 Recall |
75.93% Strict@1 |
0.8849 nDCG@10 |
Bundled (from $199/mo annual) |
Why does RRF stall at 58.4% Strict@1? Suppose an index page lists "Patched CVEs: CVE-2026-4412, CVE-2026-4413..." four times without remediation steps, while the actual kernel hotfix runbook mentions CVE-2026-4412 once. ts_rank_cd puts the useless changelog list at r_lex = 1, boosting its RRF score above the runbook!
Verify Neural Reranking Over Exact Identifiers Live (Zero Key)
Voxell Forge fuses Play 1 64-bit CUDA AMQ membership filtering, C_corpus dense retrieval (99.04% Recall@20), and Stage-2 Max cross-encoder reranking (0.8849 nDCG@10, 75.93% Strict@1) on one bill with zero $2/1k-query Cohere tax. Run an identifier-collision test right now:
curl -sS -X POST https://api.voxell.ai/api/v1/agent/bakeoff \
-H "Content-Type: application/json" \
-d '{
"documents": [
{"name": "changelog-index.md", "text": "Index of Q4 advisories: CVE-2026-4412, CVE-2026-4412-hotfix, CVE-2026-4415, CVE-2026-4419."},
{"name": "remediation-runbook.md", "text": "To remediate CVE-2026-4412 on Ubuntu 24.04 nodes, upgrade linux-image-generic to 6.8.0-59 and reload sysctl net.ipv4.tcp_sack=0."}
],
"queries": ["What kernel version and sysctl setting remediates CVE-2026-4412?"]
}'
Compare per-query reranker tolls in the Vector RAM & TCO Calculator, read Two-Stage Retrieval vs Standalone Rerank Tolls, or open the Forge Console (v4.0 Pricing).