JavaScript · Choices

Choices

import * as uform from 'uform';import { Probabilities } from 'uform'; 4.0.0-rc.1 · 3ee5e534

A checkpoint with the byte decoder scores closed sets of single-byte choices in one forward, each item’s probabilities summing to one:

const { probabilities } = model.textChoose(["keep this candidate?", "expand which neighbour?"], ["yn", "ABCD"], arena);
const [keep, drop] = probabilities.item(0);

API

Types

ChooseConfigOptional per-call settings of textChoose.
uform.ts:201 ↗
interface ChooseConfig

Fields

temperatureGroups?Uint32Array | number[]The question type of each item, below the model's choiceTemperatureGroups; absent puts every item in group 0.
progress?ProgressCallbackHears the items scored so far and may stop the call by answering false; only a model's own verbs take one.
ChosenWhat one choose call landed.
uform.ts:211 ↗
interface Chosen

Fields

probabilitiesProbabilitiesOne probability per choice, summing to one per item that offers any.
statsEncodeStatsTruncation and token counts.
ChoicesThe calibrated choices over the byte decoder.
uform.ts:159 ↗
interface Choices

Mirrors uform_choices_t; absent fields derive.

Fields

weight?numberThe loss weight; absent trains no choices.
brierWeight?numberThe Brier term's weight beside the soft cross-entropy; absent derives 0.5.
ClassProbabilitiesOne probability per choice a choose call landed in its arena, in the choices' order: item i spans offsets[i] up to offsets[i + 1].4
encode.ts:170 ↗
class Probabilities extends ArenaView

Mirrors the probabilities output of uform_text_choose_t.

ProbabilitiesMade by a verb, never directly.
encode.ts:175 ↗
new Probabilities(landed: CompiledChosen)
itemBorrows the probabilities of item item without copying.
encode.ts:192 ↗
item(item: number): Float32Array

Binding-only.

dataEvery item's probabilities, end to end.
encode.ts:182 ↗
readonly data: Float32Array
offsetsThe count + 1 offsets, the last of them the total.
encode.ts:187 ↗
readonly offsets: BigUint64Array