translation-agent  by andrewyng

Agentic translation demo using reflection workflow

created 1 year ago
5,477 stars

Top 9.2% on SourcePulse

GitHubView on GitHub
Project Summary

This project demonstrates an agentic workflow for machine translation using Large Language Models (LLMs), offering high customizability for style, idiom handling, and regional dialects. It targets researchers and developers interested in exploring LLM-based translation and its potential to improve upon traditional methods or generate training data.

How It Works

The core approach involves a three-step reflection workflow: LLM-driven translation, LLM-based self-critique and suggestion generation, and LLM-guided refinement of the translation. This iterative process allows for fine-grained control over translation output, such as specifying regional variations or adhering to custom glossaries, which is difficult with standard end-to-end MT systems.

Quick Start & Requirements

  • Installation: Requires Poetry. Clone the repository, then run poetry install and poetry shell.
  • Prerequisites: An .env file with OPENAI_API_KEY is mandatory.
  • Usage: import translation_agent as ta; translation = ta.translate(source_lang, target_lang, source_text, country)
  • Example: See examples/example_script.py.

Highlighted Details

  • Demonstrates steerability for translation style, idiom handling, and regional dialects via prompt engineering.
  • Evaluations show performance competitive with, and sometimes exceeding, commercial offerings, though BLEU scores can be lower.
  • Potential to automatically generate parallel text corpora for training traditional MT models.
  • Primarily prototyped with gpt-4-turbo, with suggestions to experiment with other LLMs.

Maintenance & Community

This is a personal project by Andrew Ng, with contributions from Joaquin Dominguez, Nedelina Teneva, and John Santerre. It is presented as a demonstration to encourage discussion and contributions.

Licensing & Compatibility

Released under the MIT License, permitting commercial and non-commercial use, modification, and distribution.

Limitations & Caveats

The project is explicitly stated as "not mature software" and its performance can be inconsistent, sometimes worse than commercial offerings. Evaluation metrics like BLEU may not fully capture the quality improvements achieved by the agentic approach.

Health Check
Last commit

1 year ago

Responsiveness

1+ week

Pull Requests (30d)
0
Issues (30d)
0
Star History
35 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.