Page MenuHomePhabricator

Evaluate did-you-mean suggestion variants and decide on an AB test plan
Closed, ResolvedPublic5 Estimated Story Points

Description

As part of T390858 we added a new suggest_variant field to the production search clusters that contains the opening_text content, rather than the titles and redirects. We suspect this will produce a language model that more accurately reflects the queries users will type.

Come up with a method to compare the existing did-you-mean against an updated version, and use that comparison to decide what we should put in front of users to AB test.

AC

  • decision on what to A/B test
  • ticket created to do the actual A/B test and analysis

Event Timeline

Bit of a first draft, this defines a few new profiles:

  • default - The existing prod deployment
  • expensive_1 - Existing suggest field, allow more corrections, generate more candidates, min prefix len of 1
  • expensive_2 - Existing suggest field, allow more corrections, generate more candidates, min prefix len of 2
  • variant - Default configuration against suggest_variant (opening_text) field
  • expensive_1_variant - expensive_1 against the suggest_variant field
  • expensive_2_variant - expensive_2 against the suggest_variant field

The queries used here are a completely biased sample I came up with looking at the fulltext head queries dashboard, along with reviewing samples of logged queries that we provided suggestions to. They will be biased towards things i found "interesting", such as bad rewrites by the old engine.

queryprofiletook_mssuggest
tayps of wlding difactsdefault19tales of wlding didacus
tayps of wlding difactsexpensive_139tales of wedding defects
tayps of wlding difactsexpensive_223tales of wledig dirac's
tayps of wlding difactsvariant51tails of wlding directs
tayps of wlding difactsexpensive_1_variant73types of welding defects
tayps of wlding difactsexpensive_2_variant39tales of wledig directs
whose powerdefault17white power
whose powerexpensive_131white power
whose powerexpensive_236white power
whose powervariant62
whose powerexpensive_1_variant51
whose powerexpensive_2_variant40
maraciabodefault23marciano
maraciaboexpensive_127marciano
maraciaboexpensive_222marciano
maraciabovariant43maracaibo
maraciaboexpensive_1_variant80maracaibo
maraciaboexpensive_2_variant57maracaibo
theoldmanandtheseadefault16
theoldmanandtheseaexpensive_122
theoldmanandtheseaexpensive_219
theoldmanandtheseavariant36
theoldmanandtheseaexpensive_1_variant40
theoldmanandtheseaexpensive_2_variant26
Modern watfaredefault21modern warfare
Modern watfareexpensive_141modern warfare
Modern watfareexpensive_252modern warfare
Modern watfarevariant30modern warfare
Modern watfareexpensive_1_variant72modern warfare
Modern watfareexpensive_2_variant41modern warfare
Cinderalladefault11cinderella
Cinderallaexpensive_124cinderella
Cinderallaexpensive_28cinderella
Cinderallavariant13cinderella
Cinderallaexpensive_1_variant38cinderella
Cinderallaexpensive_2_variant14cinderella
Witchita madefault10wichita ma
Witchita maexpensive_116wichita ma
Witchita maexpensive_210wichita ma
Witchita mavariant18wichita ma
Witchita maexpensive_1_variant29wichita ma
Witchita maexpensive_2_variant19wichita ma
voight coporationdefault27vought corporation
voight coporationexpensive_137vought corporation
voight coporationexpensive_224vought corporation
voight coporationvariant39vought corporation
voight coporationexpensive_1_variant67vought corporation
voight coporationexpensive_2_variant40vought corporation
panaslonic lx100default18panasonic lx100
panaslonic lx100expensive_128panasonic lx100
panaslonic lx100expensive_219panasonic lx100
panaslonic lx100variant40panasonic lx100
panaslonic lx100expensive_1_variant94panasonic lx100
panaslonic lx100expensive_2_variant26panasonic lx100
Nigeriendefault10nigeria
Nigerienexpensive_162nigeria
Nigerienexpensive_210nigeria
Nigerienvariant52nigerian
Nigerienexpensive_1_variant56nigeria
Nigerienexpensive_2_variant17nigeria
infantery theorydefault28infantry theory
infantery theoryexpensive_134infantry theory
infantery theoryexpensive_225infantry theory
infantery theoryvariant45infantry theory
infantery theoryexpensive_1_variant460infantry theory
infantery theoryexpensive_2_variant53infantry theory
tungstondefault45tungsten
tungstonexpensive_117tungsten
tungstonexpensive_27tungsten
tungstonvariant17tungsten
tungstonexpensive_1_variant33tungsten
tungstonexpensive_2_variant14tungsten
kunect star warsdefault22kunst star wars
kunect star warsexpensive_139kinect star wars
kunect star warsexpensive_229kunst star wars
kunect star warsvariant35kunert star wars
kunect star warsexpensive_1_variant132kinect star wars
kunect star warsexpensive_2_variant56kunst star wars
WWIi museummdefault18wwi museum
WWIi museummexpensive_155wwii museum
WWIi museummexpensive_219wwi museum
WWIi museummvariant26wwii museum
WWIi museummexpensive_1_variant56wwii museum
WWIi museummexpensive_2_variant29wwii museum
Is honaluah the largest islanddefault30is honaluah the largest islands
Is honaluah the largest islandexpensive_169is honaluah the largest islands
Is honaluah the largest islandexpensive_236is honaluah the largest islands
Is honaluah the largest islandvariant144
Is honaluah the largest islandexpensive_1_variant340
Is honaluah the largest islandexpensive_2_variant62
aligator steaks for saledefault29alligator stakes for sale
aligator steaks for saleexpensive_147aviator spears for sale
aligator steaks for saleexpensive_231alligator stakes for sale
aligator steaks for salevariant216alligator steals for sale
aligator steaks for saleexpensive_1_variant829aviator streak for sale
aligator steaks for saleexpensive_2_variant129alligator streak for sale
leaving phone flashlight on whole chargingdefault53leaving phone flashlight on white changing
leaving phone flashlight on whole chargingexpensive_170living phone flashlight on white changing
leaving phone flashlight on whole chargingexpensive_245learning phone flashlight on white changing
leaving phone flashlight on whole chargingvariant154leading phone flashlight on whole changing
leaving phone flashlight on whole chargingexpensive_1_variant497leading photo flashlight on while charging
leaving phone flashlight on whole chargingexpensive_2_variant339leaving phnom flashlight on while changing
noctural primatedefault60noctua primary
noctural primateexpensive_176natural prime
noctural primateexpensive_220noctua prime
noctural primatevariant146nocturnal primate
noctural primateexpensive_1_variant307nocturnal primate
noctural primateexpensive_2_variant47nocturnal primate
Journel of anerican medixinedefault37journal of anglican medixine
Journel of anerican medixineexpensive_148journal of american medicine
Journel of anerican medixineexpensive_231journal of anglican medicine
Journel of anerican medixinevariant194journal of anglican medixine
Journel of anerican medixineexpensive_1_variant522journal of american medicine
Journel of anerican medixineexpensive_2_variant186journal of anglican medicine
aronud what year did ancient ghana existdefault34arnold what year did ancient ghana exit
aronud what year did ancient ghana existexpensive_170arnold what your did ancient ghana ernst
aronud what year did ancient ghana existexpensive_246arnold white year did ancient ghana exit
aronud what year did ancient ghana existvariant160around what year did ancient ghana exist
aronud what year did ancient ghana existexpensive_1_variant641around what year did ancient ghana exist
aronud what year did ancient ghana existexpensive_2_variant250around what year did ancient ghana exist
Life history of gigamesh not more than 50 wordsdefault40life history of gilgamesh not more than 50 words
Life history of gigamesh not more than 50 wordsexpensive_183life history of girugamesh not more than 50 world
Life history of gigamesh not more than 50 wordsexpensive_251life history of girugamesh not more than 50 world
Life history of gigamesh not more than 50 wordsvariant163life history of gilgamesh not more than 50 works
Life history of gigamesh not more than 50 wordsexpensive_1_variant430line history of gilgamesh not more than 50 world
Life history of gigamesh not more than 50 wordsexpensive_2_variant199line history of gilgamesh not more than 50 world
Robert Fedderick Kennedydefault28robert feyerick kennedy
Robert Fedderick Kennedyexpensive_145robert frederick kenneth
Robert Fedderick Kennedyexpensive_228robert feyerick kennedy
Robert Fedderick Kennedyvariant147
Robert Fedderick Kennedyexpensive_1_variant636
Robert Fedderick Kennedyexpensive_2_variant90
Longest commercial flught riutesdefault34longest commercial flight rifles
Longest commercial flught riutesexpensive_166longest commercial flight routes
Longest commercial flught riutesexpensive_234longest commercial flight riots
Longest commercial flught riutesvariant175longest commercial flights rifles
Longest commercial flught riutesexpensive_1_variant292largest commercial flight routes
Longest commercial flught riutesexpensive_2_variant126longest commercial flight rises
thyreoidaldefault36thyreoideae
thyreoidalexpensive_126thyreoideae
thyreoidalexpensive_214thyreoideae
thyreoidalvariant24
thyreoidalexpensive_1_variant43
thyreoidalexpensive_2_variant27
how much protons do berrylliums worthdefault31how much proteins do berrylliums world
how much protons do berrylliums worthexpensive_156how much proton do beryllium world
how much protons do berrylliums worthexpensive_237how much proto do beryllium world
how much protons do berrylliums worthvariant158how much protons do beryllium works
how much protons do berrylliums worthexpensive_1_variant303how much protons do beryllium world
how much protons do berrylliums worthexpensive_2_variant103how much protons do beryllium world
Zeena Warrior Princessdefault33zebra warrior princess
Zeena Warrior Princessexpensive_139zelda warriors prince
Zeena Warrior Princessexpensive_227zelda warriors prince
Zeena Warrior Princessvariant104
Zeena Warrior Princessexpensive_1_variant227zheng warrior princess
Zeena Warrior Princessexpensive_2_variant65zebra warrior princess
when did the mellenial dome open and closedefault31when did the mellenial dome open and closed
when did the mellenial dome open and closeexpensive_159where did the millennial dome open and clyde
when did the mellenial dome open and closeexpensive_250what did the mellena dome open and closed
when did the mellenial dome open and closevariant126when did the meglenia dome open and close
when did the mellenial dome open and closeexpensive_1_variant361what did the millennial done open and close
when did the mellenial dome open and closeexpensive_2_variant170where did the meglenia done open and close
locking pilersdefault20looking piers
locking pilersexpensive_141looking powers
locking pilersexpensive_221looking pilots
locking pilersvariant61looking piers
locking pilersexpensive_1_variant106looking powers
locking pilersexpensive_2_variant55losing pilots
DEFINE COCAINdefault36defense cobain
DEFINE COCAINexpensive_147defense cousin
DEFINE COCAINexpensive_230defense cousin
DEFINE COCAINvariant79defined cocaine
DEFINE COCAINexpensive_1_variant195device contain
DEFINE COCAINexpensive_2_variant185device contain
demascusdefault43demarcus
demascusexpensive_120damascus
demascusexpensive_213demarcus
demascusvariant89demarcus
demascusexpensive_1_variant129damascus
demascusexpensive_2_variant23demarcus
periductaal grijsdefault19periductal gries
periductaal grijsexpensive_136periductal girls
periductaal grijsexpensive_219periductal grass
periductaal grijsvariant66periductal grids
periductaal grijsexpensive_1_variant145periductal girls
periductaal grijsexpensive_2_variant53periductal grows
celebrities who speeks Afrikaansdefault22celebrities who speaks africans
celebrities who speeks Afrikaansexpensive_195celebrities who speaks africans
celebrities who speeks Afrikaansexpensive_225celebrities who speak africans
celebrities who speeks Afrikaansvariant59celebrities who speaks afrikaans
celebrities who speeks Afrikaansexpensive_1_variant257celebrities who speaks afrikaans
celebrities who speeks Afrikaansexpensive_2_variant55celebrities who speaks afrikaans
Crimea religondefault20crime region
Crimea religonexpensive_141crimea region
Crimea religonexpensive_227crimea region
Crimea religonvariant102crime religion
Crimea religonexpensive_1_variant175crime religion
Crimea religonexpensive_2_variant232crime religion
What states are in northeast rigondefault33what states are in northwest ripon
What states are in northeast rigonexpensive_156when stakes are in northeast region
What states are in northeast rigonexpensive_253when stakes are in northeast right
What states are in northeast rigonvariant107what states are in northwest ripon
What states are in northeast rigonexpensive_1_variant224west stands are in northeast region
What states are in northeast rigonexpensive_2_variant148when states are in northwest right
brithay of prophat muhameddefault32brithay of prophet muhammed
brithay of prophat muhamedexpensive_146birthday of prophet mohamed
brithay of prophat muhamedexpensive_230brigham of prophet muhammad
brithay of prophat muhamedvariant105brithay of prophet muhammad
brithay of prophat muhamedexpensive_1_variant263birthday of prophet muhammad
brithay of prophat muhamedexpensive_2_variant112brigham of prophet muhammad
Swarovski Earringdefault45swarovski eating
Swarovski Earringexpensive_160swarovski eating
Swarovski Earringexpensive_216swarovski eating
Swarovski Earringvariant21swarovski earning
Swarovski Earringexpensive_1_variant183swarovski earning
Swarovski Earringexpensive_2_variant30swarovski earning
Lancer sportbackdefault17lancet sportpark
Lancer sportbackexpensive_162latter sportpark
Lancer sportbackexpensive_222latter sportpark
Lancer sportbackvariant44
Lancer sportbackexpensive_1_variant248
Lancer sportbackexpensive_2_variant43
bday beyonce albumdefault26bdsm beyoncé album
bday beyonce albumexpensive_149bay beyonce album
bday beyonce albumexpensive_230bdsm beyonce album
bday beyonce albumvariant85bdsm beyoncé album
bday beyonce albumexpensive_1_variant501bay beyond album
bday beyonce albumexpensive_2_variant114bdsm beyoncé album
what is the melting point of zincdefault36what is the meaning point of zinn
what is the melting point of zincexpensive_151what is the meaning point of zone
what is the melting point of zincexpensive_245what is the meaning point of zinn
what is the melting point of zincvariant79what is the meeting point of zinc
what is the melting point of zincexpensive_1_variant245what is the meeting point of zinc
what is the melting point of zincexpensive_2_variant118what is the meeting point of zinc
Cher if i could turn back timedefault34chen if i could turn back time
Cher if i could turn back timeexpensive_167chen if i could turn back time
Cher if i could turn back timeexpensive_253chen if i could turn back time
Cher if i could turn back timevariant80
Cher if i could turn back timeexpensive_1_variant510
Cher if i could turn back timeexpensive_2_variant162
Backsplicing dnadefault13backsliding dna
Backsplicing dnaexpensive_124backsliding dna
Backsplicing dnaexpensive_221backsliding dna
Backsplicing dnavariant72backsliding dna
Backsplicing dnaexpensive_1_variant145backsliding dna
Backsplicing dnaexpensive_2_variant35backsliding dna
bees + stingersdefault16beer strangers
bees + stingersexpensive_151beer singer
bees + stingersexpensive_244beer strangers
bees + stingersvariant76been strangers
bees + stingersexpensive_1_variant164been singers
bees + stingersexpensive_2_variant134bees stingless
powers given to federal governmentdefault36powell given to federal government
powers given to federal governmentexpensive_167power green to federal government
powers given to federal governmentexpensive_237powell given to federal government
powers given to federal governmentvariant193
powers given to federal governmentexpensive_1_variant650
powers given to federal governmentexpensive_2_variant138
motogp records all categoriesdefault34motown records all categories
motogp records all categoriesexpensive_185motown records all categories
motogp records all categoriesexpensive_237motown records all categories
motogp records all categoriesvariant254motown records all categories
motogp records all categoriesexpensive_1_variant673motown records all categories
motogp records all categoriesexpensive_2_variant273motown records all categories
characteristic facts of medusadefault35
characteristic facts of medusaexpensive_176characteristic falls of medina
characteristic facts of medusaexpensive_231characteristic faces of media
characteristic facts of medusavariant96characteristics facts of medina
characteristic facts of medusaexpensive_1_variant149characteristics faith of medina
characteristic facts of medusaexpensive_2_variant161characteristics faith of medina
top 10 best rappers in Ghana nowdefault23top 10 best rangers in ghana now
top 10 best rappers in Ghana nowexpensive_169top 10 best rangers in ghana now
top 10 best rappers in Ghana nowexpensive_235top 10 best rangers in ghana now
top 10 best rappers in Ghana nowvariant155
top 10 best rappers in Ghana nowexpensive_1_variant262
top 10 best rappers in Ghana nowexpensive_2_variant172
electro wining cell process in gold processdefault45electro winning cell princess in gold process
electro wining cell process in gold processexpensive_1108electro winning cell protests in gold princess
electro wining cell process in gold processexpensive_259electro winning cell protests in gold princess
electro wining cell process in gold processvariant128elector winning cell process in gold process
electro wining cell process in gold processexpensive_1_variant396election winning call process in gold process
electro wining cell process in gold processexpensive_2_variant166election winning cell process in good process
How much calorie a whole wheat barrel havedefault53how much camogie a whole wheat barred have
How much calorie a whole wheat barrel haveexpensive_199how much carrie a whole wheat barrow haven
How much calorie a whole wheat barrel haveexpensive_250how much carrie a whole wheat barker hall
How much calorie a whole wheat barrel havevariant141how much calories a whole wheat barrels have
How much calorie a whole wheat barrel haveexpensive_1_variant355how much caloric a whole wheel barnes have
How much calorie a whole wheat barrel haveexpensive_2_variant193how much caloric a whole wheel barnes have
strongest typhoon to make landfall in japandefault37strongest typhoon to male landfills in japan
strongest typhoon to make landfall in japanexpensive_167strongest typhoon to male landfills in japan
strongest typhoon to make landfall in japanexpensive_239strongest typhoon to male landfills in japan
strongest typhoon to make landfall in japanvariant150
strongest typhoon to make landfall in japanexpensive_1_variant293
strongest typhoon to make landfall in japanexpensive_2_variant184
inert bombdefault23in art bomb
inert bombexpensive_141insect body
inert bombexpensive_225insect body
inert bombvariant87
inert bombexpensive_1_variant246
inert bombexpensive_2_variant141
CentOS 7default11centre 7
CentOS 7expensive_128canton 7
CentOS 7expensive_212centre 7
CentOS 7variant21
CentOS 7expensive_1_variant95
CentOS 7expensive_2_variant44
pfischer set the point value for this task to 5.Sep 8 2025, 4:02 PM

