Repository navigation
fix(llm): preserve semantic embedding batch order - #377
Merged
Merged
Conversation
Contributor
Author
|
The regression uses 1,001 vertices and forces the one-vertex trailing batch to complete before the first 1,000-vertex batch. It checks nearest-neighbor lookup after saving and reloading a real Faiss index, for both PRIMARY_KEY and CUSTOMIZE ID strategies; it fails on the original operator and passes with this change. Batch completion still advances the progress bar immediately, and empty input and provider errors are covered. The related index-operator/Faiss suite passed with 53 tests and one existing Ollama-service test skipped. |
Contributor
Author
|
Hope it could be merged 😊 |
18 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When more than 1,000 new vertices are indexed, embedding batches can finish out of order.
BuildSemanticIndexcurrently flattens those results in completion order but pairs them with the original vertex IDs, so semantic search can return the wrong vertex.Collect batch results with
asyncio.gatherto retain input order. Keep the existing batch size, concurrency limit, synchronous embedding provider calls, and progress updates as each batch completes.The regression forces the trailing batch to finish before the first batch and checks real Faiss save/load/search for both PRIMARY_KEY and CUSTOMIZE IDs. It fails on the original code. Empty input and provider error propagation are also covered.
Validation (Python 3.11):
SKIP_EXTERNAL_SERVICES=true uv run pytest hugegraph-llm/src/tests/operators/index_op/ hugegraph-llm/src/tests/indices/ -q --tb=short: 53 passed, 1 skipped (the existing live Ollama test).uv run ruff format --check .: passed.uv run ruff check .: passed.git diff --check: passed.HugeGraph Server and live LLM/provider integration tests were not run locally.