Table of Contents

Enum RandomSampling.RandomSamplers

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

Provides a comprehensive overview of the assortment of samplers available for implementation within the RandomSampling strategy, each offering unique selection mechanisms.

public enum RandomSampling.RandomSamplers

Fields

TopK = 0

Selects the top K predictions.

TailFree = 1

Reduces the influence of tail-end predictions.

LocallyTypical = 2

Focuses on selections that are typical within a local context.

TopP = 3

Selects predictions that cumulatively reach a probability threshold.

MinP = 4

Filters out predictions below a certain probability threshold.

Temperature = 5

Adjusts the probability distribution based on a temperature parameter to control the randomness of selection.

Examples

The following example shows how to customize the sampler execution order:

using LMKit.TextGeneration.Sampling;

var sampling = new RandomSampling
{
    Temperature = 0.7f,
    // Apply temperature scaling first, then filter by TopK and TopP.
    SamplersSequence = new[]
    {
        RandomSampling.RandomSamplers.Temperature,
        RandomSampling.RandomSamplers.TopK,
        RandomSampling.RandomSamplers.TopP
    }
};
Share