Weksa/schemas/cultnet/weksa.loop_round.schema.json

369 lines
10 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "RoundRecord",
"description": "One scored round. It holds no text and no Test reading: per-item rows for\nTrain only, Validation only as means and refusal counts by stage. Only\n`run::round` builds one.\n\n```\nfn f(r: &weksa::run::RoundRecord) -> u32 { r.n() }\n```\n\nEvery field is given, so the literal below fails only on privacy; its twin\nis the same literal in the unit test `a_round_record_literal_compiles_in_the_lib`.\n\n```compile_fail,E0451\nuse weksa::run::RoundRecord;\nfn f() -> RoundRecord {\n RoundRecord {\n n: 1,\n inventory_rev: 1,\n prompt_digest: String::new(),\n corpus_digest: String::new(),\n entity_digest: String::new(),\n model: String::new(),\n embedder: String::new(),\n chrf_version: String::new(),\n calls: vec![],\n train: vec![],\n inventory_digest: String::new(),\n cycle: None,\n admit_rules: vec![],\n parse_reasons: vec![],\n own_family: 0,\n languages: vec![],\n validation_scores: vec![],\n }\n}\n```",
"type": "object",
"properties": {
"admit_rules": {
"description": "The rules admission refused items under, in rule order; every Train\nand Validation item refused at `Stage::Admit` is counted once per rule.",
"type": "array",
"default": [],
"items": {
"$ref": "#/$defs/RuleCount"
}
},
"calls": {
"description": "The encode calls, then the lowering calls, each with its prompt digest\nand one item key.",
"type": "array",
"items": {
"$ref": "#/$defs/Call"
}
},
"chrf_version": {
"type": "string"
},
"corpus_digest": {
"type": "string"
},
"cycle": {
"description": "`Some(k)` for the candidate round of cycle `k`.",
"type": [
"integer",
"null"
],
"format": "uint32",
"minimum": 0
},
"embedder": {
"type": "string"
},
"entity_digest": {
"type": "string"
},
"inventory_digest": {
"description": "16 hex of the inventory file the round was scored under.",
"type": "string"
},
"inventory_rev": {
"type": "integer",
"format": "uint32",
"minimum": 0
},
"languages": {
"description": "One reading per panel language, in panel order. No pooled mean exists.",
"type": "array",
"items": {
"$ref": "#/$defs/LanguageRound"
}
},
"model": {
"type": "string"
},
"n": {
"type": "integer",
"format": "uint32",
"minimum": 0
},
"own_family": {
"description": "Offered (live Train and Validation) `ModelWritten` items whose writer\nfamily is the run's answerer family. The corpus rule binds\nmodel judges; the scorer is deterministic, so nothing is refused for\nthis: the round labels it.",
"type": "integer",
"format": "uint32",
"default": 0,
"minimum": 0
},
"parse_reasons": {
"description": "Why items were refused at `Stage::Parse`, in code order, over Train and\nValidation: a [`DraftClass`] code (`rule`), or `unreadable` for an\nitem with no answer that read as text. Never a token of an answer.",
"type": "array",
"default": [],
"items": {
"$ref": "#/$defs/RuleCount"
}
},
"prompt_digest": {
"type": "string"
},
"train": {
"type": "array",
"items": {
"$ref": "#/$defs/TrainRow"
}
},
"validation_scores": {
"description": "Each panel language's live Validation scores in corpus order, a refused\nitem as 0. Private with no getter: only `run.rs` (the floor) reads them,\nso a leak outside it is a compile error. A run from before has none.",
"type": "array",
"default": [],
"items": {
"$ref": "#/$defs/LanguageScores"
}
}
},
"required": [
"n",
"inventory_rev",
"prompt_digest",
"corpus_digest",
"entity_digest",
"model",
"embedder",
"chrf_version",
"calls",
"train",
"inventory_digest",
"languages"
],
"$defs": {
"Call": {
"description": "One model call: the prompt's digest and the item keys it held.",
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "string"
}
},
"prompt": {
"type": "string"
}
},
"required": [
"prompt",
"items"
]
},
"ItemScore": {
"type": "object",
"properties": {
"chrf": {
"description": "chrF of the output against the reference.",
"type": "number",
"format": "double"
},
"meaning": {
"description": "Embedding cosine of the output and the reference; `None` when either\nis empty after trimming.",
"type": [
"number",
"null"
],
"format": "double"
}
},
"required": [
"chrf"
]
},
"LanguageRound": {
"description": "One panel language's readings in a round: the means over that language's\nitems only (a refused item counts 0) and how many items lowered and scored.",
"type": "object",
"properties": {
"language": {
"type": "string"
},
"train_mean": {
"$ref": "#/$defs/SplitMean"
},
"train_scored": {
"description": "Train items that lowered and scored; `train_mean` is over all of them.",
"type": "integer",
"format": "uint32",
"minimum": 0
},
"validation_mean": {
"$ref": "#/$defs/SplitMean"
},
"validation_refused": {
"$ref": "#/$defs/RefusalCounts"
},
"validation_scored": {
"description": "Validation items that lowered and scored; `validation_mean` is over all\nof them and counts a refused item as 0, so refusing a weak item cannot\nraise it.",
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
"required": [
"language",
"train_mean",
"train_scored",
"validation_mean",
"validation_scored",
"validation_refused"
]
},
"LanguageScores": {
"description": "One panel language's Validation scores in a round, in corpus order: numbers\nonly, no item key and no text. Only `run.rs` reads them (the paired floor).",
"type": "object",
"properties": {
"language": {
"type": "string"
},
"scores": {
"type": "array",
"items": {
"$ref": "#/$defs/ItemScore"
}
}
},
"required": [
"language",
"scores"
]
},
"Outcome": {
"oneOf": [
{
"type": "object",
"properties": {
"Scored": {
"type": "object",
"properties": {
"chrf": {
"type": "number",
"format": "double"
},
"meaning": {
"type": [
"number",
"null"
],
"format": "double"
}
},
"required": [
"chrf"
]
}
},
"additionalProperties": false,
"required": [
"Scored"
]
},
{
"type": "object",
"properties": {
"Refused": {
"$ref": "#/$defs/Stage"
}
},
"additionalProperties": false,
"required": [
"Refused"
]
}
]
},
"RefusalCounts": {
"type": "object",
"properties": {
"admit": {
"type": "integer",
"format": "uint32",
"minimum": 0
},
"lower": {
"type": "integer",
"format": "uint32",
"minimum": 0
},
"parse": {
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
"required": [
"parse",
"admit",
"lower"
]
},
"RuleCount": {
"description": "How many items one admission rule refused, over both splits: a rule code\n(`V5`, `UnknownEntity`) and a count, never an identifier or text.",
"type": "object",
"properties": {
"count": {
"type": "integer",
"format": "uint32",
"minimum": 0
},
"rule": {
"type": "string"
}
},
"required": [
"rule",
"count"
]
},
"SplitMean": {
"description": "Mean scores of one derived split.",
"type": "object",
"properties": {
"chrf": {
"description": "`None` when the split has no items.",
"type": [
"number",
"null"
],
"format": "double"
},
"count": {
"type": "integer",
"format": "uint",
"minimum": 0
},
"meaning": {
"description": "Mean over the items that have a meaning score; `None` when none do.",
"type": [
"number",
"null"
],
"format": "double"
}
},
"required": [
"count"
]
},
"Stage": {
"description": "Where a round refused: the first stage that did.",
"oneOf": [
{
"type": "string",
"enum": [
"Parse",
"Admit"
]
},
{
"description": "The lowering prompt could not be built, or its answer was not UTF-8, not\na `LoweringDraft`, or text that is blank, over `MAX_LOWERING_BYTES` or\nholds a control character.",
"type": "string",
"const": "Lower"
}
]
},
"TrainRow": {
"description": "A Train item's row. Validation has no rows.",
"type": "object",
"properties": {
"item": {
"type": "string"
},
"outcome": {
"$ref": "#/$defs/Outcome"
},
"packet": {
"type": [
"string",
"null"
]
}
},
"required": [
"item",
"outcome"
]
}
}
}