Table of Contents

Class LogitBias

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

Handles the rules for applying logit bias during token sampling.
Logit bias enables the prevention of specific text chunks or provides guidance to increase or decrease the likelihood of a word appearing.

public sealed class LogitBias
Inheritance
LogitBias
Inherited Members

Remarks

Logits can be conceptualized as a collection of probabilities representing the occurrence of tokens, which have not yet undergone the process of normalization.
Therefore, they are often referred to as unnormalized log probabilities.

Properties

BiasWeights

Specifies the raw bias weights handled by the LogitBias instance.
Each pair comprises a key that specifies a token and a value representing the associated logit bias.

Methods

AddTextChunkBias(string, float, LogitBiasSetMode, bool, bool)

Introduces a bias in the probability of appearance for a specific text chunk, influencing its likelihood of being included during the sampling process associated with this LogitBias instance.

AllowOnlyIntegerTextChunks(bool)

Configures the LogitBias instance to restrict the generation of text chunks exclusively to numerical values (0-9) during the sampling process. Spacing between numerical values can be enabled or disabled.

AllowOnlyWithLettersTextChunks()

Configures the LogitBias instance to allow only the appearance of text chunks composed exclusively of letters during the associated sampling process.

DisallowTextChunk(string, bool, bool)

Strictly prevents a specific text chunk from appearing during the sampling process associated with this LogitBias instance.

Reset()

Resets the LogitBias instance to its default configuration, which means no bias applied to any token.