tree: 075bd8952e72a04fc7f815a2b80b1141fb21b52f [path history] [tgz]
  1. BUILD.gn
  2. OWNERS
  3. README.md
  4. example_preprocessor_config.pb
  5. mru_features.h
  6. native_inference.cc
  7. native_inference.h
  8. native_inference.md
  9. tab_features.cc
  10. tab_features.h
  11. tab_features_test_helper.cc
  12. tab_features_test_helper.h
  13. tab_features_unittest.cc
  14. tab_score_predictor.cc
  15. tab_score_predictor.h
  16. tab_score_predictor_unittest.cc
  17. window_features.cc
  18. window_features.h
chrome/browser/resource_coordinator/tab_ranker/README.md

Tab Ranker

The Tab Ranker is an experimental model used to predict tab reactivation. We are setting up experiments to use this model as a factor in deciding which tabs to discard when the system is low on memory.

Model

The input to the model is a list of metrics about a background tab, such as whether it is pinned, how long it has been in the background, and how many events it has received. The output is a floating point value, where a higher number suggests the tab is more likely to be reactivated than a lower number. The range of possible outputs is dependent on the model; what matters is the relative ordering of scores, not the precise value of a score.

The metrics used for inference are the same metrics logged to UKM by TabMetricsLogger. Using these metrics, we trained a DNN model. The inferencing code in native_inference.cc consists of the model weights generated by TensorFlow and basic operations to execute the model over an example.

See [native_inference.md] for details on how the tf.native code is cleaned up for Chromium.

Example preprocessing

Examples are provided to the model as an array of floats, with each element corresponding to a feature. For scalar metrics like WasRecentlyActive(), this feature is simply a 0 or 1.

A metric with multiple possible values, like an enum or bucketized number, is broken into a number of features, each corresponding to one of its possible values. For example, a value of 7 for the PageTransitionCoreType metric is represented as a 1 in the PageTransitionCoreType_7 feature. See https://en.wikipedia.org/wiki/One-hot.

The AssistRanker handles this example preprocessing based on the configuration provided in example_preprocessor_config.pb. This can be examined with the print_example_preprocessor_config.py utility:

  ./components/assist_ranker/print_example_preprocessor_config.py \
  out/Release \
  chrome/browser/resource_coordinator/tab_ranker/example_preprocessor_config.pb

Scoring a tab

Use TabActivityWatcher::CalculateReactivationScore() to get a score from a WebContents.

Internally, TabScorePredictor::ScoreTab is the interface to the model. The caller needs to track a number of metrics about the tab and its window. These metrics must be calculated in the same way they were logged, as otherwise the results will not be valid.