Skip to content
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

Add vectorsearch training workload #333

Merged
merged 3 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions vectorsearch/indices/train-index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"settings": {
"index": {
{%- if train_index_primary_shards is defined and train_index_primary_shards %}
"number_of_shards": {{ train_index_primary_shards }}
{%- endif %}
{%- if train_index_replica_shards is defined %}
,"number_of_replicas": {{ train_index_replica_shards }}
{%- endif %}
}
},
"mappings": {
"properties": {
"{{ train_field_name }}": {
"type": "knn_vector",
"dimension": {{ target_index_dimension }}
}
}
}
}

12 changes: 11 additions & 1 deletion vectorsearch/operations/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,14 @@
"operation-type": "refresh",
"retries": 100,
"index": "{{ target_index_name | default('target_index') }}"
}
},
{
"name": "refresh-train-index",
"operation-type": "refresh",
"retries": 100,
"index": "{{ train_index_name | default('train_index') }}"
},
{
"name": "delete-model",
"operation-type": "delete-knn-model"
}
48 changes: 48 additions & 0 deletions vectorsearch/params/train/train-faiss-sift-128-l2-pq.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"target_index_name": "target_index",
"target_field_name": "target_field",
"target_index_body": "indices/faiss-index.json",
"target_index_primary_shards": 1,
"target_index_dimension": 128,
"target_index_space_type": "l2",
"target_index_bulk_size": 100,
"target_index_bulk_index_data_set_format": "hdf5",
"target_index_bulk_index_data_set_path": "/tmp/sift-128-euclidean.hdf5",
"target_index_bulk_indexing_clients": 10,

"train_index_name": "train_index",
"train_field_name": "train_field",
"train_method_engine": "faiss",
"train_index_body": "indices/train-index.json",
"train_index_primary_shards": 1,
"train_index_replica_shards": 1,

"train_index_bulk_size": 100,
"train_index_bulk_index_data_set_format": "hdf5",
"train_index_bulk_index_data_set_path": "/tmp/sift-128-euclidean.hdf5",
"train_index_bulk_indexing_clients": 10,
"train_index_num_vectors": 1000,

"train_model_id": "test-model",
"train_operation_retries": 100,
"train_operation_poll_period": 0.5,
"train_search_size": 10000,

"encoder": "pq",
"faiss_encoder_code_size": 2,
"faiss_encoder_m": 4,

"target_index_max_num_segments": 1,
"target_index_force_merge_timeout": 300,
"hnsw_ef_search": 100,
"hnsw_ef_construction": 100,
"query_k": 100,
"query_body": {
"docvalue_fields" : ["_id"],
"stored_fields" : "_none_"
},

"query_data_set_format": "hdf5",
"query_data_set_path":"/tmp/sift-128-euclidean.hdf5",
"query_count": 100
}
48 changes: 48 additions & 0 deletions vectorsearch/params/train/train-faiss-sift-128-l2-sq.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"target_index_name": "target_index",
"target_field_name": "target_field",
"target_index_body": "indices/faiss-index.json",
"target_index_primary_shards": 1,
"target_index_dimension": 128,
"target_index_space_type": "l2",
"target_index_bulk_size": 100,
"target_index_bulk_index_data_set_format": "hdf5",
"target_index_bulk_index_data_set_path": "/tmp/sift-128-euclidean.hdf5",
"target_index_bulk_indexing_clients": 10,

"train_index_name": "train_index",
"train_field_name": "train_field",
"train_method_engine": "faiss",
"train_index_body": "indices/train-index.json",
"train_index_primary_shards": 1,
"train_index_replica_shards": 1,

"train_index_bulk_size": 100,
"train_index_bulk_index_data_set_format": "hdf5",
"train_index_bulk_index_data_set_path": "/tmp/sift-128-euclidean.hdf5",
"train_index_bulk_indexing_clients": 10,
"train_index_num_vectors": 1000,

"train_model_id": "test-model",
"train_operation_retries": 100,
"train_operation_poll_period": 0.5,
"train_search_size": 10000,

"encoder": "sq",
"faiss_encoder_type": "fp16",
"faiss_encoder_clip": false,

