Model Details
Model Description
Standard large language models struggle with manga translation because colloquial Japanese relies heavily on implicit context, sentence fragments, omission of pronouns, and intense cultural tropes. When forced to translate, they frequently break character, add conversational preambles (e.g., "Here is the translation..."), or fall back to dry, literal dictionary definitions.
This model solves those challenges by learning to map input text directly to specific character tones. It was trained using a custom-engineered synthetic dataset containing diverse character archetypes (e.g., Yakuza slang, polite but sinister villains, excited teenagers, formal keigo, and stoic samurai).
- Developed by: Nael Shichida
- Model type: PeftModel (LoRA Adapter)
- Base Model: Qwen/Qwen2.5-7B-Instruct
- Language(s): Japanese (Source) -> English (Target)
- License: Apache 2.0
- Upstream Data Engine: synthgen (GitHub)
Model Sources
- Data Generator Repository: NaelShichida/synthgen
- Base Infrastructure: RunPod Cloud AI (NVIDIA L4 GPU / 24GB VRAM)
Uses
Direct Use
This model is designed to be integrated directly into manga scanlation workflows, video game localization pipelines, or fan-translation web applications. It accepts raw, colloquial Japanese text along with an archetype instruction and outputs a highly contextual English localization.
Out-of-Scope Use
- Standard document translation (legal contracts, corporate emails, technical documentation).
- General-purpose conversational assistant chat.
- Contexts where literal word-for-word accuracy is favored over stylistic localization.
Technical Specifications & Training Details
Dataset & Upstream Engineering
The model was trained on 1,120 high-quality rows of stylistically varied Japanese-English dialogue pairs.
Rather than relying on noisy web-scraped text, the training data was engineered programmatically using synthgen, an asynchronous synthetic data generation engine built with Python, uv, and Docker. The data pipeline mapped 224 core Japanese seed phrases into 12 distinct character archetypes via a Teacher LLM (GPT-4o/Claude) using complex system prompt engineering and structured JSON verification.
- Hardware: 1x NVIDIA L4 GPU (24GB VRAM) hosted via RunPod.
- Environment Stack: Locked environment utilizing
transformers==4.51.3, peft, trl==0.12.2, and bitsandbytes.
- Optimization Strategy: 4-bit NormalFloat (
nf4) quantization using BitsAndBytesConfig combined with bfloat16 compute precision to maximize throughput within memory constraints.
Training Hyperparameters
- Epochs: 3.0
- Total Steps: 420
- Batch Size: 2 (Per device)
- Gradient Accumulation Steps: 4 (Effective batch size of 8)
- Learning Rate: 2e-4 (Constant learning rate scheduler)
- Optimizer:
paged_adamw_32bit
- LoRA Configurations:
- Rank (r): 16
- Alpha (α): 32
- Dropout: 0.05
- Target Modules:
["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]
- Training Runtime: 1,533.05 seconds (~25 minutes 33 seconds)
- Throughput: 2.192 samples/sec
- Final Training Loss: 0.7487
The production model was evaluated against the bare baseline model on out-of-distribution dialogue prompts.
Evaluation Results
Table with columns: Input Japanese Dialogue, Bare Qwen2.5-7B Baseline, Manga-Tuned Model (This Adapter)| Input Japanese Dialogue | Bare Qwen2.5-7B Baseline | Manga-Tuned Model (This Adapter) |
|---|
| おい、何見てんだよ。ぶち殺すぞ。 (Yakuza Slang) | "Hey, what are you looking at. I'm going to kill you." This is a rough translation of the yakuza slang... | Hey, what are you looking at? I’m gonna kill you. |
| おやおや、まだ抗うつもりですか?無駄なことはおやめなさい。 (Sinister Villain) | Here's the translation... "Oh, oh. Do you still intend to resist? Please stop wasting your time." | Oh my, do you still intend to resist? Please, cease this futile endeavor. |
| マジかよ!これ超ヤバいじゃん!テンション上がるわー! (Excited Teenager) | Maji ka yo!... "Really? This is so intense! My excitement is skyrocketing!" | No way! This is seriously bad! It gets me pumped up! |
Key Architectural Gains
- Zero Conversational Clutter: The tuned adapter successfully suppresses Chat/Instruct preambles ("Here is your translation..."), formatting tokens, and conversational overhead, ensuring clean, direct pipeline outputs.
- Elevated Vocabulary Localization: Character flavor is highly distinct. Standard, flat baseline sentences like "stop wasting your time" are upgraded to trope-accurate dialogue such as "cease this futile endeavor".
How to Get Started with the Model
Use the code below to hot-load this LoRA adapter into a quantized instance of Qwen2.5-7B using peft and transformers:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
model_id = "Qwen/Qwen2.5-7B-Instruct"
lora_id = "NaelShichida/qwen2.5-7b-manga-translator-full"
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
tokenizer = AutoTokenizer.from_pretrained(model_id)
base_model = AutoModelForCausalLM.from_pretrained(
model_id,
quantization_config=bnb_config,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, lora_id)
model.eval()
def translate_manga(text, context):
prompt = f"<|im_start|>user\nTranslate this manga dialogue into English. Context: {context}\n\nInput: {text}<|im_end|>\n<|im_start|>assistant\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=64, eos_token_id=tokenizer.eos_token_id)
generated_text = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
return generated_text