Skip to content

feat(ai): prototype bounded ONNX embeddings - #2

Merged
xerj-team merged 1 commit into
xerj-org:mainfrom
probelabs:feature/onnx-experimental
Jul 23, 2026
Merged

feat(ai): prototype bounded ONNX embeddings#2
xerj-team merged 1 commit into
xerj-org:mainfrom
probelabs:feature/onnx-experimental

Conversation

@buger

@buger buger commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Neural indices previously loaded one Candle model per index, multiplying startup work and resident memory. The experimental ONNX investigation also lived outside a reviewable product change, so its safe execution policy and measured boundaries were not available in-tree.

Share Candle models process-wide by complete NeuralConfig while retaining lazy loading and releasing registry entries after the last user drops. Add an opt-in xerj-ai ONNX FP32 backend using the safe ort API, one shared session, length-aware microbatches, padded-token and queue bounds, input-order restoration, focused planner tests, and a live benchmark example. The default feature set and --embed-mode neural remain Candle; no server or CLI ONNX mode is introduced.

The controlled embedding-layer comparison measured 116.671 docs/s for scheduled ONNX versus 9.045 docs/s for identically planned Candle (12.90x), with minimum same-document cosine 0.9999991655. This is not an end-to-end indexing claim. Measured stripped server deltas were +18.75 MiB for dual backends and +16.43 MiB for ONNX-only. Bundled ort artifacts do not support the project's musl release targets, so the feature remains explicitly experimental.

Validation: default xerj-ai release build and 25 tests; neural release build and 3 model-sharing tests; ONNX release build and 3 scheduler tests; combined neural+ONNX suite (31 passed, 1 ignored); live 256-document example (163.96 scheduled docs/s, 1.87x over singleton, minimum cosine 0.99999905); package formatting and diff checks.

Neural indices previously loaded one Candle model per index, multiplying startup work and resident memory. The experimental ONNX investigation also lived outside a reviewable product change, so its safe execution policy and measured boundaries were not available in-tree.

Share Candle models process-wide by complete NeuralConfig while retaining lazy loading and releasing registry entries after the last user drops. Add an opt-in xerj-ai ONNX FP32 backend using the safe ort API, one shared session, length-aware microbatches, padded-token and queue bounds, input-order restoration, focused planner tests, and a live benchmark example. The default feature set and --embed-mode neural remain Candle; no server or CLI ONNX mode is introduced.

The controlled embedding-layer comparison measured 116.671 docs/s for scheduled ONNX versus 9.045 docs/s for identically planned Candle (12.90x), with minimum same-document cosine 0.9999991655. This is not an end-to-end indexing claim. Measured stripped server deltas were +18.75 MiB for dual backends and +16.43 MiB for ONNX-only. Bundled ort artifacts do not support the project's musl release targets, so the feature remains explicitly experimental.

Validation: default xerj-ai release build and 25 tests; neural release build and 3 model-sharing tests; ONNX release build and 3 scheduler tests; combined neural+ONNX suite (31 passed, 1 ignored); live 256-document example (163.96 scheduled docs/s, 1.87x over singleton, minimum cosine 0.99999905); package formatting and diff checks.
@xerj-team
xerj-team merged commit b2f280e into xerj-org:main Jul 23, 2026
xerj-org added a commit that referenced this pull request Jul 31, 2026
…#82)

Two user-reported problems autoindexing large source trees (django, redis),
plus a real new capability.

1. `Too many open files (os error 24)` mid-run. Every index holds segment
   mmaps, a WAL and a merge task, so discovering a repo (django infers ~74
   datasets → ~74 indices) opens thousands of descriptors. On a default macOS
   soft limit (256) the server exhausted them at the 2nd index. Reproduced
   against a real django clone under `ulimit -n 256`. Fix: raise
   RLIMIT_NOFILE to the hard limit at server startup (step down for the macOS
   kernel cap; best-effort). Django + Redis now index cleanly under a 256 soft
   limit (was: crash at index #2).

2. `<jemalloc>: option background_thread currently supports pthread only` on
   every macOS launch. `background_thread:true` is Linux-only; gate it to
   `target_os = "linux"` and keep the decay policy elsewhere.

3. Source code was indexed as plain text. Add an AST extractor (extract/code.rs)
   using tree-sitter for python, javascript, typescript, tsx, rust, go, java,
   c, c++, ruby, php, c#, bash — routed by extension via a new `Family::Code`.
   Each file carries `language`, a structured `symbols` array {name,kind,line},
   a searchable `defs` list ("class User", "def save") and the full source, so
   `class Model` retrieves the file that defines it. 13 per-language tests +
   the full 140-test autoindex suite pass; verified on real django (Python) and
   redis (C) clones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants