Korean-optimized RAG evaluation toolkit based on ranx with Kiwi tokenizer and Korean language support
Project description
ranx-k: Korean-optimized ranx IR Evaluation Toolkit ๐ฐ๐ท
ranx-k๋ ํ๊ตญ์ด์ ์ต์ ํ๋ ์ ๋ณด ๊ฒ์(IR) ํ๊ฐ ๋๊ตฌ๋ก, ๊ธฐ์กด ranx ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํ์ฅํ์ฌ Kiwi ํ ํฌ๋์ด์ ์ ํ๊ตญ์ด ์๋ฒ ๋ฉ์ ์ง์ํฉ๋๋ค. RAG(Retrieval-Augmented Generation) ์์คํ ์ ์ฑ๋ฅ์ ์ ํํ๊ฒ ํ๊ฐํ ์ ์์ต๋๋ค.
๐ ์ฃผ์ ํน์ง
- ํ๊ตญ์ด ํนํ: Kiwi ํํ์ ๋ถ์๊ธฐ๋ฅผ ํ์ฉํ ์ ํํ ํ ํฐํ
- ranx ๊ธฐ๋ฐ: ๊ฒ์ฆ๋ IR ํ๊ฐ ๋ฉํธ๋ฆญ (Hit@K, NDCG@K, MRR ๋ฑ) ์ง์
- ๋ค์ํ ํ๊ฐ ๋ฐฉ๋ฒ: ROUGE, ์๋ฒ ๋ฉ ์ ์ฌ๋, ์๋ฏธ์ ์ ์ฌ๋ ๊ธฐ๋ฐ ํ๊ฐ
- ์ค์ฉ์ ์ค๊ณ: ํ๋กํ ํ์ ๋ถํฐ ํ๋ก๋์ ๊น์ง ๋จ๊ณ๋ณ ํ๊ฐ ์ง์
- ๋์ ์ฑ๋ฅ: ๊ธฐ์กด ๋ฐฉ๋ฒ ๋๋น 30~80% ํ๊ตญ์ด ํ๊ฐ ์ ํ๋ ํฅ์
๐ฆ ์ค์น
pip install ranx-k
๋๋ ๊ฐ๋ฐ ๋ฒ์ ์ค์น:
pip install "ranx-k[dev]"
๐ง ๋น ๋ฅธ ์์
๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ
from ranx_k.evaluation import simple_kiwi_rouge_evaluation
# ๊ฐ๋จํ Kiwi ROUGE ํ๊ฐ
results = simple_kiwi_rouge_evaluation(
retriever=your_retriever,
questions=your_questions,
reference_contexts=your_reference_contexts,
k=5
)
print(f"ROUGE-1: {results['kiwi_rouge1@5']:.3f}")
print(f"ROUGE-2: {results['kiwi_rouge2@5']:.3f}")
print(f"ROUGE-L: {results['kiwi_rougeL@5']:.3f}")
ํฅ์๋ ํ๊ฐ (Rouge Score + Kiwi)
from ranx_k.evaluation import rouge_kiwi_enhanced_evaluation
# ๊ฒ์ฆ๋ rouge_score ๋ผ์ด๋ธ๋ฌ๋ฆฌ + Kiwi ํ ํฌ๋์ด์
results = rouge_kiwi_enhanced_evaluation(
retriever=your_retriever,
questions=your_questions,
reference_contexts=your_reference_contexts,
k=5,
tokenize_method='morphs', # 'morphs' ๋๋ 'nouns'
use_stopwords=True
)
์๋ฏธ์ ์ ์ฌ๋ ๊ธฐ๋ฐ ranx ํ๊ฐ
from ranx_k.evaluation import evaluate_with_ranx_similarity
# ์๋ฏธ์ ์ ์ฌ๋๋ฅผ ranx ํ์์ผ๋ก ๋ณํ
results = evaluate_with_ranx_similarity(
retriever=your_retriever,
questions=your_questions,
reference_contexts=your_reference_contexts,
k=5,
method='kiwi_rouge', # 'embedding', 'kiwi_rouge'
similarity_threshold=0.6
)
print(f"Hit@5: {results['hit_rate@5']:.3f}")
print(f"NDCG@5: {results['ndcg@5']:.3f}")
print(f"MRR: {results['mrr']:.3f}")
์ข ํฉ ํ๊ฐ
from ranx_k.evaluation import comprehensive_evaluation_comparison
# ๋ชจ๋ ํ๊ฐ ๋ฐฉ๋ฒ ๋น๊ต
comparison = comprehensive_evaluation_comparison(
retriever=your_retriever,
questions=your_questions,
reference_contexts=your_reference_contexts,
k=5
)
๐ ํ๊ฐ ๋ฐฉ๋ฒ
1. Kiwi ROUGE ํ๊ฐ
- ์ฅ์ : ๋น ๋ฅธ ์๋, ์ง๊ด์ ํด์
- ์ฉ๋: ํ๋กํ ํ์ดํ, ๋น ๋ฅธ ํผ๋๋ฐฑ
2. Enhanced ROUGE (Rouge Score + Kiwi)
- ์ฅ์ : ๊ฒ์ฆ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ, ์์ ์ฑ
- ์ฉ๋: ํ๋ก๋์ ํ๊ฒฝ, ์ ๋ขฐ์ฑ ์ค์ํ ํ๊ฐ
3. ์๋ฏธ์ ์ ์ฌ๋ ๊ธฐ๋ฐ ranx
- ์ฅ์ : ์ ํต์ IR ๋ฉํธ๋ฆญ, ์๋ฏธ์ ์ ์ฌ๋
- ์ฉ๋: ์ฐ๊ตฌ, ๋ฒค์น๋งํน, ์์ธ ๋ถ์
๐ฏ ์ฑ๋ฅ ๊ฐ์ ์ฌ๋ก
# ๊ธฐ์กด ๋ฐฉ๋ฒ (์์ด ํ ํฌ๋์ด์ )
basic_rouge1 = 0.234
# ranx-k (Kiwi ํ ํฌ๋์ด์ )
ranxk_rouge1 = 0.421 # +79.9% ํฅ์!
๐ ์ ์ ํด์ ๊ฐ์ด๋
| ์ ์ ๋ฒ์ | ํ๊ฐ | ๊ถ์ฅ ์กฐ์น |
|---|---|---|
| 0.7 ์ด์ | ๐ข ๋งค์ฐ ์ข์ | ํ์ฌ ์ค์ ์ ์ง |
| 0.5~0.7 | ๐ก ์ํธ | ๋ฏธ์ธ ์กฐ์ ๊ณ ๋ ค |
| 0.3~0.5 | ๐ ๋ณดํต | ๊ฐ์ ํ์ |
| 0.3 ๋ฏธ๋ง | ๐ด ๋ฎ์ | ์์คํ ์ฌ๊ฒํ |
๐ ๋ฌธ์ํ
์์ธํ ์ฌ์ฉ๋ฒ๊ณผ ์์ ๋ docs ํด๋์ ๊ฐ์ด๋๋ฅผ ์ฐธ์กฐํ์ธ์.
๐ค ๊ธฐ์ฌํ๊ธฐ
ranx-k๋ ์คํ์์ค ํ๋ก์ ํธ์ ๋๋ค. ๊ธฐ์ฌ๋ฅผ ํ์ํฉ๋๋ค!
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ ๋ผ์ด์ ์ค
์ด ํ๋ก์ ํธ๋ MIT ๋ผ์ด์ ์ค ํ์ ๋ฐฐํฌ๋ฉ๋๋ค. ์์ธํ ๋ด์ฉ์ LICENSE ํ์ผ์ ์ฐธ์กฐํ์ธ์.
๋ผ์ด์ ์ค ๋ฐ ์ ์๊ถ
์ด ํ๋ก์ ํธ๋ ๋ค์ ์คํ์์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค์ ๊ธฐ๋ฐ์ผ๋ก ๊ฐ๋ฐ๋์์ต๋๋ค:
- rouge_score: Copyright (c) 2022 The rouge_score Authors (Apache License 2.0)
- ranx: Copyright (c) 2021 Elias Bassani (MIT License)
- kiwipiepy: Copyright (c) 2021 bab2min (LGPL v3.0)
- ์์ ๋ฐ ํ์ฅ: Copyright (c) 2025 Pandas Studio (MIT License)
๐ ๊ฐ์ฌ์ ๋ง
- ranx: ๋ฐ์ด๋ IR ํ๊ฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ๊ณตํด์ฃผ์ Elias Bassani๋
- Kiwi: ๋ฐ์ด๋ ํ๊ตญ์ด ํํ์ ๋ถ์๊ธฐ๋ฅผ ์ ๊ณตํด์ฃผ์ bab2min๋
- rouge_score: Google Researchํ์ ROUGE ๊ตฌํ
๐ ์ง์
- ๐ ๋ฒ๊ทธ ๋ฆฌํฌํธ: GitHub Issues
- ๐ฌ ์ง๋ฌธ ๋ฐ ํ ๋ก : GitHub Discussions
- ๐ง ์ด๋ฉ์ผ: ontofinance@gmail.com
ranx-k์ ํจ๊ป ๋ ์ ํํ ํ๊ตญ์ด IR ํ๊ฐ๋ฅผ ๊ฒฝํํด๋ณด์ธ์! ๐๐ฐ๐ท
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ranx_k-0.0.1.tar.gz.
File metadata
- Download URL: ranx_k-0.0.1.tar.gz
- Upload date:
- Size: 31.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d26cf62067d73f4d434266ed3636716b4474010070d59873b830a7c1f7c1abb1
|
|
| MD5 |
dc88176a0cd6a8373e990a31d2ce22b7
|
|
| BLAKE2b-256 |
5820714034f807dbeb1bb91070b53340f9e91f62b029cb1d4df6f1df76472c67
|
File details
Details for the file ranx_k-0.0.1-py3-none-any.whl.
File metadata
- Download URL: ranx_k-0.0.1-py3-none-any.whl
- Upload date:
- Size: 37.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9b93c0dd0081d6889acfff981c48f5540a9705db11f8dd526dd7501f515fe8c
|
|
| MD5 |
d086ac868a73c3f8d5bf52fa3a3be3a2
|
|
| BLAKE2b-256 |
f5f992f05f0c486098c84b5a50619fd221ec2959d64e370b6cdec66c0fad2768
|