Page MenuHomePhabricator

[SPIKE] Build fallback suggestion counts fetcher from existing APIs
Closed, ResolvedPublic5 Estimated Story Points

Description

In T430712, we will be running a controlled experiment that will evaluate the impact of surfacing the presence of suggestions on articles to logged-in editors/readers.

To date, we've assumed the "presence of suggestions on articles" would be powered by a new backend service: headless VE (T432286) or if that proves infeasible a node.js solution (T434591).
This task involves the work of evaluating the feasability a fallback solution that would not require us to build and a deploy a new backend service to determine what (if any) suggestions are available within a given article. Rather, we'd only use the suggestions that are currently available via an API.

NOTE: this task is NOT asking for a count of Edit Check suggestions, simply "issues" that are already available via an API.

Decision(s) to be made

  • 1. Is it technically feasible to use the suggestions that are currently available via an API (e.g. SuggestedImageEditCheck.js, SuggestedLinkEditCheck.js, and ToneCheck.js) to determine what (if any) suggestions are available within articles logged-in users are reading?
  • 2. If so, is the resulting coverage sufficient to power T430712? What share of logged-in article pageviews, per candidate wiki, would carry an indicator?

Open questions

  • 1. Will these counts be generated server-side? Client-side?
  • 2. What (if any) additional work would need to be done to make it so the config values volunteers defined via Special:Edit check get applied in this context?

Requirements

  1. Determine, for a given article, whether any suggestion is currently retrievable from an existing API
  2. Estimate what share of articles — and, more importantly, what share of logged-in article pageviews — that approach would cover, per wiki
  3. A recommendation on whether "1." and "2." are sufficient for T430712

Done

  • Answers to all open questions are documented
  • Paths forward for all decision(s) to be made are documented

Background

T430712 currently depends on a service that does not yet exist. This means that if T432286 and T434591 both prove infeasible or continue to be delayed, the experiment has no path forward.

The fallback this task is asking us to evaluate is simply a means of running the experiment sooner, not a proposed end state. If the experiment validates the hypothesis underpinning it, we should expect to replace it with whichever service approach we land on.

Event Timeline

ppelberg set the point value for this task to 5.

Note: this is expected to be an inaccurate fallback, because image/link/revise-tone API output doesn't actually map clearly to our suggestions for config reasons. But it'd be enough to maybe show some counts during an experiment while waiting for one of the better solutions to be deployable.

ppelberg triaged this task as High priority.
ppelberg updated the task description. (Show Details)

If so, is the resulting coverage sufficient to power T430712?

Well, I'm not the EditChecks system's developer, but in my opinion -- definitely not. The suggestions listed in the point above that one definitely don't constitute most of the suggestions being showed -- and with some of them being, as I imagine, "easily completable" (compared to "citation needed" or "rewrite text"), this doesn't include other low-hanging fruits for editors like "duplicate link" and similar.

TLDR: Existing APIs can get us some data; but the heuristic nature of the matches can only give us an approximate guess that suggestions would actually be shown in a VisualEditor session. Additionally, performance implications would need to be considered very carefully.

Suggested links

SuggestedLinkEditCheck uses the linkrecommendation API to fetch suggested link data for an article:

https://api.wikimedia.org/service/linkrecommendation/v1/linkrecommendations

Recommendations will be discarded by SuggestedLinkEditCheck if the confidence is too low, or if the specified link text and surrounding context cannot be found within the HTML rendering of the page.

Without running SuggestedLinkEditCheck (or duplicating the same verification), we could fetch the raw data for a page. This would give us some indication whether it is likely there are suggested links for a page. However this would be heuristic rather than assured: we have no way of ascertaining whether SuggestedLinkEditCheck would find a link recommendation of sufficiently high confidence with findable text/context.

We could theoretically re-implement the context verification outside of SuggestedLinkEditCheck, but then we are going in the direction of writing the same check logic in two different places.

Suggested Images

The SuggestedImageEditCheck uses ‘growthimagesuggestiondata’ query via the action API (api.php). Unlike suggested links, this works by querying a dataset generated in a weekly batch process with the relevant page title. The results are filtered to ensure the current article version has matching section titles.

From the point of view of using the raw data without applying the check logic, the infrequent batching makes it relatively more likely that the data would be outdated. This means an apparent suggested image match is not a particularly reliable indicator that SuggestedImageEditCheck would show an action. This could be mitigated by only applying the data to pages that have been unchanged for a certain period of time.

