docs: correct misleading SQ4 quantization comment in type definitions
Two type-definition comments (src/coreTypes.ts:472 +
src/types/brainy.types.ts:1123) stated:
bits?: 8 | 4 // default: 8 (SQ8). SQ4 requires cortex native.
This was factually wrong. src/utils/vectorQuantization.ts:412 ships
distanceSQ4Js, a pure-JS SQ4 implementation that's been part of the
open-core path the whole time. The native SIMD acceleration is a drop-in
via setSQ4DistanceImplementation, NOT a hard requirement.
The misleading comment risked pushing open-core users to assume they
needed a paid native provider for SQ4 quantization when they did not.
Corrected to:
bits?: 8 | 4 // default: 8 (SQ8). SQ4 has a pure-JS implementation;
// cortex's distance:sq4 SIMD provider accelerates it.
Pure documentation; no behaviour change. Caught during an upstream
open-core-boundary audit (handoff thread BRAINY-8.0-RENAME-COORDINATION,
section E.1).
Verification
- npx tsc --noEmit: clean
- npm test: 1468 / 1468 unit
- npm run build: clean
This commit is contained in:
parent
6716329d06
commit
89e4d810ed
3 changed files with 39 additions and 2 deletions
37
RELEASES.md
37
RELEASES.md
|
|
@ -10,6 +10,43 @@ Full auto-generated changelog: `CHANGELOG.md` · Releases: https://github.com/so
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## v7.31.2 — 2026-06-09
|
||||||
|
|
||||||
|
**Affected products:** none in behaviour; affects anyone reading Brainy's TypeScript
|
||||||
|
type definitions or coreTypes for the `hnsw.quantization.bits` option. Drop-in from 7.31.1.
|
||||||
|
|
||||||
|
### Fix: stale comment claimed SQ4 vector quantization required a paid native provider
|
||||||
|
|
||||||
|
Brainy ships a pure-JS SQ4 distance implementation (`distanceSQ4Js` in
|
||||||
|
`src/utils/vectorQuantization.ts`) that's been part of the open-core path the whole
|
||||||
|
time. Two type-definition comments incorrectly stated SQ4 required a native (paid)
|
||||||
|
provider:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// coreTypes.ts:472 + types/brainy.types.ts:1123 — before
|
||||||
|
bits?: 8 | 4 // default: 8 (SQ8). SQ4 requires cortex native.
|
||||||
|
```
|
||||||
|
|
||||||
|
The comment was simply wrong — open-core users can use SQ4 today, and the native SIMD
|
||||||
|
acceleration is a drop-in via `setSQ4DistanceImplementation`, not a hard requirement.
|
||||||
|
Corrected to:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
bits?: 8 | 4 // default: 8 (SQ8). SQ4 has a pure-JS implementation;
|
||||||
|
// cortex's distance:sq4 SIMD provider accelerates it.
|
||||||
|
```
|
||||||
|
|
||||||
|
Both locations updated. Pure documentation; no behaviour change. Caught during an
|
||||||
|
upstream open-core-boundary audit — thanks to whoever read the types carefully enough
|
||||||
|
to spot the misleading comment.
|
||||||
|
|
||||||
|
### Cortex compatibility
|
||||||
|
|
||||||
|
Zero changes required. The fix is documentation only; runtime behaviour was already
|
||||||
|
correct (`vectorQuantization.ts:412` ships `distanceSQ4Js`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## v7.31.1 — 2026-06-09
|
## v7.31.1 — 2026-06-09
|
||||||
|
|
||||||
**Affected products:** any consumer running `@soulcraft/brainy` against `FileSystemStorage`
|
**Affected products:** any consumer running `@soulcraft/brainy` against `FileSystemStorage`
|
||||||
|
|
|
||||||
|
|
@ -469,7 +469,7 @@ export interface HNSWConfig {
|
||||||
// SQ8 vector quantization (4x memory reduction, ~0.4% accuracy loss)
|
// SQ8 vector quantization (4x memory reduction, ~0.4% accuracy loss)
|
||||||
quantization?: {
|
quantization?: {
|
||||||
enabled: boolean // default: false — preserves current behavior exactly
|
enabled: boolean // default: false — preserves current behavior exactly
|
||||||
bits?: 8 | 4 // default: 8 (SQ8). SQ4 requires cortex native.
|
bits?: 8 | 4 // default: 8 (SQ8). SQ4 has a pure-JS implementation; cortex's distance:sq4 SIMD provider accelerates it.
|
||||||
rerankMultiplier?: number // default: 3 — over-retrieve 3x, rerank with float32
|
rerankMultiplier?: number // default: 3 — over-retrieve 3x, rerank with float32
|
||||||
}
|
}
|
||||||
// Vector storage mode
|
// Vector storage mode
|
||||||
|
|
|
||||||
|
|
@ -1120,7 +1120,7 @@ export interface BrainyConfig {
|
||||||
hnsw?: {
|
hnsw?: {
|
||||||
quantization?: {
|
quantization?: {
|
||||||
enabled?: boolean // default: false — current behavior exactly
|
enabled?: boolean // default: false — current behavior exactly
|
||||||
bits?: 8 | 4 // default: 8 (SQ8). SQ4 requires cortex native.
|
bits?: 8 | 4 // default: 8 (SQ8). SQ4 has a pure-JS implementation; cortex's distance:sq4 SIMD provider accelerates it.
|
||||||
rerankMultiplier?: number // default: 3 — over-retrieve 3x, rerank with float32
|
rerankMultiplier?: number // default: 3 — over-retrieve 3x, rerank with float32
|
||||||
}
|
}
|
||||||
vectorStorage?: 'memory' | 'lazy' // default: 'memory' — 'lazy' evicts vectors after insert
|
vectorStorage?: 'memory' | 'lazy' // default: 'memory' — 'lazy' evicts vectors after insert
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue