Table of Contents

Class RepetitionPenalty

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

Handles the rules for repetition penalties applied during text completion.

public sealed class RepetitionPenalty
Inheritance
RepetitionPenalty
Inherited Members

Properties

FrequencyPenalty

Specifies how to penalize new tokens based on their existing frequency in the preceding text, decreasing the model's likelihood to repeat the same line verbatim.
Use a floating-point value within the range [-2, 2].

PresencePenalty

Specifies how to penalize new tokens based on whether they appear in the preceding text, increasing the model's likelihood to talk about new topics.
Use a floating-point value within the range [-2, 2].

RepeatPenalty

Specifies the degree of penalty assigned to new token candidates based on their frequency in the preceding text.
This parameter helps prevent the model from generating repetitive or monotonous text.
Use a floating-point value within the range [0 (more lenient), 2 (more strict)].

TokenCount

Specifies the length of preceding text to be considered for penalties, in terms of token count.
One token is roughly equivalent to 4 characters in standard English text.
Use a value within the range [0, 2048].
Use 0 to disable any penalty.

Methods

Disable()

Disable any repetition penalty.