Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 4 min read

I tested Apple's on-device model in 54 languages

TL;DR. Apple's on-device model summarized 52 of 54 languages well enough to use, including dozens that aren't on Apple's list. Asked for a summary in Ukrainian, it wrote in the page's language instead on 50 of 53 pages.

I tested Apple's on-device model in 54 languages

TL;DR. Apple's on-device model summarized 52 of 54 languages well enough to use, including dozens
that aren't on Apple's list. Asked for a summary in Ukrainian, it wrote in the page's language instead on
50 of 53 pages. Repeating the language once more after the page text brought that down to one. CJK text
costs about twice as many tokens per character as English.

My Safari extension, Epitome, summarizes web pages with the language model built into Apple devices (the
Foundation Models framework). Officially Apple lists only 15 languages for that model. But after digging
around and experimenting, I found it knows a lot more of them: it understands text in them and writes in
them too. So I dug further and tested it properly, in September and again in November.

How I tested

I took the Wikipedia article about the Moon in 54 languages. The topic is the same everywhere, so the
articles are comparable, though not identical: each language has its own article, of different length and
detail. That hardly matters for which language the answer comes out in, or for how many tokens a script
costs. The quality of a summary, though, can depend on the article as much as on the language.

Each article got the short-summary prompt the extension really uses, on a Mac with macOS 27, where the
model has an 8,192-token window. I checked the language of each summary with NLLanguageRecognizer and
read every mismatch myself. The recognizer is often wrong on short texts (it took a Belarusian summary for
Kazakh), so reading them mattered.

Summary in the page's own language

52 of the 54 worked. Every language on Apple's list was fine, and so were 37 that aren't on it.

Green: usable. Amber: usable, with mistakes. Red: mixed with another language. A dot marks the 15 languages on Apple's list.
Green: usable. Amber: usable, with mistakes. Red: mixed with another language. A dot marks the 15 languages on Apple's list.
Belarusian and Serbian failed. The Belarusian summary drifted into Polish, the Serbian one into Russian.

A few smaller languages had mistakes that didn't stop me from reading the summary: Persian used the wrong
word for "Moon", and Galician, Slovenian and Latvian had grammar errors.

So I don't filter languages by supportedLanguages. Ukrainian, my own language, isn't on that list, and
the Ukrainian article came out fine.

Summary in a different language

This is where it got interesting. Say the page is in Japanese and you want the summary in Ukrainian. In
November, on macOS 27.2.1, I asked for a Ukrainian summary of each of the other 53 articles. On 50 of them
the model ignored that and wrote in the page's language, Japanese, German and English included. Only the
Kazakh, Tagalog and Urdu pages got a Ukrainian answer.

The "write in Ukrainian" instruction was in the system instructions, which is where you'd normally put
it. What helped was repeating it after the page text, so it's the last thing the model reads:

<page text>
---
Write the summary in Ukrainian (ΡƒΠΊΡ€Π°Ρ—Π½ΡΡŒΠΊΠ°).

With that line, 52 of the 53 summaries came out in Ukrainian. The Bulgarian page still got a Bulgarian
answer.

The same 53 pages, without and with the extra line.
The same 53 pages, without and with the extra line.
In September I ran the same test with a different target language on an earlier build, and only 18 of 53
pages ignored it. So how often the model drifts changes from build to build (whether it's the OS or Apple
updated the model itself, I can't tell), but the fix held both times.

I write the language name twice, in English and in the language itself. It's a few extra tokens, and
there's no doubt which language I mean.

I think it's about distance. A few thousand tokens of Swedish pull the model toward Swedish, and an
instruction from way back at the start can't compete with that. When the instruction comes last, it wins.
Every prompt in Epitome ends with that line now, including questions about a page and video transcripts.

Getting the language right doesn't make the Ukrainian good, though. Some summaries were clumsy, with
made-up words, and a few got facts wrong: one said the Moon formed 45 million years ago instead of 4.5
billion. That's the small model, not the prompt. Apple's cloud model (Private Cloud Compute) writes
noticeably better, which is why Epitome hands the summary to it when the cloud switch is on.

How much text fits

The window is counted in tokens, and scripts differ a lot in how many tokens they need.

Measured on the same 54 articles.
Measured on the same 54 articles.
A Chinese or Japanese page gets about half as much text into the window as an English one. If I trimmed
by characters, I'd either leave half the window empty on English pages or overflow it on Japanese ones, so
Epitome trims by the model's own token count.

Smaller things

  • Now and then the model put a label on the first paragraph, "Intro:" or the Hindi word for it. One line in the instructions fixes that: no label such as "Intro".
  • Later I noticed that the device model sometimes mangled short English pages when asked to summarize them into Slavic languages. That's one reason Epitome sends every summary to Apple's cloud model (Private Cloud Compute) when its cloud switch is on, not only the pages too long for the device. The switch is off by default.
  • It depends on the device. In the 27 releases, Macs and the iPhone Air and 17 Pro get a bigger version of the model than other devices (my iPhone 16 Pro gets the smaller one, with a 4,096-token window), and OS updates change how it behaves. I'll have to run this again after each major update.

If you're building on Foundation Models for people who don't read English, test the "page in one
language, summary in another" case on its own. The same-language results had me thinking everything was
fine.

Epitome summarizes pages, videos and PDFs in Safari in about 50 languages, on Mac, iPhone and iPad:
opanchenko.com/epitome.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.