Skip to content

v4.1 — Optimized AI Translation Pipelines

Choose a tag to compare

@Meapri Meapri released this 11 May 04:21
· 23 commits to main since this release

What's New in v4.1

🚀 On-Device Pipeline (Gemini Nano) — Complete Overhaul

  • Single-pass streaming — Removed the redundant 2nd-pass refinement logic that added latency without meaningful quality improvement. Translations now stream in a single pass for significantly faster response times.
  • Smart text chunking — Long inputs are intelligently split at paragraph → line → sentence boundaries (800-char optimal window) to maintain formatting and translation quality.
  • Proper noun protection — System prompt now explicitly forbids hallucination and improper substitution of proper nouns, brands, and titles (e.g. 「はじまりのピカチュウ」 no longer gets replaced with random movie titles).
  • Post-translation safety net — Known false-friend corrections (e.g. 国勢調査 → 인구총조사, not 국세조사) applied as a final pass.
  • Passthrough punctuation — Decorative symbols (※, →, ★, ●, etc.) are preserved through translation via placeholder substitution.

⚡ AI Studio Pipeline (Gemini 2.5 Flash Lite) — Streamlined

  • Prompt optimization — Reduced prompt token count by ~50% while maintaining translation quality. Removed verbose script rules, redundant instructions, and unnecessary role declarations.
  • Generation config — Removed redundant candidateCount and topK parameters; thinkingBudget: 0 for maximum throughput.
  • Script constraints — Simplified from 22-language verbose rules to 9-language concise constraints.

🐛 Bug Fixes

  • Fixed mainMeaning field not receiving post-translation rules (e.g. 국세조사 correction only applied to translatedText, not mainMeaning).
  • Fixed originalText in chunked translations incorrectly set to the full input text instead of the current chunk.
  • Fixed parseInt calls missing radix parameter (ESLint warnings).
  • Fixed unnecessary arguments passed to buildGeminiNanoSystemPrompt() in the on-device bridge.

🧹 Code Cleanup

  • Removed ~250 lines of dead code across both pipelines: getPrimaryScript, getTargetLanguageOutputRule, findSoftBreak, splitLongParagraphAtSentenceEnds, splitTextIntoParagraphChunks, needsRefinement, and unused constants.
  • Extracted smartSplitText() as a shared utility function.
  • Unified prompt structure between chrome_builtin_translate.js and on_device_bridge.js.

📖 Full Changelog

v4.0.3...v4.1