mlx-bun library API
    Preparing search index...
    • Teacher-forced conditional likelihoods for complete supplied answers. Each forward reads [prompt; answer[:-1]]. Only hidden rows that predict answer tokens reach the head: prompt targets are masked out. Average log p(token | prefix) over each answer (negative mean NLL), then softmax across candidate averages. No vocabulary restriction changes a token's likelihood. Include a terminator in each answer to score complete, mutually exclusive responses (especially when one prefixes another).

      Inputs and graph are borrowed; every candidate gets fresh caches, released with its intermediates on success, error or cancellation. The caller serializes shared graph access. This is inference, with no training or reference model. The average includes the terminator and excludes every prompt token.

      Parameters

      • graph: DecisionScoringGraph
      • prompt: readonly number[]
      • candidates: readonly (readonly number[])[]
      • options: {
            execute?: <T>(work: () => Promise<T>) => Promise<T>;
            input?: MlxPromptInput;
            signal?: AbortSignal;
        } = {}
        • Optionalexecute?: <T>(work: () => Promise<T>) => Promise<T>

          Run one candidate's owned work at a scheduler boundary. Direct library callers may omit this when they already own exclusive graph access.

        • Optionalinput?: MlxPromptInput
        • Optionalsignal?: AbortSignal

      Returns Promise<{ meanLogLikelihoods: number[]; probabilities: number[] }>