What a classifier does
Unlike a chat model that writes a continuation, a classifier reads the whole sentence and scores a fixed list of labels. For language detection, those labels are languages such as en, fr, and ja.
Reckoning uses papluca/xlm-roberta-base-language-detection, an XLM-RoBERTa model trained for this exact task. You do not need to prompt it to answer, parse a generated word, or maintain a second tokenizer library.
The Java call
try (AbstractModel model = AutoModelForSequenceClassification
.newBuilder(new ModelFetcher(
"papluca", "xlm-roberta-base-language-detection"))
.build()) {
Map<String, Float> result = model.classify(
"Bonjour tout le monde.", PoolingType.MODEL);
System.out.println(result);
}
{ar=0.000295, bg=0.000126, de=0.000227, el=0.000425, en=0.000296, es=0.000330, fr=0.993935, hi=0.000359, it=0.000339, ja=0.000366, nl=0.000408, pl=0.000226, pt=0.000287, ru=0.000541, sw=0.000173, th=0.000369, tr=0.000469, ur=0.000292, vi=0.000344, zh=0.000193}Six ordinary sentences
Here is the complete smoke test. Each sentence is classified independently, and the highest-probability label is the answer:
"This is English." -> en
"Bonjour tout le monde." -> fr
"Das ist Deutsch." -> de
"Hola, ¿cómo estás?" -> es
"これは日本語です。" -> ja
"Привет, как дела?" -> ru
The model returns the full probability map, not just the winning label. That means an application can set its own confidence threshold, keep alternatives, or route uncertain text for review.
What Reckoning handles
Turns Unicode text into the model's multilingual subword IDs and attention mask.
Runs the transformer encoder locally through the JVM tensor path.
Applies the trained classification head and normalizes the scores into probabilities.
The point: the useful abstraction is small because the hard parts are already in the model and runtime. Reckoning makes the model's intended function available as a direct Java operation.