<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title><![CDATA[Jessica Garson - Elasticsearch Labs]]></title>
    <description><![CDATA[Articles and tutorials from the Search team at Elastic]]></description>
    <copyright><![CDATA[© 2026. Elasticsearch B.V. All Rights Reserved]]></copyright>
    <image>
      <title><![CDATA[Jessica Garson - Elasticsearch Labs]]></title>
      <url>https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1121c0bf0e8a6e65/6a88da6340a1841030ef456f/search-labs-thumbnail.png</url>
      <link>https://www.elastic.co/kr/search-labs/author/jessica-garson</link>
    </image>
    <link>https://www.elastic.co/kr/search-labs/author/jessica-garson</link>
    <atom:link href="https://www.elastic.co/kr/search-labs/rss/author/jessica-garson.xml" rel="self" type="application/rss+xml"/>
    <language><![CDATA[kr]]></language>
    <lastBuildDate>Mon, 14 Sep 2026 18:33:55 GMT</lastBuildDate>
  <item>
    <title><![CDATA[더 나은 바이너리 정량화(BBQ)를 사용 사례에 구현하는 방법]]></title>
    <description><![CDATA[사용 사례에서 더 나은 이진 정량화(BBQ)를 구현하는 이유와 그 방법을 살펴보세요.]]></description>
    <content:encoded><![CDATA[<p>벡터 검색은 텍스트에 대한 시맨틱 검색이나 이미지, 동영상 또는 오디오에 대한 유사도 검색을 구현할 때 기초를 제공합니다. 벡터 검색에서 벡터는 방대하고 때로는 느릴 수 있는 데이터를 수학적으로 표현한 것입니다. 더 나은 이진 양자화(이하 BBQ)는 벡터의 압축 방법으로 작동합니다. 벡터를 축소하여 검색 및 처리 속도를 높이면서 적합한 일치 항목을 찾을 수 있습니다. 이 글에서는 벡터를 자동으로 채점하는 정량화된 인덱스에만 사용할 수 있는 필드인 BBQ와 rescore_vector에 대해 설명합니다.</p><p>이 문서에 언급된 모든 전체 쿼리와 출력은 <a href="https://github.com/elastic/elasticsearch-labs/tree/main/supporting-blog-content/how-and-why-bbq">Elasticsearch Labs 코드 리포지토리에서</a> 확인할 수 있습니다.</p><h2>사용 사례에서 더 나은 이진 정량화(BBQ)를 구현하는 이유는 무엇인가요?</h2>참고: BBQ의 수학적 원리에 대한 자세한 내용은 아래의 <a href="https://www.elastic.co/kr/search-labs/blog/bbq-implementation-into-use-case#further-learning">'추가 학습' 섹션을</a> 참조하세요. 이 블로그에서는 구현에 초점을 맞추고 있습니다.<p>수학은 흥미롭지만, 벡터 검색의 정확성을 유지하려면 그 이유를 완전히 파악하는 것이 중요합니다. 현재의 벡터 검색 알고리즘으로는 데이터 읽기 속도에 제한이 있다는 것이 밝혀졌기 때문에 궁극적으로 이것은 압축에 관한 것입니다. 따라서 해당 데이터를 모두 메모리에 넣을 수 있다면 스토리지에서 읽을 때보다 속도가 크게 향상됩니다<a href="https://sre.google/static/pdf/rule-of-thumb-latency-numbers-letter.pdf">(메모리는 SSD보다 약 200배 빠릅니다</a>).</p><p>몇 가지 유의해야 할 사항이 있습니다:</p><ul><li><p><a href="https://arxiv.org/pdf/1603.09320">HNSW</a> (계층 탐색 가능한 작은 세계)와 같은 그래프 기반 인덱스는 벡터 검색에 가장 빠릅니다.</p><ul><li><p>HNSW: 다층 그래프 구조를 구축하여 효율적인 고차원 유사도 검색을 가능하게 하는 근사 근사 이웃 검색 알고리즘입니다.</p></li></ul></li></ul><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt760bd95c206bfa8f/6a17e2ad505ac393f7ad8a95/590f3b3c72a76023a38a0436cd9ff90a9f80e936-1964x1262.png" alt="HNSW: 다층 그래프 구조를 구축하여 효율적인 고차원 유사도 검색을 가능하게 하는 근사 근사 이웃 검색 알고리즘입니다." /><ul><li><p>HNSW는 메모리 또는 최악의 경우 스토리지에서 데이터를 읽는 속도에 의해 근본적으로 속도가 제한됩니다.</p><ul><li><p>이상적으로는 저장된 모든 벡터를 메모리에 로드할 수 있어야 합니다.</p></li></ul></li><li><p>임베딩 모델은 일반적으로 부동 소수점 숫자당 4바이트의 플로트32 정밀도를 가진 벡터를 생성합니다.</p></li><li><p>마지막으로, 보유하고 있는 벡터 및/또는 치수의 수에 따라 모든 벡터를 저장하기 위한 메모리가 매우 빠르게 부족해질 수 있습니다.</p></li></ul><p>이를 당연하게 생각하면, 수백 또는 수천 개의 차원을 가진 수백만 또는 수십억 개의 벡터를 수집하기 시작하면 문제가 빠르게 발생한다는 것을 알 수 있습니다. '<a href="https://www.elastic.co/kr/search-labs/blog/bbq-implementation-into-use-case#approximate-numbers-on-the-compression-ratios">압축률에 대한 대략적인</a>수치'라는 제목의 섹션에서 대략적인 수치를 확인할 수 있습니다.</p><h2>시작하려면 무엇이 필요하나요?</h2><p>시작하려면 다음이 필요합니다:</p><ul><li><p>Elastic Cloud 또는 온프레미스를 사용하는 경우, 8.18 이상의 Elasticsearch 버전이 필요합니다. BBQ는 8.16에 도입되었지만, 이 글에서는 8.18에 도입된 <code>vector_rescore</code> 을 사용합니다.</p></li><li><p>또한 클러스터에 <a href="https://www.elastic.co/kr/guide/en/elasticsearch/reference/8.18/ml-settings.html">머신 러닝(ML) 노드가</a> 있는지 확인해야 합니다. (참고: 모델을 로드하려면 최소 4GB의 ML 노드가 필요하지만 전체 프로덕션 워크로드에는 훨씬 더 큰 노드가 필요할 수 있습니다.)</p></li><li><p>서버리스를 사용하는 경우 벡터에 최적화된 인스턴스를 선택해야 합니다.</p></li><li><p>또한 벡터 데이터베이스에 대한 기본 지식이 필요합니다. Elastic의 벡터 검색 개념에 아직 익숙하지 않으시다면 먼저 다음 리소스를 확인해보시는 것이 좋습니다:</p><ul><li><p><a href="https://www.elastic.co/kr/search-labs/blog/elastic-vector-database-practical-example">Elastic Vector 데이터베이스 탐색</a></p></li><li><p><a href="https://www.elastic.co/kr/blog/retrieval-augmented-generation-explained">검색 증강 생성의 핵심 아이디어</a></p></li></ul></li></ul><h2>더 나은 바이너리 정량화(BBQ) 구현</h2><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt18df00df95ff2ca7/6a17e2af414c6411989450df/4d388078495566f0527e931e0c2e38facdce83c6-1503x748.png" alt="Elasticsearch bbq 구현." /><p>이 블로그는 간결하게 유지하기 위해 기본 제공 기능을 사용할 수 있는 경우 이를 사용합니다. 이 경우, 머신 러닝 노드에서 Elasticsearch 내부에서 직접 실행되는 <a href="https://www.elastic.co/kr/guide/en/machine-learning/8.17/ml-nlp-e5.html"><code>.multilingual-e5-small</code></a> 벡터 임베딩 모델이 있습니다. <code>text_embedding</code> 모델을 원하는 임베더<a href="https://www.elastic.co/kr/guide/en/elasticsearch/reference/8.18/infer-service-openai.html">(OpenAI</a>, <a href="https://www.elastic.co/kr/guide/en/elasticsearch/reference/8.18/infer-service-google-ai-studio.html">Google AI Studio</a>, <a href="https://www.elastic.co/kr/guide/en/elasticsearch/reference/8.18/infer-service-cohere.html">Cohere</a> 등)로 대체할 수 있습니다. 선호하는 모델이 아직 통합되지 않은 경우, <a href="https://www.elastic.co/kr/guide/en/elasticsearch/reference/8.18/bring-your-own-vectors.html">자체 고밀도 벡터 임베딩을 가져올</a> 수도 있습니다.)</p><p>먼저, 주어진 텍스트에 대한 벡터를 생성하기 위해 추론 엔드포인트를 만들어야 합니다. 이 모든 명령은 Kibana <a href="https://www.elastic.co/kr/guide/en/kibana/8.18/console-kibana.html">개발자 도구 콘솔에서</a> 실행합니다. 이 명령은 <code>.multilingual-e5-small</code> 을 다운로드합니다. 아직 존재하지 않으면 엔드포인트가 설정되며, 실행하는 데 1분 정도 걸릴 수 있습니다. 예상 출력은 출력 폴더의 <a href="https://github.com/elastic/elasticsearch-labs/blob/main/supporting-blog-content/how-and-why-bbq/Outputs/01-create-an-inference-endpoint-output.json">01-create-an-inference-endpoint-output.json</a> 파일에서 확인할 수 있습니다. </p>PUT _inference/text_embedding/my_e5_model
{
  "service": "elasticsearch",
  "service_settings": {
    "num_threads": 1,
    "model_id": ".multilingual-e5-small",
    "adaptive_allocations": {
      "enabled": true,
      "min_number_of_allocations": 1
    }
  }
}<p>반환되면 모델이 설정되고 다음 명령을 사용하여 모델이 예상대로 작동하는지 테스트할 수 있습니다. 예상 출력은 출력 폴더의 <a href="https://github.com/elastic/elasticsearch-labs/blob/main/supporting-blog-content/how-and-why-bbq/Outputs/02-embed-text-output.json">02-embed-text-output.json</a> 파일에서 확인할 수 있습니다.</p>POST _inference/text_embedding/my_e5_model
{
  "input": "my awesome piece of text"
}<p>학습된 모델이 노드에 할당되지 않는 문제가 발생하면 모델을 수동으로 시작해야 할 수 있습니다.</p>POST _ml/trained_models/.multilingual-e5-small/deployment/_start<p>이제 임베딩 모델의 출력과 일치하도록 표준 텍스트 필드(<code>my_field</code>)와 384개의 차원을 가진 고밀도 벡터 필드(<code>my_vector</code>)의 두 가지 속성을 가진 새 매핑을 만들어 보겠습니다. 또한 <code>index_options.type to bbq_hnsw</code> 을 재정의합니다. 예상 출력은 출력 폴더의 <a href="https://github.com/elastic/elasticsearch-labs/blob/main/supporting-blog-content/how-and-why-bbq/Outputs/03-create-byte-qauntized-index-output.json">03-create-byte-qauntized-index-output.json</a> 파일에서 확인할 수 있습니다.</p>PUT bbq-my-byte-quantized-index
{
  "mappings": {
    "properties": {
      "my_field": {
        "type": "text"
      },
      "my_vector": {
        "type": "dense_vector",
        "dims": 384,
        "index_options": {
          "type": "bbq_hnsw"
        }
      }
    }
  }
}<p>Elasticsearch가 벡터를 생성하도록 하기 위해 <a href="https://www.elastic.co/kr/guide/en/elasticsearch/reference/8.18/ingest.html">수집 파이프라인을</a> 사용할 수 있습니다. 이 파이프라인에는 엔드포인트(<code>model_id</code>), 벡터를 생성하려는 <code>input_field</code>, 벡터를 저장할 <code>output_field</code>, 이 세 가지가 필요합니다. 아래의 첫 번째 명령은 추론 <a href="https://www.elastic.co/kr/guide/en/elasticsearch/reference/current/inference-apis.html">서비스를 </a>내부적으로 사용하는 추론 수집 파이프라인을 만들고, 두 번째 명령은 파이프라인이 올바르게 작동하는지 테스트합니다. 예상 출력은 출력 폴더의 <a href="https://github.com/elastic/elasticsearch-labs/blob/main/supporting-blog-content/how-and-why-bbq/Outputs/04-create-and-simulate-ingest-pipeline-output.json">04-create-and-simulate-ingest-pipeline-output.json</a> 파일에서 확인할 수 있습니다. </p>PUT _ingest/pipeline/my_inference_pipeline
{
  "processors": [
    {
      "inference": {
        "model_id": "my_e5_model",
        "input_output": [
          {
            "input_field": "my_field",
            "output_field": "my_vector"
          }
        ]
      }
    }
  ]
}

POST _ingest/pipeline/my_inference_pipeline/_simulate
{
  "docs": [
    {
      "_source": {
        "my_field": "my awesome text field"
      }
    }
  ]
}<p>이제 아래의 처음 두 명령어로 문서를 추가하고 세 번째 명령어로 검색이 제대로 작동하는지 테스트할 준비가 되었습니다. 예상 출력은 출력 폴더의 <a href="https://github.com/elastic/elasticsearch-labs/blob/main/supporting-blog-content/how-and-why-bbq/Outputs/05-bbq-index-output.json">05-bbq-index-output.json</a> 파일에서 확인할 수 있습니다. </p>PUT bbq-my-byte-quantized-index/_doc/1?pipeline=my_inference_pipeline
{
    "my_field": "my awesome text field"
}

PUT bbq-my-byte-quantized-index/_doc/2?pipeline=my_inference_pipeline
{
    "my_field": "some other sentence"
}

GET bbq-my-byte-quantized-index/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "knn": {
            "field": "my_vector",
            "query_vector_builder": {
              "text_embedding": {
                "model_id": "my_e5_model",
                "model_text": "my awesome search field"
              }
            },
            "k": 10,
            "num_candidates": 100
          }
        }
      ]
    }
  },
  "_source": [
    "my_field"
  ]
}<p><a href="https://www.elastic.co/kr/search-labs/blog/better-binary-quantization-lucene-elasticsearch#lucene-benchmarking">이 게시물에서</a> 권장하는 바와 같이, 리스코어링과 오버샘플링은 압축의 이점을 활용하면서 높은 리콜 정확도를 유지하는 데 도움이 되므로 데이터 양이 많지 않은 경우 확장하는 것이 좋습니다. Elasticsearch 버전 8.18부터는 <a href="https://www.elastic.co/kr/guide/en/elasticsearch/reference/8.18/knn-search.html#dense-vector-knn-search-rescoring">rescore_vector를</a> 사용하여 이 작업을 수행할 수 있습니다. 예상 출력은 출력 폴더의 <a href="https://github.com/elastic/elasticsearch-labs/blob/main/supporting-blog-content/how-and-why-bbq/Outputs/06-bbq-search-8-18-output.json">06-bbq-search-8-18-output.json</a> 파일에 있습니다.</p>GET bbq-my-byte-quantized-index/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "knn": {
            "field": "my_vector",
            "query_vector_builder": {
              "text_embedding": {
                "model_id": "my_e5_model",
                "model_text": "my awesome search field"
              }
            },
            "rescore_vector": {
              "oversample": 3
            },
            "k": 10,
            "num_candidates": 100
          }
        }
      ]
    }
  },
  "_source": [
    "my_field"
  ]
}<p>이 점수는 원시 데이터에 대해 얻을 수 있는 점수와 어떻게 비교될까요? 위의 모든 작업을 다시 수행하되 <code>index_options.type: hnsw</code> 을 사용하면 점수가 매우 비슷하다는 것을 알 수 있습니다. 예상 출력은 출력 폴더의 <a href="https://github.com/elastic/elasticsearch-labs/blob/main/supporting-blog-content/how-and-why-bbq/Outputs/07-raw-vector-output.json">07-raw-vector-output.json</a> 파일에서 확인할 수 있습니다.</p>PUT my-raw-vector-index
{
  "mappings": {
    "properties": {
      "my_field": {
        "type": "text"
      },
      "my_vector": {
        "type": "dense_vector",
        "dims": 384,
        "index_options": {
          "type": "hnsw"
        }
      }
    }
  }
}