Tone

ToneCheck uses an ML model on Lift Wing to check each paragraph live. It is plaintext based, so there is a high chance of matches agreeing between the read mode article and the VE paragraph linear data, though inline templates add fuzziness to this. So in data terms, this check would be the most suitable of the three.

However the processing cost of running every paragraph through the Lift Wing model could be prohibitive, unless some very careful caching and prioritization logic were applied.

From these, we could potentially build a solution that estimates whether the suggestion count would be greater than zero. However careful discussion would be needed about how to trade off various considerations:

  • Freshness (outdatedness of the data sources)
  • Precision (few false positives)
  • Coverage (good number of articles which would be flagged)
  • Performance (not thrashing Lift Wing)

For example, we could use the suggested image data, conditional on the article having been unchanged for a long period of time. This would help precision, but worsen coverage. Likewise, processing user config would have a performance impact (because the results could not so easily be cached across users) but would improve precision.

Notes to self...

  • Freshness (outdatedness of the data sources)
    • This is about potentially NOT showing indicators on articles for which suggestions haven't been generated for the latest revision. This would, in turn, affect coverage.
    • Said another way: this would be about "buying" precision at the expense of coverage
  • Precision (few false positives)
  • Coverage (good number of articles which would be flagged)
  • Performance (not thrashing Lift Wing)
    • Might we crash Lift Wing/slow down other services that depend on it?

@dchan: thank you for bringing this all together (T438215#12402753). With regard to the considerations you helpfully laid out in T438215#12402841, what follows is the extent to which any viable solution would need to satisfy them.

Ideally, this equips you with what you need to propose a viable approach (or approaches).

Considerations

P0: requirement(s) that must be met for an approach to be considered viable.

  • Performance: no risk to LiftWing (or any other services that depend on it)

P1: requirement(s) that we would like to optimize for

  • Precision/freshness

P2: considerations we're willing to tradeoff ≠ up to a min. acceptable level – here in service of "P0" and "P1"

  • Coverage, with a floor set by the traffic/volume the experiment would need to reach in order to reach statistically significant conclusions in no longer than 4 weeks.

TLDR: If we were to build a fallback suggestion detector, I would recommend it use link recommendations only, since

  • there would be no risk of hammering Lift Wing;
  • the logic would be simple (which good because we'd need a very rapid development turnaround);
  • the coverage would be comparatively wide (see details below); and
  • the risk of staleness or otherwise getting false positives would be relatively low (see details below).

It is difficult to know upfront whether the traffic volume would give the controlled experiment enough power to reach statistically significant conclusions (as this depends on the data), but it is likely the coverage would not be an order of magnitude worse than using full EditCheckHeadless.

[Details below]

Given that we're looking for a very rapid development turnaround, and don't want to risk hammering Lift Wing, it would be simplest to exclude ToneCheck from any approach.

Based on the link recommendation research, we might expect around 10% of articles to have a link recommendation with confidence above 0.8. That is a ballpark figure for all articles (so dominated by the enormous tail of small articles). My own cursory testing on articles in Special:RecentChanges from a few included wikis (ar de en es fr he jp zh) suggests that considering only non-stub articles edited recently, most have a link recommendation with confidence above 0.8.

Based on the original image suggestion research, we might expect around 2-4% of articles to have an image suggestion. My own testing suggests that image suggestions are not particularly common on the most heavily edited articles. If we were to exclude articles edited since the last weekly batch (to reduce the risk of false positives), that would make coverage even lower.

Overall then, it seems the link recommendation API alone can identify fairly fresh pre-matches (>0.8 confidence) on a wide range of recently edited non-stub articles. The context window used to match links is 10 plaintext characters on either side, so for any given pre-match, the risk of it failing to match in the article is fairly low. To get a false positive for the scenario of our controlled experiment (T430712), the following would ALL need to happen:

  • at least one link recommendation pre-match (confidence >0.8)
  • yet EVERY link recommendation pre-match fails to match in VisualEditor's SuggestedLinkEditCheck (because the text cannot be found in the linear model, e.g. due to templates or outdatedness)
  • and NO other VisualEditor edit suggestions match either (not even edit suggestions unknown to the fallback suggestion detector)

I have not tried to quantify this risk. But heuristically it seems low, since a sequence of failures would all need to happen, and they do not seem strongly correlated.

Per offline discussion, we decided NOT to prioritize the implementation piece because of the successful outcome of the Headless VE technical pilot (T432286).