소식
모델
API
keyboard_arrow_down
리더
URL을 읽거나 검색하면 대규모 모델에 대한 지원이 더 향상됩니다.
벡터 모델
세계적 수준의 다중 모드 다중 언어 임베딩.
재배열자
검색 관련성을 극대화하는 세계적 수준의 신경 검색기입니다.
Elastic Inference Service
Jina 모델을 Elasticsearch에서 네이티브 방식으로 실행하세요.
MCP terminal명령줄articlellms.txtsmart_toy대리인data_object모델menu_book문서



로그인
login
reranker란 무엇인가?
jina-reranker-v1-base-en을 사용해야 하는 이유는?
시작하기 전에: LlamaIndex Node-Postprocessors에 대한 참고 사항
Google Colab에서 따라하기
결론
기술 블로그
3월 07, 2024

Jina Reranker와 LlamaIndex를 활용한 정밀한 RAG 구현

Jina Reranker와 LlamaIndex로 RAG를 한 단계 업그레이드하세요!
Collaborative graphic with "RERANKER" and "Llamalindex" logos over a purple background with crossed white abstract lines.
Francesco Kruk
Saahil Ognawala
Francesco Kruk, Saahil Ognawala • 7 독서의 분

bi-encoder 모델과 같은 Jina Embeddings는 미리 계산된 임베딩의 데이터베이스에서 많은 매칭 문서를 빠르게 검색할 수 있지만, reranker 모델은 사용자의 쿼리와 검색된 문서를 크로스 인코딩하는 더 느리지만 정확한 방식을 사용하여 이 세트를 정제할 수 있습니다. Jina AI는 첫 번째 reranker 모델인 jina-reranker-v1-base-en을 출시했으며, 이 글에서는 reranker가 RAG 정확도를 최적화하는 데 왜 필수적인지에 대한 심층적인 설명과 Jina Embeddings/Reranker, LlamaIndex, 그리고 Mixtral-8x7B-Instruct-v0.1 언어 모델(HuggingFace에서 호스팅)을 사용하여 최신 RAG 시스템을 구축하는 방법을 소개하겠습니다.

필요한 것:

  • Jina Embeddings와 Reranker API를 위한 통합 키
  • HuggingFace 계정과 토큰
Reranker API
Maximize the search relevancy and RAG accuracy at ease

Jina Embeddings와 Reranker 모델 및 Mixtral은 원격으로 실행되고 RESTful API를 통해 접근하므로 특별한 하드웨어가 필요하지 않습니다.

tagreranker란 무엇인가?

튜토리얼을 계속하기 전에, reranker가 무엇인지 이해하는 것이 중요합니다. reranker가 무엇이고 Jina Reranker V1이 최선의 선택인 이유를 완전히 이해하려면, 계속하기 전에 Jina Reranker V1 출시 포스트를 읽어보시기 바랍니다.

Maximizing Search Relevance and RAG Accuracy with Jina Reranker
Boost your search and RAG accuracy with Jina Reranker. Our new model improves the accuracy and relevance by 20% over simple vector search. Try it now for free!

요약하면, reranker는 문서-쿼리 쌍을 입력으로 받아 해당 입력 쌍에 대한 통합 관련성 점수를 출력하는 크로스 인코더 모델입니다. reranker를 사용하면 사용자는 주어진 쿼리에 대해 문서를 가장 관련성이 높은 것부터 낮은 순으로 정렬할 수 있습니다.

tagjina-reranker-v1-base-en을 사용해야 하는 이유는?

리랭킹은 임베딩 모델만 사용하는 것보다 훨씬 더 관련성 있는 정보를 제공합니다. 우리의 모델 출시 포스트에서, Jina Reranker가 오픈소스 및 클로즈드소스 경쟁자들과 비교하여 두드러지며 검색 시스템의 적중률을 8%, 평균 역순위를 33% 향상시킬 수 있다는 것을 보여주었습니다.

이는 RAG 솔루션을 통해 얻은 응답의 품질에 직접적인 영향을 미칩니다. 이론적 근거와 함께, LlamaIndex로 구축된 RAG 파이프라인에서 Jina Reranker가 어떤 효과를 내는지 실제 예제를 통해 보여드리겠습니다.

tag시작하기 전에: LlamaIndex Node-Postprocessors에 대한 참고 사항

LlamaIndex의 node-postprocessor는 쿼리 엔진 내에서 검색 후 응답 합성 전에 노드를 변환하거나 필터링하는 모듈입니다. 이 패키지의 일부로, LlamaIndex는 내장 옵션과 커스텀 추가를 위한 API를 모두 제공합니다.

Jina Reranker는 이제 node postprocessor로 LlamaIndex에 통합되었습니다. 응답 정확도를 높이기 위해 검색된 노드들은 쿼리와의 관련성에 따라 재정렬되고, 상위 N개의 노드가 반환됩니다.

tagGoogle Colab에서 따라하기

이 튜토리얼에는 Google Colab이나 로컬에서 실행할 수 있는 노트북이 함께 제공됩니다.

llama_index/docs/docs/examples/node_postprocessor/JinaRerank.ipynb at main · run-llama/llama_index
LlamaIndex is a data framework for your LLM applications - run-llama/llama_index
GitHubrun-llama

tag데이터셋: 2024 Nike Kids 제품 카탈로그

Jina Reranker의 RAG 애플리케이션에 대한 성능 향상을 보여주기 위해, 2024 Nike Kids 제품 카탈로그를 데이터셋으로 선택했습니다. 이 문서는 2024년 Nike의 키즈 제품 라인업을 구조화된 형태로 담고 있습니다. 이 데이터셋은 reranker의 효과를 명확하게 보여주고 대부분의 사용자가 공감할 수 있어 선택했습니다.

tag사전 요구사항 설치

요구사항을 설치하려면 다음을 실행하세요:

pip install llama-index-postprocessor-jinaai-rerank
pip install llama-index-embeddings-jinaai
pip install llama-index
pip install llama-index-llms-huggingface
pip install "huggingface_hub[inference]"

tagMixtral LLM 접근하기

Mixtral-8x7B-Instruct-v0.1 LLM을 사용하려면 HuggingFace 토큰이 필요합니다.

from llama_index.llms.huggingface import HuggingFaceInferenceAPI

hf_inference_api_key = "<your HuggingFace access token here>"

mixtral_llm = HuggingFaceInferenceAPI(
    model_name="mistralai/Mixtral-8x7B-Instruct-v0.1",
    token=hf_inference_api_key,
)

tagJina Embeddings와 Jina Reranker 접근하기

Jina Embeddings와 Jina Reranker를 사용하려면 전용 API 키가 필요합니다. api_key라는 변수에 저장하고 LlamaIndex에서 Jina Embeddings 모델을 호출하세요:

from llama_index.embeddings.jinaai import JinaEmbedding

api_key = "<your Jina key here>"
jina_embeddings = JinaEmbedding(api_key=api_key)

마찬가지로 Jina Reranker 모델을 호출할 수 있습니다. top_n 매개변수를 설정하여 최종 출력에서 반환할 가장 관련성 높은 문서의 수를 결정할 수 있습니다. 이 경우에는top_n=2:

from llama_index.postprocessor.jinaai_rerank import JinaRerank

jina_rerank = JinaRerank(api_key=api_key, top_n=2)

tag2024년 나이키 키즈 제품 카탈로그 다운로드하기

데이터를 다운로드하려면 다음 코드를 실행하세요:

from llama_index.core import SimpleDirectoryReader
import requests

url = '<https://niketeam-asset-download.nike.net/catalogs/2024/2024_Nike%20Kids_02_09_24.pdf?cb=09302022>'
response = requests.get(url)

with open('Nike_Catalog.pdf', 'wb') as f:
    f.write(response.content)

reader = SimpleDirectoryReader(
    input_files=["Nike_Catalog.pdf"]
)

documents = reader.load_data()

tagJina Embeddings로 임베딩 생성 및 인덱싱하기

이제 설정이 완료되었으니 임베딩 벡터(노드)를 생성하고 인덱싱하겠습니다. Jina Embeddings v2 모델은 최대 8192 토큰의 입력을 허용하므로, 이런 문서의 경우 추가적인 텍스트 분할이나 섹션의 토큰 수를 확인할 필요가 없습니다. 문서를 임베딩하고 인덱싱하려면 다음 코드를 실행하세요:

from llama_index.core import VectorStoreIndex

index = VectorStoreIndex.from_documents(
    documents=documents, embed_model=jina_embeddings
)

tagJina Reranker 없이 결과 쿼리하기

텍스트 세트에서 특정 정보를 쿼리할 때, LlamaIndex query_engine는 다음과 같은 작업을 수행합니다:

  1. Jina Embeddings V2로 쿼리에 대한 임베딩을 생성합니다.
  2. 인덱스를 사용하여 쿼리 임베딩과 코사인 유사도가 가장 높은 top_k = 10개의 저장된 임베딩을 가져와 인덱스에서의 위치를 반환합니다.
  3. 벡터 데이터 배열에서 해당하는 텍스트를 찾습니다.

나이키의 최고의 저지가 원단 측면에서 어떤지 물어보겠습니다:

query_engine = index.as_query_engine(
    similarity_top_k=10, llm=mixtral_llm
)
response = query_engine.query(
    "What are the best padded pants that Nike sells?",
)

print(response.source_nodes[0].text)

결과:

