Skip to content

fix(eval): noPreambleLeak rubric has a blind spot when the preamble survives as a bullet #151

Description

@Vaishnavi1709

Surfaced by

The eval harness from #65 (PR #149). The noPreambleLeak criterion in src/lib/webllm/eval/rubric.ts is reporting 100% pass on Llama runs that visibly leaked the preamble "Here are the rewritten bullets:" as the first bullet — that's a false positive.

Root cause

The current implementation (rubric.ts):

let rawMinusBullets = output.raw.toLowerCase();
for (const b of outputBullets) {
  rawMinusBullets = rawMinusBullets.replace(b.toLowerCase(), "");
}
const noPreambleLeak = !PREAMBLE_LEAK_PHRASES.some((p) =>
  rawMinusBullets.includes(p),
);

We strip every output bullet from raw before scanning for preamble phrases. The intent was to avoid false positives when a legitimate bullet happens to contain the phrase (e.g. a bullet about "the rules of engagement"). But when the preamble itself becomes a bullet (because cleanRewriteLine didn't strip it — see #150), our own bullet-stripping step erases the leaked preamble from the scanned text. The check then passes vacuously.

Fix

Add a second check: any individual bullet whose text matches a preamble phrase should also fail noPreambleLeak. Pseudocode:

const anyBulletIsPreamble = outputBullets.some((b) =>
  PREAMBLE_LEAK_PHRASES.some((p) => b.toLowerCase().includes(p)),
);
const noPreambleLeak = !anyBulletIsPreamble && !PREAMBLE_LEAK_PHRASES.some((p) =>
  rawMinusBullets.includes(p),
);

This makes the rubric robust to both "preamble survived in raw text" and "preamble survived as a bullet" failure modes.

Add a unit test in rubric.test.ts that pins this: input with raw "Here are the rewritten bullets:\nDrove a 4-touchpoint nurture sequence..." should fail noPreambleLeak regardless of whether the preamble was line-split into a bullet or kept inline.

Tracking

Activity

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

Metadata

Metadata

Assignees

Labels

testingTests, test infrastructure, coverage

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions