LlamaContextConfig

data class LlamaContextConfig(val contextLength: Int = DEFAULT_CONTEXT_LENGTH, val batchSize: Int = DEFAULT_BATCH_SIZE, val microBatchSize: Int = 0, val embeddingPooling: LlamaPooling = LlamaPooling.MODEL_DEFAULT, val embeddingContextLength: Int = DEFAULT_EMBEDDING_CONTEXT_LENGTH)(source)

KV-cache and batching configuration of a LlamaEngine, fixed at construction time.

Constructors

Link copied to clipboard
constructor(contextLength: Int = DEFAULT_CONTEXT_LENGTH, batchSize: Int = DEFAULT_BATCH_SIZE, microBatchSize: Int = 0, embeddingPooling: LlamaPooling = LlamaPooling.MODEL_DEFAULT, embeddingContextLength: Int = DEFAULT_EMBEDDING_CONTEXT_LENGTH)

Types

Link copied to clipboard
object Companion

Constants and factory functions of LlamaContextConfig.

Properties

Link copied to clipboard

maximum tokens per llama_decode() call during prompt processing; longer prompts are split.

Link copied to clipboard

context window in tokens (prompt + generated text kept in the KV cache). MODEL_CONTEXT_LENGTH (0) uses the model's training length, which can be very large (and memory hungry) for modern models.

Link copied to clipboard

context window of the embedding context created lazily by LlamaEngine.embed. Inputs must fit in one batch of this size.

Link copied to clipboard

how LlamaEngine.embed pools token embeddings into one vector.

Link copied to clipboard

physical micro-batch size, 0 = batchSize.