Trying to put some sort of judgement on the list i came up with the following categories:

  • IR: Incorrect rewrite of bad query
  • FR: Failed to rewrite bad query
  • RG: Rewriting a query that was already good
  • NG: Not rewriting a good query
  • GR: Plausibly good rewrite of bad query

An improved ranker should move queries from IR or FR to GR, and from RG to NG.
If we pivot on that with the above set of queries we get:

profilemean responseIRFRRGNGGR
default29ms2511519
variant93ms1847913
expensive_230ms2611608
expensive_2_variant103ms1938813
expensive_151ms18116016
expensive_1_variant261ms1138821

Some thoughts:

  • The variant field seems to always outperform the default field when using the same configuration. But the response time is also >= 3x.
  • NG being 1 (or 0) for the default profile is by construction. Those queries were chosen from query logs as examples where the production suggester gives bad suggestions. It's interesting that the more expensive configurations against the same field don't seem to improve.
  • expensive_1 did a decent job of moving some queries from IR to GR while not overly increasing runtime costs. Arguably expensive_1 did a better job on this test set than expensive_2_variant, despite half the mean runtime and not having access to the expanded statistics of the variant field.
  • expensive_1_variant shows significant improvements from the baseline default profile, suggesting that if this test set is representative then we have the opportunity to help some number of queries.
  • This dataset may not be particularly representative though, it was constructed by hand by selecting "interesting" queries from query logs. The bias in dataset collection limits generalizability, but I think still provides a reasonable place to decide on tests from.
  • it looks like our largest wins, and our largest costs, come from reducing prefix length from 2 to 1.

