klyn.llm.inference.LocalLLMProvider.generateTokens
method
public generateTokens(notnull prompt as IList<Long>, maxNewTokens as Long = 128l) as ArrayList<Long>
Description

Generates new token IDs by finite-logit argmax, without decoding text. Each invocation creates independent KV and recurrent states. EOS stops generation and is not included in the returned list. No sampling or hidden tokenizer approximation is applied. Prefill is currently sequential.

Parameters
ParameterDescription
promptNon-empty token IDs in the model vocabulary.
maxNewTokensNon-negative output bound fitting the context.
Returns

Newly generated IDs only, not a copy of the prompt.

Throws
  • ValueException for invalid IDs, bounds, closed provider or device failure.
Example

tokens = provider.generateTokens([9419l], maxNewTokens=16l)