Skip to content

Commit 5f1d1f0

Browse files
authored
feat: improve embedding throughput on cpu (#78)
* feat: improve embedding throughput on cpu * docs: add cpu-only testing note * fix: address embedding review feedback
1 parent 23b1e27 commit 5f1d1f0

7 files changed

Lines changed: 450 additions & 72 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
### Fixed
13+
14+
## [0.28.0] - 2026-03-23
15+
16+
### Fixed
17+
18+
- `gno embed` now requests full embedding threads from `node-llama-cpp` and uses an adaptive embedding-context pool on CPU-only machines, with graceful fallback when extra contexts cannot be created. Thanks @riyadist for the report and repro details.
19+
1220
## [0.27.3] - 2026-03-23
1321

1422
### Fixed
@@ -853,7 +861,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
853861
| 0.4.0 | 2026-01-01 | Web UI and REST API |
854862
| 0.1.0 | 2025-12-30 | Initial release with full search pipeline |
855863

856-
[Unreleased]: https://github.com/gmickel/gno/compare/v0.27.3...HEAD
864+
[Unreleased]: https://github.com/gmickel/gno/compare/v0.28.0...HEAD
865+
[0.28.0]: https://github.com/gmickel/gno/compare/v0.27.3...v0.28.0
857866
[0.27.3]: https://github.com/gmickel/gno/compare/v0.27.2...v0.27.3
858867
[0.27.2]: https://github.com/gmickel/gno/compare/v0.27.1...v0.27.2
859868
[0.27.1]: https://github.com/gmickel/gno/compare/v0.27.0...v0.27.1

docs/CLI.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ All commands accept:
5252

5353
**Offline mode**: Use `--offline` or set `HF_HUB_OFFLINE=1` to prevent auto-downloading models. Set `GNO_NO_AUTO_DOWNLOAD=1` to disable auto-download while still allowing explicit `gno models pull`.
5454

55+
**Force CPU-only for testing**: Set `NODE_LLAMA_CPP_GPU=false` on the `gno`
56+
process to disable Metal/CUDA/Vulkan and force the CPU backend:
57+
58+
```bash
59+
NODE_LLAMA_CPP_GPU=false gno doctor --json
60+
NODE_LLAMA_CPP_GPU=false gno embed --yes
61+
```
62+
63+
Accepted values from `node-llama-cpp`: `false`, `off`, `none`, `disable`,
64+
`disabled`.
65+
66+
> **Note:** the first CPU-only run may build or download a separate CPU backend
67+
> if you only have GPU-backed binaries cached. Use the second run for timing.
68+
5569
**Output format flags** (`--json`, `--files`, `--csv`, `--md`, `--xml`) are per-command.
5670
See [spec/cli.md](../spec/cli.md#output-format-support-matrix) for which commands support which formats.
5771

@@ -373,6 +387,10 @@ Options:
373387

374388
Generate embeddings for indexed chunks.
375389

390+
On CPU-only machines, GNO uses a small adaptive pool of embedding contexts to
391+
keep more cores busy. If RAM is tight, it automatically falls back to fewer
392+
contexts.
393+
376394
```bash
377395
gno embed
378396
gno embed notes

docs/TROUBLESHOOTING.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,22 @@ gno models pull --embed
208208
gno models pull --all
209209
```
210210

211+
### Force CPU-only for testing
212+
213+
To disable Metal/CUDA/Vulkan and force `node-llama-cpp` onto the CPU backend
214+
for a repro or benchmark:
215+
216+
```bash
217+
NODE_LLAMA_CPP_GPU=false gno doctor --json
218+
NODE_LLAMA_CPP_GPU=false gno embed --yes
219+
```
220+
221+
Accepted values: `false`, `off`, `none`, `disable`, `disabled`.
222+
223+
If your machine only has GPU-backed `node-llama-cpp` binaries cached, the first
224+
CPU-only run may build or download a separate CPU backend. For throughput
225+
measurements, ignore that first run and time the second.
226+
211227
## Model Issues
212228

213229
### Models Fail to Download

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gmickel/gno",
3-
"version": "0.27.3",
3+
"version": "0.28.0",
44
"description": "Local semantic search for your documents. Index Markdown, PDF, and Office files with hybrid BM25 + vector search.",
55
"keywords": [
66
"embeddings",

spec/cli.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ With `--verbose`, embedding errors during the embed phase are logged to stderr (
411411

412412
Generate embeddings for chunks without vectors.
413413

414+
On CPU-only machines, implementations may use multiple embedding contexts
415+
internally to improve throughput, and may fall back to fewer contexts if
416+
memory pressure prevents creating the full pool.
417+
414418
**Synopsis:**
415419

416420
```bash

0 commit comments

Comments
 (0)