Skip to content

[ENH] Add Spann configuration to collection config #4195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2025
Merged

Conversation

jairad26
Copy link
Contributor

@jairad26 jairad26 commented Apr 7, 2025

Description of changes

Add SPANN configuration for collection config. It also adds a new attribute default knn index to allow setting the default index when no configuration is set, and tests that the segment executor has access to the requested index type.

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs repository?

Copy link

github-actions bot commented Apr 7, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@jairad26 jairad26 force-pushed the jai/spann-config branch 2 times, most recently from d11a67e to 5c574e5 Compare April 7, 2025 16:35
@jairad26 jairad26 changed the base branch from main to graphite-base/4195 April 7, 2025 17:32
@jairad26 jairad26 changed the base branch from graphite-base/4195 to 03-25-server-coll-config-response April 7, 2025 17:32
@jairad26 jairad26 force-pushed the 03-25-server-coll-config-response branch from 59b49f0 to f06fbcd Compare April 7, 2025 17:34
@jairad26 jairad26 changed the base branch from 03-25-server-coll-config-response to graphite-base/4195 April 7, 2025 19:52
@jairad26 jairad26 force-pushed the graphite-base/4195 branch from f06fbcd to 90c58e8 Compare April 7, 2025 19:52
@jairad26 jairad26 changed the base branch from graphite-base/4195 to main April 7, 2025 19:52
@jairad26 jairad26 force-pushed the jai/spann-config branch 2 times, most recently from 40c2d38 to bdf549e Compare April 7, 2025 20:13
@jairad26 jairad26 marked this pull request as ready for review April 8, 2025 16:05
@jairad26 jairad26 force-pushed the jai/spann-config branch 6 times, most recently from 50adc5c to 09e3dc4 Compare April 10, 2025 17:46
@jairad26 jairad26 changed the base branch from main to graphite-base/4195 April 16, 2025 21:19
@jairad26 jairad26 changed the base branch from graphite-base/4195 to jai/coll-config-docs April 16, 2025 21:19
@@ -432,6 +440,13 @@ impl ServiceBasedFrontend {
..
}: UpdateCollectionRequest,
) -> Result<UpdateCollectionResponse, UpdateCollectionError> {
// Check if spann is requested with a local executor
if let (Some(config), Executor::Local(_)) = (new_configuration.as_ref(), &self.executor) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix this and use get_segment_types

Copy link
Contributor Author

@jairad26 jairad26 left a comment

Choose a reason for hiding this comment

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

make new PR with grpc (go) for update collection with spann

.contains(&SegmentType::Spann)
{
return Err(ValidationError::SpannNotImplemented)?;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

add checks for hnsw in both config and default_knn_index to make sure it's supported segment type

space: Space
ef_construction: int
ef_search: int
max_neighbors: int
Copy link
Contributor

Choose a reason for hiding this comment

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

honestly m was more readable since it is a standard hnsw param. So I would use a name such as hnsw_m for this and for the other two hnsw_ef_construction and hnsw_ef_search

@jairad26 jairad26 force-pushed the jai/spann-config branch 3 times, most recently from 36df249 to 3910f37 Compare April 18, 2025 00:27
@jairad26 jairad26 force-pushed the jai/coll-config-docs branch from 74db38f to 04a5ca9 Compare April 18, 2025 00:32
@jairad26 jairad26 force-pushed the jai/spann-config branch 4 times, most recently from 9fab455 to c556000 Compare April 18, 2025 01:13
Copy link
Contributor

@sanketkedia sanketkedia left a comment

Choose a reason for hiding this comment

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

Only nit: should you have client side validations?

ef_config = None

# Process vector index configuration (HNSW or SPANN)
if (
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this is duplicate of above check

@@ -119,6 +122,7 @@ impl Bindings {
collections_with_segments_provider: collection_cache_config,
log: log_config,
executor: executor_config,
default_knn_index: knn_index,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: directly inline KnnIndex::Hnsw here?

@jairad26 jairad26 force-pushed the jai/spann-config branch 2 times, most recently from df7be10 to 193d84f Compare April 18, 2025 01:29
@jairad26 jairad26 force-pushed the jai/coll-config-docs branch from 04a5ca9 to 56ff6e9 Compare April 18, 2025 01:29
@jairad26 jairad26 changed the base branch from jai/coll-config-docs to graphite-base/4195 April 18, 2025 02:47
@jairad26 jairad26 changed the base branch from graphite-base/4195 to main April 18, 2025 02:49
@jairad26 jairad26 changed the base branch from main to graphite-base/4195 April 18, 2025 02:51
@jairad26 jairad26 changed the base branch from graphite-base/4195 to jai/coll-config-docs April 18, 2025 02:51
@jairad26 jairad26 changed the base branch from jai/coll-config-docs to graphite-base/4195 April 18, 2025 02:54
@jairad26 jairad26 force-pushed the graphite-base/4195 branch from 3fe5815 to 52655c8 Compare April 18, 2025 02:54
@jairad26 jairad26 changed the base branch from graphite-base/4195 to main April 18, 2025 02:55
@jairad26 jairad26 enabled auto-merge (squash) April 18, 2025 02:55
@jairad26 jairad26 merged commit 25c1fdd into main Apr 18, 2025
69 checks passed
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.

2 participants