PUT my-raw-vector-index/_doc/1?pipeline=my_inference_pipeline
{
    "my_field": "my awesome text field"
}

PUT my-raw-vector-index/_doc/2?pipeline=my_inference_pipeline
{
    "my_field": "some other sentence"
}

GET my-raw-vector-index/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "knn": {
            "field": "my_vector",
            "query_vector_builder": {
              "text_embedding": {
                "model_id": "my_e5_model",
                "model_text": "my awesome search field"
              }
            },
            "k": 10,
            "num_candidates": 100
          }
        }
      ]
    }
  },
  "_source": [
    "my_field"
  ]
}<h2>압축률에 대한 대략적인 수치</h2><p>벡터 검색으로 작업할 때 저장 공간과 메모리 요구 사항은 금방 큰 문제가 될 수 있습니다. 다음 분석은 다양한 양자화 기법이 벡터 데이터의 메모리 사용량을 어떻게 획기적으로 줄이는지 보여줍니다.</p><p>벡터(V)</p><p>치수(D)</p><p>원시(V x D x 4)</p><p>int8 (V x (D x 1 + 4))</p><p>int4 (V x (D x 0.5 + 4))</p><p>bbq (V x (D x 0.125 + 4))</p><p>10,000,000</p><p>384</p><p>14.31GB</p><p>3.61GB</p><p>1.83GB</p><p>0.58GB</p><p>50,000,000</p><p>384</p><p>71.53GB</p><p>18.07GB</p><p>9.13GB</p><p>2.89GB</p><p>100,000,000</p><p>384</p><p>143.05GB</p><p>36.14GB</p><p>18.25GB</p><p>5.77GB</p><h2>결론</h2><p>BBQ는 정확도 저하 없이 압축을 위해 벡터 데이터에 적용할 수 있는 최적화 기능입니다. 벡터를 비트로 변환하여 데이터를 효과적으로 검색하고 AI 워크플로우를 확장하여 검색을 가속화하고 데이터 저장 공간을 최적화할 수 있도록 지원합니다.</p><h2>추가 학습</h2><p>BBQ에 대해 더 자세히 알고 싶다면 다음 리소스를 확인하세요:</p><ul><li><p><a href="https://www.elastic.co/kr/search-labs/blog/better-binary-quantization-lucene-elasticsearch">루씬과 Elasticsearch의 이진 정량화(BBQ)</a></p></li><li><p><a href="https://www.elastic.co/kr/search-labs/blog/bit-vectors-elasticsearch-bbq-vs-pq">더 나은 바이너리 정량화(BBQ) 대 제품 정량화</a></p></li><li><p><a href="https://www.elastic.co/kr/search-labs/blog/optimized-scalar-quantization-elasticsearch">최적화된 스칼라 양자화: 더욱 향상된 바이너리 양자화</a></p></li><li><p><a href="https://www.youtube.com/watch?v=04NzMt2Nigc">더 나은 바이너리 정량화(BBQ): 바이트에서 BBQ로, 더 나은 벡터 검색의 비결, 벤 트렌트의 글</a></p></li></ul>]]></content:encoded>
    <link>https://www.elastic.co/search-labs/blog/bbq-implementation-into-use-case</link>
    <guid isPermaLink="true">https://www.elastic.co/search-labs/blog/bbq-implementation-into-use-case</guid>
    <category><![CDATA[벡터 데이터베이스]]></category>
    <category><![CDATA[기본]]></category>
    <dc:creator><![CDATA[Sachin Frayne,Jessica Garson]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt3dd0495b536b2615/6a17e2b0414c6488459450e3/66842055367cdd795532b01c167f2a4b03dc65e3-1200x628.png" length="0" type="image/png"/>
    <pubDate>Wed, 23 Apr 2025 00:00:00 GMT</pubDate>
  </item>
  </channel>
</rss>