Skip to content

feat(nlp): add translation task (Opus-MT, EuroLLM, Hy-MT2) - #1572

Merged
msluszniak merged 10 commits into
mainfrom
@ms/translation
Nov 3, 2026
Merged

msluszniak merged 10 commits into
mainfrom
@ms/translation

Conversation

@msluszniak

@msluszniak msluszniak commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Description

  • New translation task behind one Translator API (useTranslator, translate(text, { sourceLanguage, targetLanguage }, onToken?)).
  • Opus-MT: six pairs (en↔de, en↔es, en↔fr), XNNPACK int8 only (fastest on S26 Ultra and iPhone 16; Core ML, MLX and Vulkan were slower).
  • EuroLLM-1.7B-Instruct: any pair of its 35 languages with one model (XNNPACK 8da8w, MLX int8 on iOS); switching pairs does not reload it.
  • Hy-MT2-1.8B: same API, 38 languages (XNNPACK 8da4w, MLX int8 on iOS). Verified on S26 Ultra and iPhone 16.
  • Fix: LLM streaming dropped word breaks for tokenizers whose decoder strips a leading space (EuroLLM).
  • NLP demo gets a Translation screen.
  • Bumps nativeLibsVersion to 0.10.7 (v0.10.7-libs).

Introduces a breaking change?

  • Yes
  • No

Type of change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update (improves or adds clarity to existing documentation)
  • Other (chores, tests, code style improvements etc.)

Tested on

  • iOS
  • Android

Testing instructions

  • Run apps/nlp, open Translation, pick Opus-MT or EuroLLM and a pair, tap Translate.

Screenshots

Related issues

#1113

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

Export scripts: export-scripts MR !43.

@msluszniak msluszniak self-assigned this Oct 22, 2026
@msluszniak msluszniak added the feature PRs that implement a new feature label Oct 22, 2026
@msluszniak msluszniak changed the title feat(nlp): add Opus-MT translation task feat(nlp): add translation task (Opus-MT, EuroLLM) Oct 23, 2026
@msluszniak msluszniak linked an issue Oct 28, 2026 that may be closed by this pull request
@msluszniak
msluszniak marked this pull request as draft October 29, 2026 13:44
@msluszniak msluszniak changed the title feat(nlp): add translation task (Opus-MT, EuroLLM) feat(nlp): add translation task (Opus-MT, EuroLLM, Hy-MT2) Oct 29, 2026
@msluszniak
msluszniak marked this pull request as ready for review October 29, 2026 16:58
@msluszniak
msluszniak requested a review from barhanc October 29, 2026 17:04
Prompt templates and language tables now live in models.ts / constants.ts
as plain config data; add LLMTranslator; drop the top-level Translator
re-export; keep one Hy-MT2 variant per backend (XNNPACK 8da4w, MLX int8).
@msluszniak
msluszniak requested a review from barhanc November 2, 2026 15:34

@barhanc barhanc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested example app and it works correctly.

@msluszniak
msluszniak merged commit d81a1d5 into main Nov 3, 2026
7 checks passed
@msluszniak
msluszniak deleted the @ms/translation branch November 3, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature PRs that implement a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support translation models

2 participants