How deveworld/kort works
Project Type and Purpose
• KorT is an open-source benchmarking tool (a CLI + Python library) for evaluating Korean translation quality using large language models (LLM-as-a-judge). It also provides a minimal leaderboard web server to expose results.
File Structure Analysis
• src/kort/data: Dataset handling, prompt generation, and evaluation orchestration.
• src/kort/models: Adapters for OpenAI, Anthropic, Google, and custom models (batch and non-batch).
• src/kort/translators: Adapters for various translation APIs (DeepL, Google, Naver, Kakao, plus “from_model”).
• src/kort/evaluators: Logic to invoke LLMs (single or batch) or human evaluators to score translations.
• src/kort/leaderboards: Components for generating text-based or simple web leaderboards.
• src/kort/scripts: CLI entry points for generation, evaluation, batch evaluation, and leaderboard serving.
• src/kort/utils: Shared utilities (e.g., dynamic imports).
Key Insights from README
• Two main user flows:
a. Generate: take dataset → translator adapters → fetch MT outputs.
b. Evaluate: take generated outputs → evaluator adapters → score with LLM.
• Leaderboard: ingest scored data → expose via CLI or lightweight web server.
• All external services are REST/HTTP-based APIs (OpenAI, Anthropic, DeepL, etc.).
• Storage is file-based JSON (no external DB).
Main Components
a. CLI Layer
• Scripts: generate, evaluate, eval_batch, leaderboard.
b. Core Library
• Data Manager (load prompts & examples)
• Translator Factory & Adapters
• Model/Evaluator Factory & Adapters
• Leaderboard Generator (text & web)
• Utils (dynamic import, config)
c. External Services
• Translation APIs (DeepL, Google, Naver, etc.)
• LLM Evaluation APIs (OpenAI GPT, Claude, Gemini, batch APIs)
d. Storage
• Input dataset files (JSON/CSV)
• Generated translations (JSON)
• Evaluation results (JSON)
Component Relationships and Data Flows
• User invokes a CLI script → the script calls into Data Manager to load sentences.
• Data Manager hands off to Translator Adapter → calls external translation API → returns translations → writes to storage.
• CLI script for evaluation loads generated files → passes to Evaluator Adapter → calls LLM evaluation API (single or batch) → writes scored results.
• Leaderboard script reads scored results → passes to Leaderboard Generator → outputs text or launches web server.
• All adapters derive from a common base class (plugin pattern) to allow adding new APIs.
Architectural Patterns and Principles
• Plugin Architecture: Base classes in models and translators allow adding new adapters without changing core logic.
• Factory Pattern: Script arguments (-t, -n) select appropriate adapter implementation at runtime.
• Separation of Concerns: Clear layers for data I/O, translation, evaluation, and presentation.
• File-based Pipeline: Each stage persists results to JSON, enabling reproducibility and manual inspection.
Detail Level
• Be exhaustive in breaking out sub-packages (e.g., show kort/translators/deepl_api.py under the Translator group).
• JSON file flows between stages.
• Denote the optional batch‐evaluation path (two‐step job registration & result fetch).