feat: add SQ8 vector quantization, lazy loading, and two-phase rerank to HNSW
- SQ8 scalar quantization (8-bit) for 4x vector storage reduction - Lazy vector loading: evict float32 vectors after graph construction, load on-demand from storage via UnifiedCache - Two-phase search: over-retrieve with SQ8 approximate distances, rerank top candidates with exact float32 distances - Configuration surface: hnsw.quantization and hnsw.vectorStorage in BrainyConfig - All features disabled by default (zero behavior change for existing users) - 27 new tests covering quantization accuracy, lazy loading, reranking - Remove GitHub Actions CI (build locally, cortex CI handles native builds)
This commit is contained in:
parent
e384afcdac
commit
0f3a88429d
9 changed files with 1138 additions and 222 deletions
|
|
@ -6236,7 +6236,14 @@ export class Brainy<T = any> implements BrainyInterface<T> {
|
|||
private setupIndex(): HNSWIndex | TypeAwareHNSWIndex {
|
||||
const indexConfig = {
|
||||
...this.config.index,
|
||||
distanceFunction: this.distance
|
||||
distanceFunction: this.distance,
|
||||
// Wire HNSW optimization config (v7.11.0)
|
||||
quantization: this.config.hnsw?.quantization ? {
|
||||
enabled: this.config.hnsw.quantization.enabled ?? false,
|
||||
bits: this.config.hnsw.quantization.bits ?? 8,
|
||||
rerankMultiplier: this.config.hnsw.quantization.rerankMultiplier ?? 3
|
||||
} : undefined,
|
||||
vectorStorage: this.config.hnsw?.vectorStorage
|
||||
}
|
||||
|
||||
const persistMode = this.resolveHNSWPersistMode()
|
||||
|
|
@ -6368,6 +6375,8 @@ export class Brainy<T = any> implements BrainyInterface<T> {
|
|||
reservedQueryMemory: config?.reservedQueryMemory ?? undefined as any,
|
||||
// HNSW persistence mode - undefined = smart default in setupIndex
|
||||
hnswPersistMode: config?.hnswPersistMode ?? undefined as any,
|
||||
// HNSW optimization options (v7.11.0)
|
||||
hnsw: config?.hnsw ?? undefined as any,
|
||||
// Embedding initialization - false = lazy init on first embed()
|
||||
eagerEmbeddings: config?.eagerEmbeddings ?? false,
|
||||
// Integration Hub - undefined/false = disabled
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue