Comparing changes

judy compare <baseline> <candidate> pairs every query with itself, so a difference is a property of the change and not of the queries. Each side is a results file, or a target to run now (which needs --set).

Text
$ judy compare lexical hybrid --set wands.judgements.yaml
ran 480 queries against lexical in 12.1s
ran 480 queries against hybrid in 15.4s
ndcg@10: lexical -> hybrid over 479 paired queries
  mean 0.594 -> 0.661  (+0.067)
  244 better, 146 same, 89 worse   p = 0.0001 (a real difference at 5%)
  479 queries were sent a different search request
  1 queries could not be paired

most improved
   +0.775  0.000 -> 0.775  donaldson teak couch
   +0.716  0.220 -> 0.936  black fluffy stool
   +0.716  0.284 -> 1.000  china clock
   +0.676  0.202 -> 0.878  turquoise pillows
   +0.631  0.369 -> 1.000  cake cutlery

most regressed
   -0.721  0.950 -> 0.228  board game storage cabinet
   -0.642  0.706 -> 0.064  gurney  slade 56
   -0.569  1.000 -> 0.431  pennfield playhouse
   -0.515  0.841 -> 0.326  mystic swivel
   -0.507  0.840 -> 0.333  itchington butterfly

in plain words
  hybrid is better than lexical, and the difference is unlikely to be chance (p = 0.0001). On
    average ndcg@10 goes up by 0.067 (11% more than the baseline's 0.594).
  244 of 479 queries improved (51%), 89 got worse (19%) and 146 did not change.
  A better average can hide queries that got worse, and here 19% did. Read 'most regressed' before
    you ship: if those are queries your users care about, the average is not the whole story.

The in plain words block is added after the numbers and changes none of them; --no-explain leaves it out.

  • The mean is the average difference in the metric over the paired queries (ndcg@10 by default, or --metric).

  • Better, same, worse count queries. A good mean with 89 worse queries is a change to look at before you ship, and the most regressed list is where to start.

  • p comes from a two-sided paired permutation test (a sign-flip test) of the mean difference against zero. It asks how often a mean this far from zero appears when each query's difference is as likely to be positive as negative. With up to 16 pairs judy tries every sign pattern. With more pairs it tries 10,000 random patterns from a fixed seed. The answer is the same on every run. With three queries a perfect improvement still gives p = 0.25, and judy says so:

    Text
    3 better, 0 same, 0 worse   p = 0.25 (not distinguishable from noise)
    
  • "were sent a different search request" counts the queries whose request differs between the two sides. You expect this when you change the query. Look closer when you did not.

  • "could not be paired" counts the queries that only one side had. It also counts queries with no value in one run, such as a query with no relevant documents.

Option Meaning
--set <file> the judgement set; needed when a side is a target
--config <file> the configuration file (default judy.yaml)
--metric <kind@k> the metric to compare; defaults to the baseline's nDCG
--labels all\|human for sides that run now: count cached LLM labels, or ignore them
--max-regression <n> exit 1 when the candidate's mean is lower than the baseline's by more than n
--format text\|md\|json the output
--concurrency <n> how many queries run at once (default 4)

A side can be target:key=value, which runs the target with one tuning parameter changed:

Shell
judy compare full full:title_boost=5 --set wands.judgements.yaml

so a boost sweep is a loop of compares.

Results files are plain files. Run the baseline once and keep it:

Shell
judy run set.yaml --target prod
git add set.prod.results.yaml
judy compare set.prod.results.yaml candidate --set set.yaml
  1. writes set.prod.results.yaml
  2. or keep it as a CI artifact

If the two sides judged different shares of their top results, compare says so. The gap in judged@k that triggers it is 0.10. The side with more unjudged documents is scored unfairly. Run judy judge and compare again.