"target_index_max_num_segments": 1,
"target_index_force_merge_timeout": 300,
"hnsw_ef_search": 100,
"hnsw_ef_construction": 100,
"query_k": 100,
"query_body": {
"docvalue_fields" : ["_id"],
"stored_fields" : "_none_"
},

"query_data_set_format": "hdf5",
"query_data_set_path":"/tmp/sift-128-euclidean.hdf5",
"query_count": 100
}
44 changes: 44 additions & 0 deletions vectorsearch/params/train/train-faiss-sift-128-l2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"target_index_name": "target_index",
"target_field_name": "target_field",
"target_index_body": "indices/faiss-index.json",
"target_index_primary_shards": 1,
"target_index_dimension": 128,
"target_index_space_type": "l2",
"target_index_bulk_size": 100,
"target_index_bulk_index_data_set_format": "hdf5",
"target_index_bulk_index_data_set_path": "/tmp/sift-128-euclidean.hdf5",
"target_index_bulk_indexing_clients": 10,

"train_index_name": "train_index",
"train_field_name": "train_field",
"train_method_engine": "faiss",
"train_index_body": "indices/train-index.json",
"train_index_primary_shards": 1,
"train_index_replica_shards": 1,

"train_index_bulk_size": 100,
"train_index_bulk_index_data_set_format": "hdf5",
"train_index_bulk_index_data_set_path": "/tmp/sift-128-euclidean.hdf5",
"train_index_bulk_indexing_clients": 10,
"train_index_num_vectors": 1000,

"train_model_id": "test-model",
"train_operation_retries": 100,
"train_operation_poll_period": 0.5,
"train_search_size": 10000,

"target_index_max_num_segments": 1,
"target_index_force_merge_timeout": 300,
"hnsw_ef_search": 100,
"hnsw_ef_construction": 100,
"query_k": 100,
"query_body": {
"docvalue_fields" : ["_id"],
"stored_fields" : "_none_"
},

