Skip to content

chore: Updating VectorStore batch size to improve performance#182

Draft
jamie-ons wants to merge 1 commit into
mainfrom
181-review-batch_size-behaviour
Draft

chore: Updating VectorStore batch size to improve performance#182
jamie-ons wants to merge 1 commit into
mainfrom
181-review-batch_size-behaviour

Conversation

@jamie-ons

Copy link
Copy Markdown

✨ Summary

VectorStore previously exposed batch_size as a repeated parameter on individual methods, creating multiple independent sources of truth. This PR consolidates that to a single value set at construction time.

To inform the choice of default, a profiling analysis was run across the target GCP instance range at batch sizes from 8 to 512. The default has been updated to the value that minimises search time without risking OOM on the smallest supported instances.

Constraints: must not break or perform significantly worse on 2 vCPU instances; optimised for typical cloud deployments at 4–8 vCPUs.

📜 Changes Introduced

  • VectorStore methods updated so batch_size is self.batch_size from the constructor.
  • Profiling analysis across e2-standard-2, e2-medium, and e2-standard-8 measuring latency and memory
  • Default batch_size updated from 8 to based on analysis findings

✅ Checklist

  • Code passes linting with Ruff
  • DocStrings follow Google-style and are added as per Pylint recommendations
  • Documentation has been updated if needed

🔍 How to Test

To test this code, run the DEMO/general_workflow_demo.ipynb.

To test that it does not break on small instances, run on the following GCP instances and locally:

  • e2-standard-2
  • e2-medium
  • e2-standard-8

@jamie-ons jamie-ons linked an issue Jun 8, 2026 that may be closed by this pull request

return result_df

def search(self, query: VectorStoreSearchInput, n_results=10, batch_size=8) -> VectorStoreSearchOutput: # noqa: C901, PLR0912, PLR0915

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd like to retain the option for users to specify a different batch size at this point, but we'd want the default behaviour to follow the single source of truth.

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.

Review 'batch_size' behaviour

2 participants