DEV Community

Shawdai Marie
Shawdai Marie

Posted on AI-assisted

A label is a decision

This field note and its illustration were prepared with AI assistance.

Two annotators can read “please close this” as either an account cancellation or the end of a ticket. Save their disagreement before adjudicating it. Those cases make a better test of the label definition than another hundred examples everyone already agrees on.

The Support Answer Release Lab makes the ambiguity reproducible. Its baseline breaks a tie by document order and selects the ticket policy. The candidate sees the same tie and routes to review. The interactive demo uses fictional policies and deterministic token matching.

Reproduce the experiment with Node.js. Save this listing as release-check.js and run node release-check.js. Each row shows the input, expected route and observed route.

const documents = [
  {id:"R1", terms:["refund","receipt","purchase"], active:true, answer:"A refund request needs a purchase receipt."},
  {id:"T1", terms:["close","ticket","support"], active:true, answer:"A resolved support ticket can be closed."},
  {id:"A1", terms:["close","account","owner"], active:true, answer:"An account closure request needs owner confirmation."},
  {id:"P0", terms:["legacy","pricing"], active:false, answer:"Archived pricing schedule."}
];
const cases = [
  ["Refund with receipt","refund receipt","R1"],
  ["Close a support ticket","close ticket","T1"],
  ["Close an account","close account","A1"],
  ["Ambiguous request","please close this","review"],
  ["Retired document","legacy pricing","review"],
  ["Unrelated question","holiday hours","review"],
  ["Negated intent","do not close my account","review"]
];
function route(query, version) {
  const tokens = new Set(query.toLowerCase().match(/[a-z]+/g) || []);
  const scores = documents.filter(d => version === "baseline" || d.active)
    .map(d => ({doc:d, score:d.terms.filter(word => tokens.has(word)).length}))
    .sort((a,b) => b.score - a.score);
  const [best, next] = scores;
  let reason = "matching source";
  if (best.score === 0) reason = "no matching terms";
  else if (version === "candidate" && best.score === next.score) reason = "tied sources";
  else if (version === "candidate" && best.score < 2) reason = "weak evidence";
  return {route:reason === "matching source" ? best.doc.id : "review", reason,
    ranking:scores.map(x => [x.doc.id,x.score])};
}
function evaluate(version) {
  return cases.map(([name,query,expected]) => {
    const actual = route(query,version).route;
    return {name,query,expected,actual,pass:actual === expected};
  });
}

for (const version of ["baseline", "candidate"]) {
  console.log(version);
  console.table(evaluate(version));
}
Enter fullscreen mode Exit fullscreen mode

Reading: Datasheets for Datasets

Research and discussion: Microsoft Research, Timnit Gebru, Massachusetts Institute of Technology.

Further reading
MIT Software Construction · Testing

A label is a decision. One phrase, two labels. Input: Please close this. Interpretation A: Close the support ticket. Interpretation B: Close the customer account. Original request. Two interpretations. Adjudicated label.

AI-assisted illustration. One request can refer to closing a support ticket or closing an account.

Top comments (0)