인덱싱은 데이터를 효율적으로 구성하는 과정으로, 대규모 데이터셋에서 시간이 많이 걸리는 쿼리를 크게 가속화하여 유사성 검색을 효과적으로 만드는 주요한 역할을 한다.
Mivus는 대부분 ANNS(Approximate Nearest Neighbors Search) 알고리즘을 이용하는 인덱스 방법을 지원한다. ANNS 방법으로 정확성이 조금 낮더라도 검색 속도를 개선할 수 있다.
ANNS 벡터 index는 구현방법에 따라 크게 tree-based, graph-based, hash-based, quantization-based의 4가지 유형으로 분류할 수 있다.
Milvus는 벡터 임베딩 타입에 따라 다양한 index type을 지원한다. 벡터 임베딩 타입은 Dense vector (floating-point embeddings), binary embeddings, sparse embeddings로 나뉜다. 이 중 블로거는 Dense vector 타입만을 정리하였다.
These types of indexes include FLAT, IVF_FLAT, IVF_PQ, IVF_SQ8, HNSW, and SCANN for CPU-based ANN searches.
| Supported index | Classification | Scenario |
|---|---|---|
| FLAT | N/A | • Relatively small dataset • Requires a 100% recall rate |
| IVF_FLAT | Quantization-based index | • High-speed query • Requires a recall rate as high as possible |
| IVF_SQ8 | Quantization-based index | • High-speed query • Limited memory resources • Accepts minor compromise in recall rate |
| IVF_PQ | Quantization-based index | • Very high-speed query Limited memory resources Accepts substantial compromise in recall rate |
| HNSW | Graph-based index | • Very high-speed query • Requires a recall rate as high as possible • Large memory resources |
| SCANN | Quantization-based index | • Very high-speed query • Requires a recall rate as high as possible • Large memory resources |
| Parameter | Description | Range |
|---|---|---|
metric_type | [Optional] The chosen distance metric. | See Supported Metrics. |
| Parameter | Description | Range | Default Value |
|---|---|---|---|
nlist | Number of cluster units | [1, 65536] | 128 |
| Parameter | Description | Range | Default Value |
|---|---|---|---|
nprobe | Number of units to query | [1, nlist] | 8 |
| Parameter | Description | Range | Default Value |
|---|---|---|---|
max_empty_result_buckets | Maximum number of buckets not returning any search results.This is a range-search parameter and terminates the search process whilst the number of consecutive empty buckets reaches the specified value.Increasing this value can improve recall rate at the cost of increased search time. | [1, 65535] | 2 |
| Parameter | Description | Range |
|---|---|---|
nlist | Number of cluster units | [1, 65536] |
m | Number of factors of product quantization | dim mod m == 0 |
nbits | [Optional] Number of bits in which each low-dimensional vector is stored. | [1, 64] (8 by default) |
동시성: 여러 데이터 요소를 병렬로 처리하여 성능을 크게 향상시킴.
적용 분야: 그래픽 처리, 신호 처리, 머신 러닝, 벡터 연산 등 대규모 데이터 병렬 처리가 필요한 작업에 사용됨.
하드웨어 지원: 현대 CPU 및 GPU에는 SIMD 연산을 지원하는 명령어 세트(예: Intel의 SSE/AVX, ARM의 NEON)가 내장되어 있음.
같은 작업을 여러 데이터 요소에 동시에 수행하려면, 데이터를 특정 크기(예: 128비트, 256비트)로 묶은 벡터 레지스터에 로드함.
하나의 명령어로 묶인 데이터 요소들에 병렬 계산을 적용.
일반적 방식: 4개의 숫자 배열에 대해 각각 덧셈 연산을 수행하려면 4번의 연산이 필요함.
SIMD 방식: 한 번의 명령으로 4개의 숫자 배열에 대해 동시에 연산을 수행함.
m and nbits for optimized performance.
| Parameter | Description | Range |
|---|---|---|
nlist | Number of cluster units | [1, 65536] |
with_raw_data | Whether to include the raw data in the index | True or False. Defaults to True. |
| Parameter | Description | Range | Default value |
|---|---|---|---|
nprobe | Number of units to query | [1, nlist] | |
reorder_k | Number of candidate units to query | [top_k, ∞] | top_k |
| Parameter | Description | Range |
|---|---|---|
M | M defines tha maximum number of outgoing connections in the graph. Higher M leads to higher accuracy/run_time at fixed ef/efConstruction. | [2, 2048] |
efConstruction | ef_construction controls index search speed/build speed tradeoff. Increasing the efConstruction parameter may enhance index quality, but it also tends to lengthen the indexing time. | [1, int_max] |
| Parameter | Description | Range |
|---|---|---|
ef | Parameter controlling query time/accuracy trade-off. Higher ef leads to more accurate but slower search. | [top_k, int_max] |