WatermarkedCausalLanguageModel<T>
Models & Types · AiDotNet.Safety.Watermarking
A language model whose next-token logits carry a generation-time watermark: the inner model’s logits plus the watermarker’s green-list bias for the current context.
Implements: ICausalLanguageModel<T>
Known derived types: WatermarkedIncrementalCausalLanguageModel<T>
For Beginners
this wraps your model so everything it writes carries your watermark, without changing the model itself.
How It Works
Created by WatermarkModel. The inner model’s logits are copied before the
bias is added, so a model that reuses its output buffer is not modified. Use the wrapped model anywhere an
ICausalLanguageModel is accepted, for example in LocalEngineChatClient; every
token it samples is then drawn from the watermarked distribution.
Constructors
| Constructor | Summary |
|---|---|
WatermarkedCausalLanguageModel(ICausalLanguageModel<T> inner, IGenerationWatermarker<T> watermarker) |
Wraps inner with watermarker’s logit bias. |
Properties
| Property | Summary |
|---|---|
IGenerationWatermarker<T> Watermarker { get; } |
The watermarker whose bias is applied. |
int VocabularySize { get; } |
Methods
| Method | Summary |
|---|---|
Vector<T> NextTokenLogits(IReadOnlyList<int> tokenIds) |