>기술 주변기기 >일체 포함 >RAG의 재 계산 에이전트로서의 RankGpt (튜토리얼)

RAG의 재 계산 에이전트로서의 RankGpt (튜토리얼)

Christopher Nolan
Christopher Nolan원래의
2025-03-04 09:05:11634검색
검색 증강 생성 (RAG)은 텍스트를 생성 할 때 외부 정보를 사용할 수있게하여 대형 언어 모델 (LLM)을 더 똑똑하고 정확하게 만드는 기술입니다. 그러나 큰 도전은 거대한 데이터 모음에서 올바른 문서 나 구절을 선택하는 것입니다.

RANKGPT는 RAG 파이프 라인의 재 속도 단계를 개선 하여이 문제를 해결합니다. LLM의 깊은 이해 기능을 사용하여 가장 관련성이 높은 정보를 더 잘 평가하고 순위를 매기는 것입니다. 이 기사에서는 RANKGPT를 소개하고 RAG AI 응용 프로그램에 어떻게 통합 할 수 있는지 시연 할 것입니다.

검색 증강 생성 (RAG) 이해

검색 증강 생성 (RAG)은 LLM과 정보 검색 시스템을 결합한 방법입니다. 즉, LLM이 텍스트를 생성하도록 요청 받으면 외부 소스에서 관련 정보를 가져와 응답이 더 정확하고 정보를 제공 할 수 있습니다. rag는 리트리버와 발전기의 두 가지 주요 구성 요소와 선택적 구성 요소 인 재 라인으로 구성됩니다.

리트리버 - 리트리버의 작업은 사용자의 쿼리를 기반으로 큰 문서 세트에서 관련 문서 나 텍스트 세그먼트를 찾는 것입니다. BM25와 같은 알고리즘을 사용하여 문서를 관련성으로 평가합니다. reranker (선택 사항) - 재 ranker는 초기 검색된 문서 세트를 가져 와서 가장 관련성이 높은 문서가 맨 위에 있는지 확인합니다. 이것은 덜 유용한 정보를 걸러 내고 중요한 것에 집중하는 데 도움이됩니다.

생성기 - 발전기는 검색된 문서를 사용하여 최종 출력을 생성하는 LLM입니다. 관련 외부 데이터에 대한 액세스는보다 정확한 응답을 생성 할 수 있습니다.

rag

에서 RankGpt의 역할과 이점 RANKGPT는 LLM을 사용하여 검색된 문서 또는 텍스트 세그먼트의 관련성을 평가하여 가장 중요한 것들이 맨 위에 있는지 확인합니다. RANKGPT를 사용하면 RAG 파이프 라인의 발전기가 고품질의 입력을 얻어보다 정확한 응답을 초래합니다. 개선 된 관련성과 성능 rankgpt는 쿼리와 문서의 더 깊은 의미와 맥락을 이해함으로써 간단한 키워드 일치를 넘어선 것입니다. 이를 통해 LLM에 대한보다 정확한 정보를 제공하여 키워드뿐만 아니라 실제 의미를 기반으로 가장 관련성있는 컨텐츠를 식별 할 수 있습니다. 제로 샷 교육 순열 생성과 함께 GPT-4를 사용할 때 RankGpt 효율적이고 비용 효율적인 증류

RANKGPT는 순열 증류를 사용하여 GPT-4와 같은 대형 모델의 순위 능력을 더 작은 특수 모델로 전달합니다.이 소규모 모델은 훨씬 더 효율적으로 고성능을 유지합니다. 예를 들어, 증류 된 440m 모델은 BEIR 벤치 마크에서 3B 감독 모델을 능가하여 계산 비용을 크게 줄이는 동시에 더 나은 결과를 얻었습니다. 새롭고 알려지지 않은 정보 처리

RANKGPT에는 견고성을 보장하고 데이터 오염 문제를 해결하기위한 Noveleval 테스트 세트가 포함되어 있습니다. 이 세트는 최근 및 알려지지 않은 정보를 기반으로 구절을 순위하는 모델의 능력을 평가합니다. GPT-4이 테스트에서 최첨단 성능을 달성하여 신규 및 보이지 않는 쿼리를 효과적으로 처리 할 수있는 능력을 보여줍니다. rankgpt 벤치 마크 성능 rankgpt (GPT-4)는 TREC 및 BEIR의 다른 모든 모델을 능가하며, 아래 표에 표시된 것처럼 평균 NDCG@10 점수 53.68입니다. BEIR 데이터 세트에서 가장 높은 결과를 얻었으며 Monot5 (3B) 및 Cohere Rerank-V2와 같은 강력한 감독 모델을 제압했습니다. GPT-3.5-Turbo를 사용하더라도 RankGPT는 경쟁적으로 점수를 매 깁니다.

