slotlearn

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 11 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. Removal goes through the pinned store directory, so a symlinked or substituted store cannot redirect it; a leaf symlink is removed, never followed.

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
	// RejectedRows counts the rows either reader refused under its writer
	// contract, and LedgerCut reports that either ledger exceeded its byte cap,
	// so a label set read from a partial ledger is never presented as whole.
	RejectedRows int
	LedgerCut    bool
	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. A path that is empty or not project-relative never becomes a label.

Jump to

Keyboard shortcuts

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