Find Annotators Who Disagree With Majority Consensus in SQL

Last updated: November 29, 2026

Quick Overview

Given a table labels(task_id, annotator_id, label, submitted_at), compute each annotator's agreement rate with the strict majority label on tasks that have at least three labels, and list annotators below a threshold with a minimum number of scored tasks.

Turing
Data Manipulation (SQL/Python)
Data Engineer
Turing
November 29, 2026
Data Engineer
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Given a table labels(task_id, annotator_id, label, submitted_at), compute each annotator's agreement rate with the strict majority label on tasks that have at least three labels, and list annotators below a threshold with a minimum number of scored tasks.

Quality review is central to Turing's human data delivery: labs pay for preference and rating data that agrees with careful judgment, not noise. The interviewer checks window functions, tie handling, and whether the candidate thinks about what consensus can and cannot prove.

What the Interviewer Expects
  • Builds per-task label vote counts first
  • Defines consensus only when there is a unique top label
  • Excludes tasks with too few labels
  • Applies a minimum task count before ranking annotators
  • Explains why low agreement is a signal for review, not proof of bad work
Key Topics to Cover
SQL window functions
Majority vote
Tie handling
Annotation quality
Aggregation
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you stop an annotator's own vote from inflating their agreement score?
  • How would you weight consensus by annotator reliability, as in Dawid-Skene?
  • How would you make this query incremental for a table with a billion rows?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

One row per (task, annotator) submission, labels are categorical strings. I will ask whether an annotator can relabel a task (if so I keep their latest row by submitted_at), whether labels are alrea...

Approach

Step 1: count votes per task and label. Step 2: keep tasks with at least three total votes. Step 3: consensus is the label ranked first by votes only if no other label ties it, so I compute RANK() a...


Submit Your Answer
Markdown supported

Related Questions