출처 : Weiwei Sun et al., 2023 rankgpt (GPT-4)는 Mr.Tydi 데이터 세트에서 강력하게 수행되어 평균 NDCG@10 점수 62.93으로 BM25와 MMARCOCE를 모두 제압합니다. 그것은 지속적으로 BM25를 능가하고 심지어 많은 언어, 특히 인도네시아 및 스와힐리어에서 Mmarcoce를 능가합니다. 전반적으로, RankGpt는 Bengali, Indonesian 및 Japanese와 같은 많은 언어에서 가장 높은 점수를 얻었으며 Mmarcoce 뒤에 약간 지연된 몇 가지 경우가 있습니다.

출처 : Weiwei Sun et al., 2023 마지막으로, RankGPT는 Noveleval 데이터 세트에서 테스트되었으며, 이는 모델이 최근 및 익숙하지 않은 정보를 기반으로 구절을 얼마나 잘 평가할 수 있는지 측정했습니다. RANKGPT (GPT-4)는 특히 NDCG@10 점수 90.45에서 모든 평가 지표 (NDCG@1, NDCG@5 및 NDCG@10)에서 가장 높은 점수를 받았습니다. Monot5 (3B) 및 Monobert (340m)와 같은 다른 강력한 모델을 능가했으며, 이는 재선자로서의 강력한 성능을 강조합니다.

출처 : Weiwei Sun et al., 2023 모든 벤치 마크 결과에 걸쳐 RankGpt (GPT-4)는 감독 되든 감독되지 않은지 여부에 관계없이 다른 방법을 지속적으로 능가하여 재고의 우수한 능력을 보여줍니다. Rag Pipelines에서 RankGpt 구현 rankgpt를 헝겊 파이프 라인에 통합하는 방법은 다음과 같습니다. 1 단계 : RankGpt 저장소를 복제하십시오 먼저, RankGpt 저장소를 복제해야합니다. 터미널에서 다음 명령을 실행하십시오
git clone https://github.com/sunnweiwei/RankGPT
2 단계 : 환경을 설정하십시오 rankgpt 디렉토리로 이동하여 필요한 패키지를 설치하십시오. 제공된 요구 사항을 사용하여 가상 환경을 만들고 패키지를 설치할 수 있습니다.

3 단계 : RankGpt 구현 여기, 우리는 단순한 예제 쿼리를 사용하고 원래 RankGpt 저장소에서 제공하는 검색된 문서를 사용하고 있습니다.

제공된 순열 파이프 라인을 사용하여 검색된 문서를 RankGpt로 쉽게 재고 할 수 있습니다.

이것은 다음과 같은 새로운 문서를 초래할 것입니다 :

pip install -r requirements.txt
단계별 교육 순열 생성 순열 파이프 라인을보다 단계별로 구현하려면 RankGpt와 직접 상호 작용하여 다음과 같이 순열 명령을 작성하고 프로세스 할 수 있습니다.

item = {
    'query': 'How much impact do masks have on preventing the spread of the COVID-19?',
    'hits': [
        {'content': 'Title: Universal Masking is Urgent in the COVID-19 Pandemic: SEIR and Agent Based Models, Empirical Validation, Policy Recommendations Content: We present two models for the COVID-19 pandemic predicting the impact of universal face mask wearing upon the spread of the SARS-CoV-2 virus--one employing a stochastic dynamic network based compartmental SEIR (susceptible-exposed-infectious-recovered) approach, and the other employing individual ABM (agent-based modelling) Monte Carlo simulation--indicating (1) significant impact under (near) universal masking when at least 80% of a population is wearing masks, versus minimal impact when only 50% or less of the population is wearing masks, and (2) significant impact when universal masking is adopted early, by Day 50 of a regional outbreak, versus minimal impact when universal masking is adopted late. These effects hold even at the lower filtering rates of homemade masks. To validate these theoretical models, we compare their predictions against a new empirical data set we have collected'},
        {'content': 'Title: Masking the general population might attenuate COVID-19 outbreaks Content: The effect of masking the general population on a COVID-19 epidemic is estimated by computer simulation using two separate state-of-the-art web-based softwares, one of them calibrated for the SARS-CoV-2 virus. The questions addressed are these: 1. Can mask use by the general population limit the spread of SARS-CoV-2 in a country? 2. What types of masks exist, and how elaborate must a mask be to be effective against COVID-19? 3. Does the mask have to be applied early in an epidemic? 4. A brief general discussion of masks and some possible future research questions regarding masks and SARS-CoV-2. Results are as follows: (1) The results indicate that any type of mask, even simple home-made ones, may be effective. Masks use seems to have an effect in lowering new patients even the protective effect of each mask (here dubbed"one-mask protection") is'},
        {'content': 'Title: To mask or not to mask: Modeling the potential for face mask use by the general public to curtail the COVID-19 pandemic Content: Face mask use by the general public for limiting the spread of the COVID-19 pandemic is controversial, though increasingly recommended, and the potential of this intervention is not well understood. We develop a compartmental model for assessing the community-wide impact of mask use by the general, asymptomatic public, a portion of which may be asymptomatically infectious. Model simulations, using data relevant to COVID-19 dynamics in the US states of New York and Washington, suggest that broad adoption of even relatively ineffective face masks may meaningfully reduce community transmission of COVID-19 and decrease peak hospitalizations and deaths. Moreover, mask use decreases the effective transmission rate in nearly linear proportion to the product of mask effectiveness (as a fraction of potentially infectious contacts blocked) and coverage rate (as'}
    ]
}

