Desert Ant Labs

Tongue: On-device Language Identification

Language identificationAvailable

On-device language identification that reads a short piece of text and names its language, across 84 languages, in tens of microseconds.

Tongue reads a word, a phrase, or a sentence and returns the language it is written in, from "kann ich das haben" in German to "안녕하세요" in Korean. It is tuned for short text such as search boxes, chat messages, and keyboard input, which is the hardest and most useful case for language detection on a device.

Two stages do the work. A script router with zero parameters settles text whose script only one language uses: Hangul, Greek, Thai, and 22 more are decided outright, no model involved. For shared scripts, hashed character n-grams feed a 2 MB int8 model. There is no tokenizer, no vocabulary file, and no inference runtime, and when short input is genuinely ambiguous, Tongue says it is not sure instead of guessing.

Demo

Performance

From 2 MB, it holds its own against detectors up to 130 times its size.

0.933
FLORES-200, 3 words
0.992
Tweets
84
Languages
2 MB
int8 weights

Measured on the shipped int8 weights across three public benchmarks, with the other detectors run on identical rows and language subsets. Full tables and failure modes are on the model card.

Use cases

Route text by language

Pick the right translation model, analyzer, or support queue from the first few words a user types, entirely on device.

Keyboards and input

Detect the language mid-sentence to switch autocorrect, suggestions, or layouts, at a cost of tens of microseconds per keystroke.

Search and content pipelines

Tag short strings with a language before indexing or moderation, without a network round-trip or a per-request service.

Honest uncertainty

"la casa" reads as Italian and Spanish equally. Tongue reports a tie instead of crowning one, so the product can ask for more text.

What it does

  • 84 languages: 59 decoded by the model, 25 settled by script alone.
  • 2 MB int8 weights, bundled in the package; nothing is downloaded.
  • Tens of microseconds per detection, on the main thread.
  • Identical answers on Swift, Kotlin, and JavaScript, held to shared golden vectors.
  • Reports reliability and too-close-to-call ties instead of guessing.

Platforms and install

iOS, macOS
Install
// Swift Package Manager
.package(url: "https://github.com/Desert-Ant-Labs/tongue", from: "0.1.2")
Example - Swift
import Tongue

let tongue = try Tongue()
tongue.detect("kann ich das haben").language
// "de"
Android
Install
// build.gradle.kts (Maven Central)
implementation("ai.desertant:tongue:0.1.2")
Example - Kotlin
import ai.desertant.tongue.Tongue

val tongue = Tongue.bundled(context)
tongue.detect("kann ich das haben").language
// "de"
Web, Node.js
Install
npm i @desert-ant-labs/tongue
Example - TypeScript
import { Tongue } from "@desert-ant-labs/tongue";

const tongue = await Tongue.load();
tongue.detect("kann ich das haben").language;
// "de"
Add Tongue with your AI coding assistant
Prompt
Add Tongue from Desert Ant Labs to this project.

On-device language identification that reads a short piece of text and names its language, across 84 languages, in tens of microseconds.

SDKs (use the one that matches this project's platform):

Swift (iOS, macOS)
Repo: https://github.com/Desert-Ant-Labs/tongue
// Swift Package Manager
.package(url: "https://github.com/Desert-Ant-Labs/tongue", from: "0.1.2")

Kotlin (Android)
Repo: https://github.com/Desert-Ant-Labs/tongue
// build.gradle.kts (Maven Central)
implementation("ai.desertant:tongue:0.1.2")

JavaScript / TypeScript (Web, Node.js)
Repo: https://github.com/Desert-Ant-Labs/tongue
npm i @desert-ant-labs/tongue

Reference:
- Model page: https://desertant.com/models/tongue/
- Full catalog and other models: https://desertant.com/llms.txt

Add the SDK that matches this project's platform, then follow its README for the exact API and current version. Do not invent API names or method signatures; confirm them against the README.

Specs

Languages
84, across 31 scripts
On-device size
2.1 MB int8 weights, inside the package
Latency
Tens of microseconds per detection
Approach
Script router plus hashed character n-grams into an int8 linear head

FAQ

What is Tongue?

On-device language identification that reads a short piece of text and names its language, across 84 languages, in tens of microseconds.

Does Tongue run on device?

Yes. Tongue runs entirely on device: inference happens locally with no server call, so data never leaves the device.

Which platforms does Tongue support?

Tongue ships as native on-device SDKs for Swift, Kotlin, JavaScript / TypeScript.

How much does Tongue cost?

Every model is free up to 100k monthly active devices per SDK. Unlimited inference per user. Contact us for custom licenses.

How accurate or fast is Tongue?

From 2 MB, it holds its own against detectors up to 130 times its size.

Resources