For this set of profiles, I'm thinking:

Profiles to pass on:

  • variant - skip in favor of expensive_2_variant
  • expensive_2 - skip, no real benefit over default

AB test to run:

  • default - existing prod
  • expensive_1 - interesting result, good performance without the latency cost of the variant field
  • expensive_2_variant - Could go with this or variant. If we pushed variant as the default prod, it would have to be one of these two. Expect to compare against expensive_1.
  • expensive_1_variant - Expecting latency cost to be too much to ship, but this was the strongest performer. Seems worth AB testing to see the numbers.

Nice write up! Your conclusions make sense to me. Do you want to do an A/B/C/D test, or a series of (three?) A/B tests?

An improved ranker should move queries from IR or FR to GR, and from RG to NG.

For my own sanity, I reformatted your table. I couldn't keep the abbreviations straight at first so I grouped things that go together together and bolded the "good" columns that we want to see increases in. Makes more sense now, and I can more easily see that *R == IR+FR+GR == 35, and *G == RG+NG == 16.

Note: After talking about this more, we determined that default is equivalent to default_2 and variant is default_2_variant, so I've renamed them to make the relations clearer.

profilemean responseIRFRGRRGNG
default_229ms2519151
default_2_variant93ms1841379
expensive_230ms2618160
expensive_2_variant103ms1931388
expensive_151ms18116160
expensive_1_variant261ms1132188