rankgpt 에 대한 슬라이딩 윈도우 전략 (SWA) 모델이 한 번에 처리 할 수있는 것보다 더 많은 문서를 평가 해야하는 경우 슬라이딩 윈도우 전략을 사용하십시오. 슬라이딩 윈도우 전략을 문서를 재평가에 적용하는 방법은 다음과 같습니다.

from rank_gpt import permutation_pipeline
new_item = permutation_pipeline(
    item,
    rank_start=0,
    rank_end=3,
    model_name='gpt-3.5-turbo',
    api_key='Your OPENAI Key!'
)
print(new_item)
이 예에서 슬라이딩 윈도우의 크기는 2이고 스텝 크기가 1입니다. 즉, 한 번에 두 문서를 처리하여 다음 순위 패스에 대해 하나의 문서를 앞으로 이동시킵니다.

.

결론 이것은 컨텐츠 보장, 효율성 향상 및 오해의 소지가있는 정보를 생성 할 가능성을 줄이는 것과 같은 일반적인 문제를 해결합니다. 전반적으로, RankGPT는보다 신뢰할 수 있고 정확한 헝겊 응용 프로그램을 구축하는 데 기여합니다.
{
    'query': 'How much impact do masks have on preventing the spread of the COVID-19?',
    'hits': [
        {'content': 'Title: Universal Masking is Urgent in the COVID-19 Pandemic: SEIR and Agent Based Models, Empirical Validation, Policy Recommendations Content: We present two models for the COVID-19 pandemic predicting the impact of universal face mask wearing upon the spread of the SARS-CoV-2 virus--one employing a stochastic dynamic network based compartmental SEIR (susceptible-exposed-infectious-recovered) approach, and the other employing individual ABM (agent-based modelling) Monte Carlo simulation--indicating (1) significant impact under (near) universal masking when at least 80% of a population is wearing masks, versus minimal impact when only 50% or less of the population is wearing masks, and (2) significant impact when universal masking is adopted early, by Day 50 of a regional outbreak, versus minimal impact when universal masking is adopted late. These effects hold even at the lower filtering rates of homemade masks. To validate these theoretical models, we compare their predictions against a new empirical data set we have collected'},
        {'content': 'Title: To mask or not to mask: Modeling the potential for face mask use by the general public to curtail the COVID-19 pandemic Content: Face mask use by the general public for limiting the spread of the COVID-19 pandemic is controversial, though increasingly recommended, and the potential of this intervention is not well understood. We develop a compartmental model for assessing the community-wide impact of mask use by the general, asymptomatic public, a portion of which may be asymptomatically infectious. Model simulations, using data relevant to COVID-19 dynamics in the US states of New York and Washington, suggest that broad adoption of even relatively ineffective face masks may meaningfully reduce community transmission of COVID-19 and decrease peak hospitalizations and deaths. Moreover, mask use decreases the effective transmission rate in nearly linear proportion to the product of mask effectiveness (as a fraction of potentially infectious contacts blocked) and coverage rate (as'},
        {'content': 'Title: Masking the general population might attenuate COVID-19 outbreaks Content: The effect of masking the general population on a COVID-19 epidemic is estimated by computer simulation using two separate state-of-the-art web-based softwares, one of them calibrated for the SARS-CoV-2 virus. The questions addressed are these: 1. Can mask use by the general population limit the spread of SARS-CoV-2 in a country? 2. What types of masks exist, and how elaborate must a mask be to be effective against COVID-19? 3. Does the mask have to be applied early in an epidemic? 4. A brief general discussion of masks and some possible future research questions regarding masks and SARS-CoV-2. Results are as follows: (1) The results indicate that any type of mask, even simple home-made ones, may be effective. Masks use seems to have an effect in lowering new patients even the protective effect of each mask (here dubbed"one-mask protection") is'}
    ]
}
최고 AI 인증

ai.get 인증을 효과적이고 책임감있게 사용할 수 있음을 보여줍니다.

위 내용은 RAG의 재 계산 에이전트로서의 RankGpt (튜토리얼)의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.