slotlearn

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 10 Imported by: 0

Documentation

Overview

Package slotlearn turns the local read ledgers into negative labels for context slot order and proposes bounded slot-weight traces that only the frozen held-out gate may admit (learned-trace-admission-v0, LTA-V0-009..012). It runs only from the explicit `corvint eval --learn-slot-weights` step; the live context path never imports it.

Index

Constants

View Source
const (
	// MaxLabelPaths bounds the distinct negative-label paths kept.
	MaxLabelPaths = 256
	// MaxProposals bounds the slot-weight traces the gate scores.
	MaxProposals = 4

	ReasonNoLabels      = "no negative labels"
	ReasonNoImprovement = "no held-out improvement"
	ReasonNotRequested  = "improved; --admit not given"
	ReasonAdmitted      = "admitted"
)

Variables

This section is empty.

Functions

func Learn

func Learn(ctx context.Context, root, goldenPath string, admit bool) (map[string]any, bool, error)

Learn reads the labels, scores the proposals on the frozen held-out gate and, only with admit and an improved proposal, writes the admitted trace.

func Propose

func Propose(classes map[string]int) []contextindex.SlotWeights

Propose raises the most-missed serving slots by one and then two steps, most frequent class first, at most MaxProposals traces.

func Reset

func Reset(root string) (bool, error)

Reset removes the admitted trace so the context packet returns to the default slot order. An absent trace is not an error.

func ServingSlot

func ServingSlot(path string) string

ServingSlot is the closed table from a missed path to the slot that serves that kind of path: tests, prose (the packet's `documentation` relation, by the same suffixes), other docs/ files (lexical), or a code definition.

Types

type Labels

type Labels struct {
	Paths          []string
	UnplannedPaths int
	ObservedMisses int
	PlannedReads   int
	SkippedRows    int
	Truncated      bool
	Classes        map[string]int
}

Labels are the negative labels: repository paths an agent needed that the packet did not supply, each mapped to the slot that should have served it.

func ReadLabels

func ReadLabels(root string) (Labels, error)

ReadLabels reads both ledgers through their bounded readers. Unplanned reads and observed misses are labels; planned re-reads are disclosed as a count only, because the packet already carried those paths.

Jump to

Keyboard shortcuts

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