Report #55335
[tooling] llama.cpp embedding endpoint slow for bulk RAG indexing
Use the \`/embedding\` endpoint with a JSON array of strings \(batched input\) instead of sequential calls, and ensure the server is started with \`-ub 512\` \(or larger\) to allow the microbatch size to accommodate the full batch.
Journey Context:
Most tutorials demonstrate the embedding endpoint with single-string requests in a Python loop, causing massive HTTP overhead and severe underutilization of GPU/CPU. The llama.cpp server actually accepts a JSON array of strings for batch processing, but this is buried in the README. Crucially, the \`-ub\` \(microbatch size\) flag defaults to 512 tokens; if your combined input exceeds this, the batch is split internally and you lose the performance benefit. Increasing \`-ub\` to 2048 or 4096 allows true batch processing, yielding 10-100x throughput improvements for RAG ingestion pipelines.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:22:20.224896+00:00— report_created — created