Skip to main content

View Source Code

Browse the complete example on GitHub

What’s inside?

An efficient bidirectional translation system powered by Liquid AI’s LFM2 1.2B model fine-tuned for Korean-English translation. This project demonstrates how domain-specific fine-tuning can achieve superior performance compared to models 3x larger, outperforming Google’s Gemma-3 4B and Alibaba’s Qwen3 4B on the Flores-200 benchmark. Key features:
  • Automatic language detection - Intelligently detects input language and translates accordingly
  • High-quality translation - CHrF++ 32.96 / BLEU 12.05 on Flores-200 benchmark
  • Efficient inference - Runs on modest hardware with merged adapters for speed
  • Easy-to-use CLI - Simple command-line interface powered by Fire
This project was built and released by Kiwoong Yeom with the support of Maxime Labonne. Link to the original announcement on LinkedIn

Quick Start

  1. Clone the repository
  1. Install dependencies
  1. Run translation example

Understanding the Architecture

The system uses a two-stage training approach:
  1. Supervised Fine-tuning (SFT): 100K high-quality Korean-English parallel datasets establish the translation foundation
  2. Reinforcement Learning (RL): GRPO optimization with 10K additional samples refines translation quality

Model Components

  • Base Model: gyung/lfm2-1.2b-koen-mt-v4-100k - SFT fine-tuned LFM2 1.2B
  • Adapter: gyung/lfm2-1.2b-koen-mt-v5-rl-10k-adapter - LoRA adapter trained with GRPO
  • Automatic Detection: Regular expression pattern matching for Korean text (Hangul syllables, Jamo)
The system automatically detects the input language and applies the appropriate translation direction, supporting both English→Korean and Korean→English translation.

CLI Usage

Example Usage

Translate English to Korean:
Translate Korean to English:
Process a file:

Performance Benchmarks

On Flores-200 benchmark (1,012 samples): The 1.2B parameter model outperforms models 3x larger, demonstrating that specialized training matters more than raw parameter count.

Further Improvements

Next steps for enhanced performance and efficiency:
  • Speed optimization with quantization techniques (GGUF, AWQ, GPTQ)
  • llama.cpp integration for faster CPU inference
  • Full parameter RL training with expanded compute resources
  • Length normalization removal based on recent Qwen team findings
  • Extended dataset training with 200K SFT + 25K RL samples

Performance Optimization

The current implementation uses adapter merging for faster inference. Future improvements include:
  • Quantized model variants for resource-constrained environments
  • Streaming inference for real-time translation
  • Batch processing for large document translation

Need help?

Join our Discord

Connect with the community and ask questions about this example.