Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Llama.Detokenize

Convert the provided tokens into text (inverse of llama_tokenize()).

Component Version macOS Windows Linux Server iOS SDK
Llama 16.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Llama.Detokenize"; LlamaSession; Tokens { ; remove special; unparse special } )   More

Parameters

Parameter Description Example Flags
LlamaSession The session identifier. $$session
Tokens A JSON array with numbers.
The token values depend on the model.
[234]
remove special Allow to remove BOS and EOS tokens if model is configured to do so.
Pass 1 to allow or 0 to disallow.
Default is 1.
1 Optional
unparse special If true, special tokens are rendered in the output.
Pass 1 to allow or 0 to disallow.
Default is 1.
1 Optional

Result

Returns OK or error.

Description

Convert the provided tokens into text (inverse of llama_tokenize()).

See also

Release notes

  • Version 16.3
    • Fixed memory leaks in Llama.Tokenize and Llama.Detokenize functions.

Created 10th February 2026, last changed 10th February 2026


Llama.ContextUsed - Llama.InitSampler