Documentation
¶
Overview ¶
Package drift implements the pluggable drift metrics, influence attribution strategies, and the pure drift analysis used by the gaslit engine.
Index ¶
- func Analyze(res *core.PromptResult, labels []string, thr core.Thresholds, ...) core.DriftVerdict
- func ChampionAttribution(res *core.PromptResult, labels []string, verdict *core.DriftVerdict)
- func CorrelationAttribution(res *core.PromptResult, labels []string, verdict *core.DriftVerdict)
- func JSDistance(labels []string, before, after *core.Answer) float64
- func KLDistance(labels []string, before, after *core.Answer) float64
- func MaxChange(labels []string, before, after *core.Answer) float64
- func ShiftWeightedAttribution(res *core.PromptResult, labels []string, verdict *core.DriftVerdict)
- func TVDRift(labels []string, before, after *core.Answer) float64
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 ¶
JSDistance is the Jensen-Shannon divergence, a symmetric, bounded variant of KL divergence.
func KLDistance ¶
KLDistance is the Kullback-Leibler divergence from before to after, with epsilon smoothing to keep it finite.
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).
Types ¶
This section is empty.