Documentation
¶
Overview ¶
Package annbakeoff evaluates a candidate ANN payload without making it part of dbrain's serving or cache lifecycle.
Index ¶
Constants ¶
const ( SchemaVersion = "dbrain.semantic-ann-bakeoff.v1" StatusPassed = "passed" StatusRejected = "rejected" ReasonHeapLimit = "heap_system_limit_exceeded" ReasonRecallFloor = "recall_floor_not_met" )
const BackendHNSW = "hnsw"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HNSW ¶
type HNSW struct {
// contains filtered or unexported fields
}
HNSW is the narrow backend adapter used by the segmented-index bakeoff. It owns no files and is not a serving Searcher.
func NewHNSW ¶
func NewHNSW(opts HNSWOptions) (*HNSW, error)
type HNSWHit ¶
type HNSWHit = semanticindex.HNSWHit
type HNSWNode ¶
type HNSWNode = semanticindex.HNSWNode
type HNSWOptions ¶
HNSWOptions configure one in-memory HNSW graph. Segment persistence and publication remain the caller's responsibility.
type Index ¶
type Index interface {
Reserve(int) error
Add(...semanticindex.HNSWNode) error
Search([]float32, int) ([]semanticindex.HNSWHit, error)
Export(io.Writer) error
Import(io.Reader) error
Close() error
}
Index is the narrow candidate contract used only by the content-free ANN bakeoff. It deliberately contains no SQLite, segment, or serving behavior.
type Options ¶
type Options struct {
Sizes []int
Dimensions int
QueryCount int
WarmRepetitions int
Seed uint64
RecallAt int
MinimumRecall float64
MaxHeapSysBytes uint64
EfSearch int
M int
Connectivity int
ExpansionAdd int
ExpansionSearch int
}
Options bounds one deterministic candidate screening run.
type Report ¶
type Report struct {
SchemaVersion string `json:"schema_version"`
Backend string `json:"backend"`
Dimensions int `json:"dimensions"`
Seed uint64 `json:"seed"`
RecallAt int `json:"recall_at"`
MinimumRecall float64 `json:"minimum_recall"`
EfSearch int `json:"ef_search,omitempty"`
M int `json:"m,omitempty"`
Parameters map[string]int `json:"parameters"`
Status string `json:"status"`
Stages []StageReport `json:"stages"`
}
Report contains content-free evidence for a single backend screening run.
func Run ¶
Run builds every requested stage in order. Gate failures are reported in the returned report rather than becoming opaque errors, allowing callers to save the exact evidence before stopping the next stage.
func RunWith ¶
func RunWith(ctx context.Context, opts Options, backend string, parameters map[string]int, factory Factory) (Report, error)
RunWith evaluates one named candidate against the deterministic corpus and exact oracle. Candidate errors are returned; gate failures stay in Report so callers can persist the evidence before stopping.
type StageReport ¶
type StageReport struct {
VectorCount int `json:"vector_count"`
EfSearch int `json:"ef_search,omitempty"`
M int `json:"m,omitempty"`
Parameters map[string]int `json:"parameters"`
Status string `json:"status"`
Reason string `json:"reason,omitempty"`
CorpusBuildNanos int64 `json:"corpus_build_nanos"`
GraphBuildNanos int64 `json:"graph_build_nanos"`
ExportNanos int64 `json:"export_nanos"`
ReopenNanos int64 `json:"reopen_nanos"`
ExactQueryNanos int64 `json:"exact_query_nanos"`
QueryP50Nanos int64 `json:"query_p50_nanos"`
QueryP95Nanos int64 `json:"query_p95_nanos"`
PayloadBytes int `json:"payload_bytes"`
RecallAtK float64 `json:"recall_at_k"`
ReopenRecallAtK float64 `json:"reopen_recall_at_k"`
BuildHeapAlloc uint64 `json:"build_heap_alloc_bytes"`
BuildHeapSys uint64 `json:"build_heap_sys_bytes"`
LoadedHeapAlloc uint64 `json:"loaded_heap_alloc_bytes"`
LoadedHeapSys uint64 `json:"loaded_heap_sys_bytes"`
}
StageReport records one vector-count stage. Durations are nanoseconds so a downstream report can derive milliseconds without losing short query times.