Table of Contents

Property TopK

Namespace
LMKit.TextGeneration.Sampling
Assembly
LM-Kit.NET.dll

TopK

Specifies the vocabulary size considered during completion (or text generation).
Use an integer value within the range [1, 1000].

public int TopK { get; set; }

Property Value

int

The default value is 40.

Remarks

TopK provides a controlled randomness by considering a fixed number of top probable tokens, while TopP allows for dynamic control of the number of tokens considered, leading to different levels of diversity in the generated text.

This parameter has no effect when Temperature property is set to 0.

Top-K sampling described in academic paper "The Curious Case of Neural Text Degeneration" https://arxiv.org/abs/1904.09751