Table of Contents

Class LiteRtNoRepeatNgramOptions

Namespace
LiteRtLmSharp
Assembly
LiteRtLmSharp.dll

Bans the current send's decode from repeating any n-gram of NgramSize consecutive tokens it already produced: a candidate token that would complete an already-seen n-gram has its logit forced to -inf. Set on NoRepeatNgram. Requires native LiteRT-LM v0.15.0+.

public sealed record LiteRtNoRepeatNgramOptions : IEquatable<LiteRtNoRepeatNgramOptions>
Inheritance
LiteRtNoRepeatNgramOptions
Implements
Inherited Members

Remarks

Maps to the C API litert_lm_no_repeat_ngram_config_* builder.

Properties

NgramSize

Size of the n-grams (consecutive token sequences) banned from repeating. Must be positive — construct the record only when you want the ban (a zero/negative size is the native "disabled" encoding; in this binding simply leave NoRepeatNgram null instead).

public required int NgramSize { get; init; }

Property Value

int

Exceptions

ArgumentOutOfRangeException

The value is zero or negative.

WindowSize

How many of the most recent generated tokens are tracked for repeats. 0 (default) = the whole generation history of the send. A positive value smaller than NgramSize is clamped up to it natively.

public int WindowSize { get; init; }

Property Value

int

Exceptions

ArgumentOutOfRangeException

The value is negative.