Skip to content

[tasks-decision] normalizePrior is ignored by evaluateBoolean() and evaluateChoice() #6398

Open

Description

@agustinbarrientos

Have I written custom code (as opposed to using a stock example script provided in MediaPipe)

Yes

OS Platform and Distribution

macOS 27.0.1

Mobile device if the issue happens on mobile device

N/A

Browser and version if the issue happens on browser

Chromium 153.0.8010.12

Programming Language and version

JavaScript

MediaPipe version

@mediapipe/tasks-decision 1.2.2 (same in 1.2.0)

Bazel version

N/A

Solution

Decision Maker

Android Studio, NDK, SDK versions (if issue is related to building in Android environment)

N/A

Xcode & Tulsi version (if issue is related to building for iOS)

N/A

Describe the actual behavior

normalizePrior is declared and documented on BooleanQuestion and ChoiceQuestion, but evaluateBoolean() and evaluateChoice() never send it to the Wasm module. Setting it has no effect, and there's no error or warning.

The same option works through evaluate():

Call normalizePrior off normalizePrior: true
evaluateBoolean(), probability of true 0.4926 0.4926
evaluate(), boolean question, probability of true 0.4926 0.1933
evaluateChoice(), pick exchange 0.5047 exchange 0.5047
evaluate(), choice question, pick exchange 0.5047 refund 0.5901

I used embeddinggemma-2-text-270m.litertlm with maxNumTokens: 256. With 1.2.0, I also ran 600 tasks through these two methods with the option on and off, and all 600 results were identical.

The cause seems to be in decision_maker.ts: neither method reads question.normalizePrior, and the Wasm signatures for evaluateBoolean and evaluateChoice have no parameter for it.

Describe the expected behaviour

normalizePrior: true should do the same in evaluateBoolean() and evaluateChoice() as it does in evaluate().

If these two methods aren't meant to support it, the option should be removed from BooleanQuestion and ChoiceQuestion, so that TypeScript flags it and people know to use evaluate().

Standalone code/steps you may have used to try to get what you need

import { DecisionMaker, FilesetResolver } from '@mediapipe/tasks-decision';

const wasm = await FilesetResolver.forDecisionTasks(
	'https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/wasm',
);

const maker = await DecisionMaker.createFromOptions( wasm, {
	baseOptions: {
		modelAssetPath: 'https://huggingface.co/litert-community/embeddinggemma-2-text-270m-litert-lm'
			+ '/resolve/main/embeddinggemma-2-text-270m.litertlm',
	},
	maxNumTokens: 256,
} );

const text = 'You charged my card twice!';
const condition = 'This customer is upset.';

const off = await maker.evaluateBoolean( text, { condition } );
const on = await maker.evaluateBoolean( text, { condition, normalizePrior: true } );
console.log( off.probabilityTrue, on.probabilityTrue ); // 0.4926 0.4926

const { upset } = await maker.evaluate( text, {
	questions: [ { id: 'upset', type: 'boolean', prompt: condition, normalizePrior: true } ],
} );
console.log( upset.probability ); // 0.1933

Other info / Complete Logs

Workaround: call evaluate() with normalizePrior: true on the question.

A comment on #6384 mentions this in passing, but I didn't find an issue for it.

From reading decision_maker.ts, BooleanQuestion.options and ChoiceQuestion.scoringMode aren't read either. I can't confirm those two from behavior, because they made no difference on this model, and options made none through evaluate() either.

Activity

  1. akashvverma1995 commented on Nov 10, 2026

    @akashvverma1995

    Hi @agustinbarrientos,

    Thanks for the detailed report. The reproduction steps and workaround are super helpful. I will reproduce it from my end. I'll look into it and get back to you!

  2. akashvverma1995 commented on Nov 12, 2026

    @akashvverma1995

    Hi @agustinbarrientos

    NormalizePrior forwarding for evaluateBoolean(), evaluateChoice(), and their batch variants has been added directly to the Wasm bindings and Web SDK in commit 0528108, and is now available in @mediapipe/[email protected]. Please upgrade to 1.2.3 and let us know if everything works as expected!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions