Code Monkey home page Code Monkey logo

reflectionllmmt's Introduction

ReflectionLLMMT

TasTe: Teaching Large Language Models to Translate through Self-Reflection

๐Ÿ“ฃ News

๐Ÿ”— Quick Links

๐Ÿค– About TasTe

The TasTe framework, which is short for Teaching Large Language Models to Translate through Self-Reflection, is designed as a two-stage inference process to enhance the translation quality of MT-LLMs. It consists of the following two stages:

  • Stage 1: Generate preliminary translations (i.e. drafts) and conduct self-assessment of the translation quality at the same time.
  • Stage 2: Refine the preliminary translations according to the predicted quality levels to obtain final outputs.

To ensure the sufficient capability for the entire self-reflective translation process, the LLMs are fine-tuned on a multi-task training set. The dataset consists of three parts:

  • Basic Translation: Common parallel corpus to provide the LLMs with correct multilingual knowledge.
  • Quality Prediction: Sources and translation candidates with their evaluated COMET scores to equip the LLMs with knowldge about translation quality and capabilities to make translation assessments.
  • Draft Refinement: Preliminary translations with their COMET scores and enhanced translations to teach the LLMs to refine drafts according to their quality scores.

The Framework of TasTe

๐Ÿ“œ File Structure

Directory Contents
checkpoints/ Fine-tuned model checkpoints
data/ Experimental Data
infer/ Testing scripts
results/ Testing outputs
train/ Fine-tuning scripts

๐Ÿ› ๏ธ Requirements

๐Ÿš€ Quick Start

Installation

git clone https://github.com/YutongWang1216/ReflectionLLMMT.git
cd ReflectionLLMMT
pip install -r requirments.txt

Fine-tuning for TasTe models

(1) FixEmb: Tuning with Embedding Layers Fixed

(2) Full: Tuning with Full Parameters

Make sure to fill in the following parameters before running:

work_dir=/path/to/ReflectionLLMMT      # path to the ReflectionLLMMT root directory
model_name=name_of_your_model          # name your model, e.g. bloom_fixemb
settings=tc                            # training settings, choices=[tc, qe, mt]
premodel=/path/to/original/checkpoint  # path to the pretrained model checkpoint directory
GPU_NUM=8                              # number of available GPUs
GPU=0,1,2,3,4,5,6,7                    # GPU ids

There are three choices of training settings, corresponsing to three different training sets:

  1. tc - Fine-tune with data in data/train_tc.json to get a TasTe model in Text Classification style.
  2. qe - Fine-tune with data in data/train_qe.json to get a TasTe model in Quality Estimation style.
  3. mt - Fine-tune with data in data/train_mt.json to get a MT-baseline model.

Evaluating TasTe models

Make sure to fill in the following parameters before running:

work_dir=/path/to/ReflectionLLMMT  # path to the ReflectionLLMMT root directory
lang=zh-en                         # language pair to be tested in, choices=['zh-en', 'en-zh', 'de-en', 'en-de']
test_model=name_of_model           # name of the fine-tuned model you gave
settings=tc                        # model settings, choices=[tc, qe, mt]
GPU_NUM=8                          # number of available GPUs

There are also three choices of testing settings, corresponsing to three different training settings:

  1. tc - Test a TasTe model in Text Classification style.
  2. qe - Test a TasTe model in Quality Estimation style.
  3. mt - Test a MT-baseline model.

๐Ÿ“ Citation

If you find this repo useful, please cite our paper as:


reflectionllmmt's People

Contributors

yutongwang1216 avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.