Skip to content
Back to skills

Bidirectional Translation Augmentation

ASecurity

Double training data by adding reverse-direction translation pairs with task prefix prompts

  • 61 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 12, 2026
datapythonperformance

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill bidirectional-translation-augmentation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bidirectional Translation Augmentation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Bidirectional Translation Augmentation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-bidirectional-translation-augmentation/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-bidirectional-translation-augmentation)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: nlp-bidirectional-translation-augmentation
description: Double training data by adding reverse-direction translation pairs with task prefix prompts
domain: nlp
---

# Bidirectional Translation Augmentation

## Overview

For low-resource translation, double the training data by adding reverse-direction pairs (A→B becomes both A→B and B→A). Uses task-prefix prompts so the model learns both directions in a single model. Especially effective when parallel data is scarce.

## Quick Start

```python
import pandas as pd
from datasets import Dataset

def make_bidirectional(df, src_col, tgt_col, src_lang, tgt_lang):
    fwd = df.copy()
    fwd['input_text'] = f"translate {src_lang} to {tgt_lang}: " + fwd[src_col].astype(str)
    fwd['target_text'] = fwd[tgt_col].astype(str)

    bwd = df.copy()
    bwd['input_text'] = f"translate {tgt_lang} to {src_lang}: " + bwd[tgt_col].astype(str)
    bwd['target_text'] = bwd[src_col].astype(str)

    combined = pd.concat([fwd, bwd], ignore_index=True)
    return Dataset.from_pandas(combined.sample(frac=1, random_state=42))
```

## Key Decisions

- **Task prefix required**: without it, the model can't distinguish direction
- **Shuffle after concat**: prevents the model from seeing all forward then all backward
- **Train only**: keep validation unidirectional to measure real performance
- **Works best with T5/mT5**: encoder-decoder models with task prefixes

## References

- Source: [dpc-starter-train](https://www.kaggle.com/code/takamichitoda/dpc-starter-train)
- Competition: Deep Past Challenge - Translate Akkadian to English

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.