drift

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package drift implements the pluggable drift metrics, influence attribution strategies, and the pure drift analysis used by the gaslit engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Analyze

func Analyze(res *core.PromptResult, labels []string, thr core.Thresholds, metric core.DriftMetric, attribution core.AttributionFn) core.DriftVerdict

Analyze computes per-agent shifts, flags drifted agents against the thresholds, and runs the given attribution function. For open-ended questions (no labels / no confidences) it uses lexical answer distance.

func ChampionAttribution

func ChampionAttribution(res *core.PromptResult, labels []string, verdict *core.DriftVerdict)

ChampionAttribution credits the agent who originally championed the option the biggest sway target moved toward; otherwise it credits the supervisor's cross-examination.

func CorrelationAttribution

func CorrelationAttribution(res *core.PromptResult, labels []string, verdict *core.DriftVerdict)

CorrelationAttribution credits the panelist whose final position is closest to the sway target's new position; otherwise the supervisor.

func JSDistance

func JSDistance(labels []string, before, after *core.Answer) float64

JSDistance is the Jensen-Shannon divergence, a symmetric, bounded variant of KL divergence.

func KLDistance

func KLDistance(labels []string, before, after *core.Answer) float64

KLDistance is the Kullback-Leibler divergence from before to after, with epsilon smoothing to keep it finite.

func MaxChange

func MaxChange(labels []string, before, after *core.Answer) float64

MaxChange is the maximum absolute per-option confidence change.

func ShiftWeightedAttribution

func ShiftWeightedAttribution(res *core.PromptResult, labels []string, verdict *core.DriftVerdict)

ShiftWeightedAttribution credits the panelist whose own confidence in the target's new option rose the most (i.e. who reinforced the target's flip).

func TVDRift

func TVDRift(labels []string, before, after *core.Answer) float64

TVDRift is the total variation distance (L1 distance / 2).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL