value¶
Responsibility¶
Score one coalition generation against the Base generation; the score is the coalition payoff
v(S)(Value function).Build the generation records both
explainandreanalyzescore.
Public surface¶
Every built-in declares
info: ValueInfo(range,reads_base,needs,extra_model,cost);tests/value/test_info.pychecks it anddocs/theory/value_functions.rstlists it.TfIdfCosineValue(tfidf_cosine, default): aFittableValueFunction;fit(corpus)freezes inverse document frequencies (IDF) over the base and all coalition records;scoreis the term frequency-inverse document frequency (TF-IDF) cosine oftext_token_rows.CosineEmbeddingValue(embedding_cosine, optionsencoder,allow_hash_embeddings): cosine of sentence-transformers embeddings of the answers (defaultall-MiniLM-L6-v2);encoder: model_statesreads the backend’sembeddingorcontextual_embedding(needs_embeddings).embedding_euclideanis removed.SelfLogprobValue(self_logprob): mean of the candidate’slogprobs, 0 when empty, ignores the base;LogprobValue(logprob) is its deprecated alias (decision).ReferenceWerValue(reference_wer, optionreference):1 - min(1, WER), word-level Levenshtein over lowercased[\w']+words.TfLogprobValue(tf_logprob),TfJsdValue(tf_jsd, optiontop_k)ContrastiveValue(contrastive, optionstarget,foil) andLabelMarginValue(label_margin, optionstarget,labels: the target against the log-sum-exp of the other labels, one forward pass per label) implementRequiresTeacherForcing: they readGenerationRecord.forced[y]forforced_continuations(base)and, withreads_candidate_textfalse, no coalition answer is generated.tf_jsdis-sum_t JSDover each position’s top-klaw plus a rest bucket.BertScoreValue,NliLogOddsValue,SemaScoreValue:fit(corpus)batch-encodes the answers; encoders load lazily fromencoders.py(TokenEncoder,NliModel,WordEncoder) and tests inject fakes.SpeechBertScoreValuereadsaudio_pathframes;TranscribedValue(transcribed) transcribes then applies a wrapped text value function.JudgeGradeValue(judge_grade):PreparesScores.preparegrades each distinct answer with a judge backend (digit probabilities via teacher forcing, elsesamplesgenerations); refuses more thanmax_coalitionsanswers.manifest_info()(optional) feedsRunManifest.value_info.generation_record_from_text(text): token rows fromtext.split()with 56-bitblake2bids and 8-dimensional hash embeddings, all derived from the text only.
Data flow¶
In: records from
generation_record_from_text, built by the pipeline orchestrator from backend text (with logprobs, model embeddings orforcedscores when the value function needs them) and byreanalyzeandrescorefrom the archive.Out: one float per coalition. Imports domain, protocols, plugins (context type only).
Invariants¶
explainandreanalyzereturn the same values on the same archive for text value functions,self_logprob, sentence-encoderembedding_cosineand archived teacher-forced scores.TF-IDF weights are fitted once per scoring pass on exactly the corpus that is scored.
score(base, base)is the grand-coalition payoff: 1 fortfidf_cosine, 0 fortf_jsd.
Known issues¶
Embedding values of a transformers run with
encoder: model_statesdiffer betweenexplain(model embeddings) andreanalyze(hash embeddings of archived text).Speech value functions need records with
audio_path; no built-in backend returns speech.Fixed: C08, C15 (Fixed issues).