Class GreedyDecoding
- Namespace
- LMKit.TextGeneration.Sampling
- Assembly
- LM-Kit.NET.dll
Handles greedy decoding strategy.
This algorithm selects the token with the highest probability, ensuring complete determinism.
public sealed class GreedyDecoding : TokenSampling
- Inheritance
-
GreedyDecoding
- Inherited Members
Examples
The following example shows how to use greedy decoding for deterministic text generation:
using LMKit.Model;
using LMKit.TextGeneration;
using LMKit.TextGeneration.Sampling;
LM model = LM.LoadFromModelID("gemma3:4b");
var chat = new MultiTurnConversation(model);
// Enable greedy decoding so that each token is the most probable one.
chat.SamplingMode = new GreedyDecoding();
var result = chat.Submit("What is the capital of France?");
Console.WriteLine(result.Completion);
Methods
- Clone()
Creates a deep copy of the current GreedyDecoding instance.