As I mentioned on IRC I'm less concerned about FR so I think moves from IR to FR are good, too—doing nothing is better than being really wrong. RG going down and net moves from IR to FR probably won't change clickthroughs, but they will both help with the reputation and confidence in the suggestions as they increase precision (by decreasing the denominator).

expensive_2 - skip, no real benefit over default

It's actually the same of worse in every column!

The variant option really is doing the heavy lifting.

The variant option really is doing the heavy lifting.

The variant decreases IR by 7 and RG by 8. prefix_1 seems to decrease IR by another 8 (expensive_2 vs expensive_1). So I'd like to see default_1, and default_1_variant. Maybe expensive isn't the most important part (welding defects be damned).

Per discussion at wed meeting i added a couple more profiles and renamed the existing profiles to be more consistent. The names should now consistently be of the format: {profile_name}_{prefix_len}(_variant)?. The numbers are mostly but not directly comparable to above, all the queries were re-run which gave new latency numbers and different results for some queries. All of the results were re-graded into one of the 5 buckets.

profiletook msIRFRGRRGNG
default_14614315145
default_1_variant1268519811
default_2322228163
default_2_variant7014513910
expensive_15316115172
expensive_1_variant16412416109
expensive_2312219172
expensive_2_variant7017411109

The summary might be that the expensive versions cost more, but don't improve metrics much. Sometimes the metrics even go backwards on the more expensive query. At least on this test set. As Trey stated above, the variant field was doing most of the heavy lifting. The default_1_variant, which is the existing production configuration (mostly opensearch defaults) with prefix_len=1 and the opening_text field for token statistics, performs the best on this set of queries.

Curiously the mean latency also went down compared to the previous run, but I'm not sure how meaningful that is. We will likely need to look at latency on the full AB test to have enough data to derive good stats around how much the latency changes.

Based on this, it almost seems the expensive variants are a wash and not worth moving forward to the AB test.

Current proposed AB test:

  • default_2 - existing prod configuration
  • default_1 - promsing configuration wrt latency, changes only prefix_length from current prod config
  • default_1_variant - best performing configuration. If it's truly deployable will depend on latency results. Will also be interesting to know if these improvements lead to measurable changes in behaviour. Even if we cant ship it, maybe we can find a middle ground.

default_1 looks like a winner if default_1_variant turns out to be too expensive. The A/B test results on latency and clicks will be interesting.

Seems like we have a decision. T404647 created to run the test.