Documentation
¶
Overview ¶
Package longmemeval implements the LongMemEval benchmark runner for Cortex.
LongMemEval tests 500 questions across 5 memory abilities: Information Extraction, Multi-Session Reasoning, Temporal Reasoning, Knowledge Updates, and Abstention.
Reference: arXiv:2410.10813
Index ¶
- func Run(cfg Config) (*common.BenchmarkResult, error)
- func RunEval(cfg Config) (*common.EvalReport, error)
- type AbilityCategory
- type BaselineEvidence
- type ChatTurn
- type Config
- type Dataset
- type DatasetProvenance
- type EvidenceOrigin
- type LegacyMetricComparability
- type Question
- type RetrievalLabelStatus
- type TemporalLocator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
func Run(cfg Config) (*common.BenchmarkResult, error)
Run executes the LongMemEval benchmark against Cortex. When a judge is configured the endpoint is probed first and any judge failure aborts the run with a common.BlockedError: scores are never fabricated by falling back to token overlap behind the judge's back.
func RunEval ¶ added in v2.4.0
func RunEval(cfg Config) (*common.EvalReport, error)
RunEval executes the published fixed-judge protocol: it fails BLOCKED when the judge endpoint is unreachable, scores every question with the fixed judge, publishes the per-task before/after comparison, and returns a *common.RegressionError when a task delta falls below Config.MinDelta. Callers map the outcome to a process exit with common.EvalExitCode.
Types ¶
type AbilityCategory ¶
AbilityCategory retains a LongMemEval ability code and gives it a stable, human-readable name for evidence reports.
type BaselineEvidence ¶
type BaselineEvidence struct {
DatasetSourceID string
QuerySourceID string
SourceURL string
LicenseNotice string
Ability AbilityCategory
TemporalMetadata []TemporalLocator
IsAbstention bool
EvidenceOrigin EvidenceOrigin
CortexReproduction bool
RetrievalLabels RetrievalLabelStatus
LegacyMetrics LegacyMetricComparability
Limitations []string
}
BaselineEvidence is a reporting-only view of one LongMemEval question. It does not execute retrieval or alter the legacy runner's F1/judge behavior.
func AdaptBaselineEvidence ¶
func AdaptBaselineEvidence(provenance DatasetProvenance, question Question) (BaselineEvidence, error)
AdaptBaselineEvidence converts upstream metadata into an evidence report. It deliberately leaves retrieval IDs and spans absent because LongMemEval's answer-oriented labels do not establish Cortex stable-ID relevance.
type ChatTurn ¶
type ChatTurn struct {
Role string `json:"role"`
Content string `json:"content"`
SessionID int `json:"session_id"`
Timestamp string `json:"timestamp"`
}
ChatTurn represents a single turn in the chat history.
type Config ¶
type Config struct {
DataPath string
Limit int
JudgeCfg *common.JudgeConfig
GraphBoost bool
// EmbeddingCfg embeds ingested observations when set; nil keeps the
// lexical-only store. The query leg stays lexical either way (see
// adaptiveRetrieve).
EmbeddingCfg *embedding.Config
// Baseline records before-scores keyed by common.BaselineKey for the
// per-task comparison; nil publishes after-scores with an unevaluated gate.
Baseline common.EvalBaseline
// MinDelta is the per-task regression gate applied to every comparison
// row. Zero means a task may never fall below its recorded baseline.
MinDelta float64
// ReportPath writes the published evaluation JSON when non-empty.
ReportPath string
// LegacyPath keeps the original direct FTS query instead of routing
// through retrieval.ExecuteAdaptiveSearch, so a before/after row can be
// reproduced with one flag flip and stays attributable to the adaptive
// wiring alone.
LegacyPath bool
}
Config controls the benchmark run.
type Dataset ¶
type Dataset struct {
Questions []Question `json:"questions"`
}
Dataset represents the LongMemEval dataset structure.
type DatasetProvenance ¶
DatasetProvenance identifies the exact upstream dataset distribution and retains its source and licensing notice without interpreting either.
type EvidenceOrigin ¶
type EvidenceOrigin string
EvidenceOrigin identifies whether evidence was produced by Cortex or comes from an external benchmark source.
const ( // EvidenceOriginExternal marks evidence that Cortex has not reproduced. EvidenceOriginExternal EvidenceOrigin = "external" )
type LegacyMetricComparability ¶
type LegacyMetricComparability struct {
AnswerTokenF1ComparableToLabelledRetrieval bool
JudgeComparableToLabelledRetrieval bool
}
LegacyMetricComparability prevents answer scoring from being interpreted as labelled retrieval relevance.
type Question ¶
type Question struct {
ID string `json:"id"`
Question string `json:"question"`
Answer string `json:"answer"`
Category string `json:"category"` // IE, MR, TR, KU, ABS
ChatHistory []ChatTurn `json:"chat_history"`
}
Question represents a single evaluation question.
type RetrievalLabelStatus ¶
type RetrievalLabelStatus struct {
Available bool
RelevantStableIDs []string
EvidenceSpans []string
ReleaseEvidenceEligible bool
}
RetrievalLabelStatus describes whether the upstream sample provides the stable relevance labels required for Cortex retrieval release evidence.
type TemporalLocator ¶
TemporalLocator retains temporal metadata present on an upstream chat turn. SessionID and Timestamp are locators, not Cortex memory IDs or relevance labels.