GPU_BRUTE_FORCE

GPU 환경 전용인 GPU_BRUTE_FORCE 인덱스는 타협하지 않는 정확도가 필수적인 시나리오를 위해 설계되었습니다. 각 쿼리를 데이터 세트의 모든 벡터와 철저하게 비교하여 잠재적인 일치를 간과하지 않도록 함으로써 1의 리콜을 보장합니다. GPU 가속을 활용하는 GPU_BRUTE_FORCE는 벡터 유사도 검색에서 절대적인 정밀도를 요구하는 애플리케이션에 적합합니다.

색인 구축

Milvus의 벡터 필드에 GPU_BRUTE_FORCE 인덱스를 구축하려면 add_index() 방법을 사용하여 인덱스에 index_typemetric_type 매개변수를 지정합니다.

from pymilvus import MilvusClient

# Prepare index building params
index_params = MilvusClient.prepare_index_params()

index_params.add_index(
    field_name="your_vector_field_name", # Name of the vector field to be indexed
    index_type="GPU_BRUTE_FORCE", # Type of the index to create
    index_name="vector_index", # Name of the index to create
    metric_type="L2", # Metric type used to measure similarity
    params={} # No additional parameters required for GPU_BRUTE_FORCE
)

이 구성에서는

  • index_type: 빌드할 인덱스 유형입니다. 이 예에서는 값을 GPU_BRUTE_FORCE 로 설정합니다.

  • metric_type: 벡터 간의 거리를 계산하는 데 사용되는 메서드입니다. 자세한 내용은 메트릭 유형을 참조하세요.

  • params: GPU_BRUTE_FORCE 인덱스에는 추가 파라미터가 필요하지 않습니다.

인덱스 파라미터가 구성되면 create_index() 메서드를 직접 사용하거나 create_collection 메서드에서 인덱스 파라미터를 전달하여 인덱스를 생성할 수 있습니다. 자세한 내용은 컬렉션 생성을 참조하세요.

인덱스에서 검색

인덱스가 생성되고 엔티티가 삽입되면 인덱스에서 유사도 검색을 수행할 수 있습니다.

res = MilvusClient.search(
    collection_name="your_collection_name", # Collection name
    anns_field="vector_field", # Vector field name
    data=[[0.1, 0.2, 0.3, 0.4, 0.5]],  # Query vector
    limit=3,  # TopK results to return
    search_params={"params": {}}  # No additional parameters required for GPU_BRUTE_FORCE
)

인덱스 매개변수

GPU_BRUTE_FORCE 인덱스의 경우 인덱스 생성이나 검색 과정에서 추가 파라미터가 필요하지 않습니다.

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
피드백

이 페이지가 도움이 되었나요?