Profiling the build showed 90% of all distance evaluations are in back-link pruning (40.8M of 44.9M at 10K): every overflow re-runs the diversity heuristic pairwise over ~max_conn candidates. The bulk build now inserts in batches: plan every node's neighbours against the graph as it stood when the batch began (read-only, so plans are independent), link, then prune each overflowing list once. A node gaining several back-links in a batch is pruned once rather than once per link, so this is faster even single-threaded (10K: 1676 -> 1074 ms). With `parallel`, planning and pruning use rayon (10K: 388 ms; 100K: ~21 s -> 5.9 s on 16 cores). Batches start at one node and are capped at 1/16 of the linked graph and 512 nodes; a node that raises the top layer gets a batch to itself. The result is deterministic and identical with or without the feature (one code path; test compares two builds byte for byte). Parallelising within a single insert was tried first: 1.45x on 16 cores, tasks too small. Incremental insert() stays sequential. Recall on clustered data is unchanged or slightly better; uniform random data dips slightly (10K, ef=64: 0.474 -> 0.444). clawhdf5-agent's `parallel` feature now passes through to the index. Co-Authored-By: Claude Fable 5.1 <[email protected]>
68 lines
2.6 KiB
TOML
68 lines
2.6 KiB
TOML
[package]
|
|
name = "clawhdf5-agent"
|
|
version = "2.4.0"
|
|
edition = "2024"
|
|
description = "HDF5-backed persistent memory store for on-device AI agents"
|
|
license = "MIT"
|
|
repository = "https://git.redclaw.dev/quantumclaw/clawhdf5"
|
|
readme = "README.md"
|
|
keywords = ["agent", "memory", "hdf5", "vector-search", "embedding"]
|
|
categories = ["database", "science", "algorithms"]
|
|
|
|
[dependencies]
|
|
clawhdf5-format = { path = "../clawhdf5-format", version = "2.4.0", features = ["parallel", "fast-checksum"] }
|
|
clawhdf5 = { path = "../clawhdf5", version = "2.4.0" }
|
|
clawhdf5-io = { path = "../clawhdf5-io", version = "2.4.0", features = ["mmap"] }
|
|
clawhdf5-accel = { path = "../clawhdf5-accel", version = "2.4.0" }
|
|
clawhdf5-ann = { path = "../clawhdf5-ann", version = "2.4.0", optional = true }
|
|
clawhdf5-gpu = { path = "../clawhdf5-gpu", version = "2.4.0", optional = true, default-features = false }
|
|
serde = { workspace = true }
|
|
byteorder = "1"
|
|
half = { workspace = true, optional = true }
|
|
rayon = { version = "1", optional = true }
|
|
matrixmultiply = { version = "0.3", optional = true }
|
|
cblas-sys = { version = "0.1", optional = true }
|
|
tokio = { version = "1", features = ["rt", "sync", "macros", "time"], optional = true }
|
|
|
|
[target.'cfg(target_os = "macos")'.dependencies]
|
|
accelerate-src = { version = "0.3", optional = true }
|
|
|
|
[target.'cfg(not(target_os = "macos"))'.dependencies]
|
|
openblas-src = { version = "0.10", optional = true, features = ["cblas"] }
|
|
|
|
[dev-dependencies]
|
|
tempfile = { workspace = true }
|
|
criterion = { workspace = true }
|
|
rayon = "1"
|
|
tokio = { version = "1", features = ["rt-multi-thread", "sync", "macros"] }
|
|
|
|
[[bench]]
|
|
name = "bench"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "memory_bench"
|
|
harness = false
|
|
|
|
[features]
|
|
default = ["float16", "hnsw"]
|
|
float16 = ["half"]
|
|
# Rayon-parallel brute-force search strategies, and a parallel bulk build of
|
|
# the HNSW index (same graph, several times faster on a multi-core machine).
|
|
parallel = ["rayon", "clawhdf5-ann?/parallel"]
|
|
# Compress embeddings with Zstd instead of deflate when
|
|
# `MemoryConfig::compression` is on. Off by default: it links libzstd (C).
|
|
zstd = ["clawhdf5/zstd"]
|
|
# HNSW approximate-nearest-neighbour acceleration for the vector stage of
|
|
# hybrid_search. On by default; the index is rebuilt from the cache on demand
|
|
# and stays self-consistent with the persisted memory store. Disable with
|
|
# `--no-default-features` (plus re-enabling other defaults) to force the exact
|
|
# linear cosine scan.
|
|
hnsw = ["clawhdf5-ann"]
|
|
agent = []
|
|
gpu = ["clawhdf5-gpu/gpu-wgpu"]
|
|
fast-math = ["matrixmultiply"]
|
|
accelerate = ["accelerate-src", "cblas-sys"]
|
|
openblas = ["openblas-src", "cblas-sys"]
|
|
async = ["tokio"]
|