
Use LLMs for document ranking
문서 랭킹에 LLM을 사용하세요.
AI에는 문제를 완전히 정의하지 않고도 "문제를 던져 넣으면" 어떤 결과를 얻을 수 있는 힘이 있습니다. 예를 들어, 코드 diff 묶음과 보안 권고문을 주고 "이 diff 중 어느 것이 보안 버그를 수정할 가능성이 가장 높아 보이나요?"라고 물어볼 수 있습니다. 하지만 항상 그렇게 쉬운 것은 아닙니다.
우리는 이러한 문제를 우회하고 LLM이 처리하기 어려운 일반적인 랭킹 문제를 해결하기 위해 raink를 만들었습니다. 이 기법에 대한 자세한 배경은 블로그 게시물 raink: Use LLMs for Document Ranking에서, raink를 공격 보안 문제에 적용한 방법은 강연 Patch Perfect: Harmonizing with LLMs to Find Security Vulns에서 확인할 수 있습니다.
git clone https://github.com/bishopfox/raink
cd raink
go install
OPENAI_API_KEY 환경 변수를 설정하세요.
raink -h
Usage of raink:
-f string
Input file
-p string
Initial prompt
-r int
Number of runs (default 10)
-s int
Batch size (default 10)
2분 이내에 100개의 문장을 비교합니다.
raink \
-f testdata/sentences.txt \
-r 10 \
-s 10 \
-p 'Rank each of these items according to their relevancy to the concept of "time".' |
jq -r '.[:10] | map(.value)[]' |
nl
1 The train arrived exactly on time.
2 The old clock chimed twelve times.
3 The clock ticked steadily on the wall.
4 The bell rang, signaling the end of class.
5 The rooster crowed at the break of dawn.
6 She climbed to the top of the hill to watch the sunset.
7 He watched as the leaves fell one by one.
8 The stars twinkled brightly in the clear night sky.
9 He spotted a shooting star while stargazing.
10 She opened the curtains to let in the morning light.
이 프로젝트는 MIT 라이선스를 따릅니다.