Skip to content

⚡ Bolt: [performance improvement] Concurrent embedding generation in Weaver#87

Draft
ishaanxgupta wants to merge 1 commit intomainfrom
bolt/concurrent-embeddings-weaver-4337648397894169834
Draft

⚡ Bolt: [performance improvement] Concurrent embedding generation in Weaver#87
ishaanxgupta wants to merge 1 commit intomainfrom
bolt/concurrent-embeddings-weaver-4337648397894169834

Conversation

@ishaanxgupta
Copy link
Member

💡 What:

Refactored flush_add_batch in src/pipelines/weaver.py to concurrently generate embeddings for all valid ADD operations before inserting them into the vector store.

🎯 Why:

The embed_fn makes a synchronous network request to an embedding service. When processing a batch of operations (e.g., from an ingestion pipeline extraction), calling this function sequentially inside an async loop blocks the event loop and multiplies network latency by the number of operations in the batch.

📊 Impact:

Reduces the time complexity of embedding generation for a batch of N additions from O(N) round-trips to ~O(1) (dependent on thread pool size), significantly lowering the latency of the Weaver pipeline for large inputs.

🔬 Measurement:

By mocking embed_fn with a sleep, execution of N items drops from N seconds to 1 second. The event loop is no longer blocked.


PR created automatically by Jules for task 4337648397894169834 started by @ishaanxgupta

Replaced sequential iteration over vector ADD operations with concurrent execution using `asyncio.gather` and `asyncio.get_running_loop().run_in_executor` in the Weaver pipeline to significantly reduce latency caused by sequential synchronous API calls.
@google-labs-jules
Copy link

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

1 participant