1/16
Learn
A checker from Yes and No, the way the coding round asks
A PracHub report from an Anthropic coding round: the candidate got a helper that returns a token probability for each input in a batch, and had to build a binary classifier with it (1 report). Pointed at an answer and its source, that classifier is a hallucination check. This lesson's practice problem builds it, in three levels:
yes_probability(logprob_yes, logprob_no)andclassify(probs, threshold): a score from the checker's two tokens, and a decision from the score.best_threshold(probs, labels, min_precision): the threshold that sends the most supported answers while staying precise enough.ece(probs, labels)andfit_temperature(logits, labels, grid): how far the scores are from honest, and the one number that fixes them.
Call Returns yes_probability(-1.2, -0.4)0.310 best_thresholdon ten checked answers, at 95% precision0.91 eceof an overconfident checker0.088 fit_temperatureon the same checker1.5, which brings the error to 0.047
The lesson follows the outdoor shop's assistant, which told a customer that returns take 60 days when its policy says 30: what hallucinations are, quotes checked in code, a checker's Yes and No, calibration, and asking several times. Seven steps end with a small task in the editor.