NIKE KIDS  EQUIPMENT87NIKE BRASILIA SMALL DUFFEL 9.5 
DM3976 $37.00
SIZES: Misc  OFFER DATE: 07/01/22  END DATE: 07/01/25
Tough 600D polyester • Durable 300D polyester • Detachable shoulder
strap • Ventilated shoe or wet/dry storage • Secure zip pocket • 
Limited lifetime guarantee • Screened Swoosh design trademark
DIMENSIONS:  20" L x 10" W x 11" H 
010 Black/Black/(White) 068 Iron Grey/Black/(White)
...
Three Nike Brasilia Small Duffel Bags, $37 each, in black, grey, navy with features listed and offer dates from 07/01/22 to 0

tagReranker를 사용한 결과 쿼리하기

이제 리랭커를 적용하여 RAG 애플리케이션이 다른, 더 관련성 있는 결과를 제공하는지 확인해보겠습니다. 이를 위해 query_engine에 node_postprocessors를 추가해야 합니다:

query_engine = index.as_query_engine(
    similarity_top_k=10, llm=mixtral_llm, node_postprocessors=[jina_rerank]
)
response = query_engine.query(
    "What are the best padded pants that Nike sells?",
)

print(response.source_nodes[0].text)

리랭커를 사용하지 않은 이전 경우와 비교하여, query_engine에는 이제 [jina_rerank]로 설정된 node_postprocessors 매개변수가 포함되어 있습니다.

결과:

NIKE KIDS  FOOTBALL – STOCK10
DJ5731 $47.00
SIZES:  XS, S, M, L, XL, 2XL, 3XL
FABRIC:  Body/panels lining: 100% polyester. Pad: 100%
ethylene vinyl acetate.
OFFER DATE:  04/01/23
END DATE:  04/01/27
Take the field ready to give it your all in the Nike Recruit
Pants. They're made from lightweight, stretchy fabric with
sweat-wicking power to help keep you dry and moving freely
when the game heats up. With integrated pads shaped for a
comfortable fit, you'll be prepared for a performance you can
be proud of. Choose from 6 different colors to outfit your
team. Nike Dri-FIT technology moves sweat away from your skin
for quicker evaporation, helping you stay dry and comfortable.
Lightweight knit fabric stretches with you to let you move
naturally. Thigh, knee, hip and tailbone pads are shaped for
an optimal fit, without compromising on coverage. A
body-hugging fit is designed to help keep the padding in place
and close to the body. Belt at the waist lets you dial in your
perfect fit to maximize comfort. Elastic at hems.
Hip width: 15", Inseam length: 11.75" (size medium).
010 Black/(White) 060 Team Anthracite/(White) 100 White/(Black)
419 Team Navy/(White) 493 Team Royal/(White) 657 Team Scarlet/(White)

Product display of boys' Nike DF Stock Recruit Pants with sizes, pricing, and various color options highlighted.

tag결론

보시다시피, 리랭커 없이 쿼리한 결과는 "통기성을 위한 메쉬 백"과 "부드러운 감촉의 슬림핏"을 언급하는 상위 결과를 보여줍니다. 반면에 리랭커를 사용하면 "최적의 통기성을 위해 설계된", "경기일의 압박감 속에서도 건조하고 시원하게 유지해주는 수분 흡수 디자인"과 "여유롭고 편안한 핏의 가벼운 원단"을 특징으로 하는 상위 결과를 얻을 수 있습니다.

두 번째 결과가 우리가 던진 쿼리에 대해 훨씬 더 정확하고 적절합니다. 최근 두 포스트에서 우리는 이론적 관점과 실제적 관점 모두에서 RAG 파이프라인에 Jina Reranker를 추가하면 검색 정확도가 높아지고 응답의 품질이 향상된다는 것을 보여주었습니다.

범주:
기술 블로그
rss_feed

더 많은 뉴스
3월 11, 2026 • 7 독서의 분
멀티모달 LLM 을 활용한 오디오 임베딩 부트스트래핑
Han Xiao
Abstract illustration of a sound wave or heartbeat, formed by blue, orange, and gray dots on a white background.
3월 06, 2026 • 6 독서의 분
원시 수치 값에서 임베딩 모델 식별하기
Han Xiao
Fingerprint illustration made from numbers, showcasing digital and high-tech design on a light background.
9월 09, 2025 • 11 독서의 분
Llama.cpp 및 GGUF의 멀티모달 向量模型
Andrei Ungureanu
Alex C-G
Cartoon llama in the center of a white background, emitting laser-like beams from its eyes. The illustration creates a playfu
검색 기반
리더
벡터 모델
재배열자
Elastic Inference Service
open_in_new
Jina API 키 받기
비율 제한
API 상태
회사
회사 소개
영업팀에 문의
소식
인턴십 프로그램
지나 로고 다운로드
open_in_new
Elastic 로고 다운로드
open_in_new
자귀
안전
이용약관
은둔
쿠키 관리
email
Elastic © 2020-2026.