"query_data_set_format": "hdf5",
"query_data_set_path":"/tmp/sift-128-euclidean.hdf5",
"query_count": 100
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"operation": {
"name": "delete-train-index",
"operation-type": "delete-index",
"only-if-exists": true,
"index": "{{ train_index_name | default('train_index') }}"
}
},
{
"operation": {
"name": "create-train-index",
"operation-type": "create-index",
"index": "{{ train_index_name | default('train_index') }}"
}
},
{
"operation": {
"name": "custom-vector-bulk-train",
"operation-type": "bulk-vector-data-set",
"index": "{{ train_index_name | default('train_index') }}",
"field": "{{ train_field_name | default('train_field') }}",
"bulk_size": {{ train_index_bulk_size | default(500)}},
"data_set_format": "{{ train_index_bulk_index_data_set_format | default('hdf5') }}",
"data_set_path": "{{ train_index_bulk_index_data_set_path }}",
"data_set_corpus": "{{ train_index_bulk_index_data_set_corpus }}",
"num_vectors": {{ train_index_num_vectors | default(-1) }},
"id-field-name": "_id"
},
"clients": {{ train_index_bulk_indexing_clients | default(1)}}
},
{
"name" : "refresh-train-index",
"operation" : "refresh-train-index"
}
75 changes: 75 additions & 0 deletions vectorsearch/test_procedures/common/train-model-schedule.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"operation": {
"operation-type": "delete-knn-model",
"name": "delete-model",
"model_id": "{{ train_model_id }}",
"ignore-if-model-does-not-exist": true
}
},
{
"operation": {
"name": "train-knn-model",
"operation-type": "train-knn-model",
"body": {
"training_index": "{{ train_index_name | default('train_index') }}",
"training_field": "{{ train_field_name | default('train_field') }}",
"search_size": "{{ train_search_size | default(10000) }}",
"dimension": {{ target_index_dimension }},
{%- if train_max_vector_count is defined and train_max_vector_count %}
"max_training_vector_count": "{{ train_max_vector_count }}",
{%- endif %}
"method": {
"name": "{{ train_method_name | default('ivf') }}",
"engine": "{{ train_method_engine | default('faiss') }}",
"space_type": "{{ target_index_space_type | default('l2') }}",
"parameters": {
{%- if faiss_nlist is defined and faiss_nlist %}
"nlist": {{ faiss_nlist }}
{%- endif %}

{%- if faiss_nprobes is defined and faiss_nprobes %}
{%- if faiss_nlist is defined and faiss_nlist %}
,
{%- endif %}
"nprobes": {{ faiss_nprobes}}
{%- endif %}

{%- if encoder is defined and encoder %}
{%- if faiss_nprobes is defined and faiss_nprobes %}
,
{%- endif %}
"encoder": {
"name": "{{ encoder }}",
"parameters": {
{%- if faiss_encoder_code_size is defined and faiss_encoder_code_size %}
"code_size": {{ faiss_encoder_code_size }}
{%- endif %}

{%- if faiss_encoder_m is defined and faiss_encoder_m %}
{%- if faiss_encoder_code_size is defined and faiss_encoder_code_size %}
,
{%- endif %}
"m": {{ faiss_encoder_m }}
{%- endif %}

{%- if faiss_encoder_type is defined and faiss_encoder_type %}
"type": "{{ faiss_encoder_type }}"
{%- endif %}

{%- if faiss_encoder_clip is defined and faiss_encoder_clip %}
{%- if faiss_encoder_type is defined and faiss_encoder_type %}
,
{%- endif %}
"clip": "{{ faiss_encoder_clip }}"
{%- endif %}
}
}
{%- endif %}
}
}
},
"model_id": "{{ train_model_id | default('train_model') }}",
"retries": {{ train_operation_retries | default(1000) }},
"poll_period": {{ train_operation_poll_period | default(0.5) }}
}
}
13 changes: 12 additions & 1 deletion vectorsearch/test_procedures/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,15 @@
{{ benchmark.collect(parts="aoss/index-only-schedule.json") }},
{{ benchmark.collect(parts="aoss/search-only-schedule.json") }}
]
}
},
{
"name": "train-test",
"description": "Index vector search that requires training.",
"default": false,
"schedule": [
{{ benchmark.collect(parts="common/train-index-only-schedule.json") }},
{{ benchmark.collect(parts="common/index-only-schedule.json") }},
{{ benchmark.collect(parts="common/train-model-schedule.json") }},
{{ benchmark.collect(parts="common/search-only-schedule.json") }}
]
}
9 changes: 9 additions & 0 deletions vectorsearch/workload.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,30 @@
{
"name": "{{ target_index_name }}",
"body": "{{ target_index_body }}"
},
{
"name": "{{ train_index_name }}",
"body": "{{ train_index_body }}"
}
],
"corpora": [
{
"name": "cohere",
"base-url": "https://dbyiw3u3rf9yr.cloudfront.net/corpora/vectorsearch/cohere-wikipedia-22-12-en-embeddings",
"target-index": "{{ target_index_name }}",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Calling out here that this target-index param is not used anywhere in the workload, but it's necessary due to OSB validation. I'm not sure what the solution is, but I opened an issue about this.

"documents": [
{
"source-file": "documents-1k.hdf5.bz2",
"source-format": "hdf5",
"document-count": 1000

}
]
},
{
"name": "cohere-100k",
"base-url": "https://dbyiw3u3rf9yr.cloudfront.net/corpora/vectorsearch/cohere-wikipedia-22-12-en-embeddings",
"target-index": "{{ target_index_name }}",
"documents": [
{
"source-file": "documents-100k.hdf5.bz2",
Expand All @@ -34,6 +41,7 @@
{
"name": "cohere-1m",
"base-url": "https://dbyiw3u3rf9yr.cloudfront.net/corpora/vectorsearch/cohere-wikipedia-22-12-en-embeddings",
"target-index": "{{ target_index_name }}",
"documents": [
{
"source-file": "documents-1m.hdf5.bz2",
Expand All @@ -45,6 +53,7 @@
{
"name": "cohere-10m",
"base-url": "https://dbyiw3u3rf9yr.cloudfront.net/corpora/vectorsearch/cohere-wikipedia-22-12-en-embeddings",
"target-index": "{{ target_index_name }}",
"documents": [
{
"source-file": "documents-10m.hdf5.bz2",
Expand Down