File: models.proto

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (323 lines) | stat: -rw-r--r-- 15,446 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";
option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.optimization_guide.proto";
option java_outer_classname = "ModelsProto";

package optimization_guide.proto;

import "components/optimization_guide/proto/common_types.proto";

// A generic handle for any type of model.
message Model {
  reserved 1, 2, 3, 4, 123;

  oneof model {
    // When passed from the server, this is the URL that the model can be
    // downloaded from. When used internally within Chrome, this contains the
    // absolute file path where the model file is saved on disk.
    string download_url = 5;
  }
}

// Requests prediction models to be used for a set of optimization targets.
message GetModelsRequest {
  reserved 2, 4;

  // Information about the requested models.
  repeated ModelInfo requested_models = 1;
  // Context in which this request is made.
  //
  // If the context matches one that requires more urgency (i.e.
  // CONTEXT_PAGE_NAVIGATION), then no model updates will be returned for the
  // requested models.
  optional RequestContext request_context = 3;
  // The locale to associate with this request.
  //
  // It is the IETF language tag, defined in BCP 47. The region subtag is not
  // included when it adds no distinguishing information to the language tag
  // (e.g. both "en-US" and "fr" are correct here).
  optional string locale = 5;
  // Information about the request origin.
  optional OriginInfo origin_info = 6;
}

// Response to the GetModels request.
message GetModelsResponse {
  reserved 2;

  // The models to be used during prediction for the requested optimization
  // targets.
  repeated PredictionModel models = 1;
}

// Holds the prediction model for a particular optimization target.
message PredictionModel {
  // Information about the model.
  optional ModelInfo model_info = 1;
  // The model to evaluate for the attached model information.
  //
  // This will only be set if the model that the client claims it has is stale.
  // It is also guaranteed that the value populated as part of this field is one
  // that the client claims to support based on the request's client model
  // capabilities.
  optional Model model = 2;
}

message AdditionalModelFile {
  // When sent by the server, this contains the basenames of the additional
  // files that should be kept and sent to this model's consumers. When used
  // only locally within Chrome, the full path is given.
  optional string file_path = 1;
}

// Metadata for a prediction model for a specific optimization target.
//
// Next ID: 11
message ModelInfo {
  reserved 3;

  // The optimization target for which the model predicts.
  optional OptimizationTarget optimization_target = 1;
  // The version of the model, which is specific to the optimization target.
  optional int64 version = 2;
  // The set of model engine versions the requesting client can use to do model
  // inference.
  repeated ModelEngineVersion supported_model_engine_versions = 4;
  // The set of host model features that are referenced by the model.
  //
  // Note that this should only be populated if part of the response.
  repeated string supported_host_model_features = 5;
  // Additional files required by this model version.
  //
  // If populated, these files are included in the downloaded archive for this
  // model and should be passed along to the consumer.
  //
  // This does not need to be sent to the server in the request for an update to
  // this model. The server will ignore this if sent.
  repeated AdditionalModelFile additional_files = 7;
  // How long the model will remain valid in client storage. If
  // |keep_beyond_valid_duration| is true, will be ignored.
  optional Duration valid_duration = 8;
  // Whether to delete the model once valid_duration has passed.
  optional bool keep_beyond_valid_duration = 9;
  // Mechanism used for model owners to attach metadata to the request or
  // response.
  //
  // In practice, we expect this to be used as a way to negotiate capabilities.
  // The client can provide the model features they can evaluate if this field
  // is part of the request, and the server can provide the model features that
  // are actually present in the model.
  optional Any model_metadata = 6;
  // Cache key of this model. Sent in the request and response. The client can
  // set all the parameters based on the user profile characteristics, and the
  // server can return the parameters that were used by the model selection
  // logic to serve this model. The server should also update this in the model
  // info proto that is sent in the downloaded model files.
  optional ModelCacheKey model_cache_key = 10;
}

// The scenarios for which the optimization guide has models for.
enum OptimizationTarget {
  reserved 14;

  OPTIMIZATION_TARGET_UNKNOWN = 0;
  // Should only be applied when the page load is predicted to be painful.
  OPTIMIZATION_TARGET_PAINFUL_PAGE_LOAD = 1;
  // Target for supplying the language detection model via the model downloader.
  OPTIMIZATION_TARGET_LANGUAGE_DETECTION = 2;
  // Target for determining topics present on a page.
  OPTIMIZATION_TARGET_PAGE_TOPICS = 3;
  // Target for segmentation: New tab page user.
  OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB = 4;
  // Target for segmentation: Share user.
  OPTIMIZATION_TARGET_SEGMENTATION_SHARE = 5;
  // Target for segmentation: Voice user.
  OPTIMIZATION_TARGET_SEGMENTATION_VOICE = 6;
  // Target for model validation.
  OPTIMIZATION_TARGET_MODEL_VALIDATION = 7;
  // Target for determining entities present on a page.
  OPTIMIZATION_TARGET_PAGE_ENTITIES = 8;
  // Target for Chrome Permissions Suggestions Service: Notification permission.
  OPTIMIZATION_TARGET_NOTIFICATION_PERMISSION_PREDICTIONS = 9;
  // Target that enables data collection on client side for various experiments.
  OPTIMIZATION_TARGET_SEGMENTATION_DUMMY = 10;
  // Target for segmentation: Chrome Android Start user.
  OPTIMIZATION_TARGET_SEGMENTATION_CHROME_START_ANDROID = 11;
  // Target for segmentation: Query Tiles user.
  OPTIMIZATION_TARGET_SEGMENTATION_QUERY_TILES = 12;
  // Target for determining the UI visibility of a page.
  OPTIMIZATION_TARGET_PAGE_VISIBILITY = 13;
  // Target for determining topics present on a page.
  // TODO(crbug.com/40204121): Remove PAGE_TOPICS in favor of this target.
  OPTIMIZATION_TARGET_PAGE_TOPICS_V2 = 15;
  // Target for segmentation: Determine users with low engagement with chrome.
  OPTIMIZATION_TARGET_SEGMENTATION_CHROME_LOW_USER_ENGAGEMENT = 16;
  // Target for segmentation: Determine users who prefer to use Feed.
  OPTIMIZATION_TARGET_SEGMENTATION_FEED_USER = 17;
  // Target for segmentation: Determine whether price tracking should be shown
  // as a contextual page action.
  OPTIMIZATION_TARGET_CONTEXTUAL_PAGE_ACTION_PRICE_TRACKING = 18;
  // Target for smart text selection and entity extraction.
  OPTIMIZATION_TARGET_TEXT_CLASSIFIER = 19;
  // Target for Chrome Permissions Suggestions Service: Geolocation permission.
  OPTIMIZATION_TARGET_GEOLOCATION_PERMISSION_PREDICTIONS = 20;
  // Target for segmentation: Determine users who are interested in shopping.
  OPTIMIZATION_TARGET_SEGMENTATION_SHOPPING_USER = 21;
  // Target for segmentation: Chrome Android Start user V2.
  OPTIMIZATION_TARGET_SEGMENTATION_CHROME_START_ANDROID_V2 = 22;
  // Target for segmentation: Determine users who use search.
  OPTIMIZATION_TARGET_SEGMENTATION_SEARCH_USER = 23;
  // Target for Omnibox on device tail suggest.
  OPTIMIZATION_TARGET_OMNIBOX_ON_DEVICE_TAIL_SUGGEST = 24;
  // Target for client side phishing
  OPTIMIZATION_TARGET_CLIENT_SIDE_PHISHING = 25;
  // Target for Omnibox URL suggestion scoring.
  OPTIMIZATION_TARGET_OMNIBOX_URL_SCORING = 26;
  // Target for segmentation: Segment of users who switched devices.
  OPTIMIZATION_TARGET_SEGMENTATION_DEVICE_SWITCHER = 27;
  // Target for segmentation: Adaptive toolbar button.
  OPTIMIZATION_TARGET_SEGMENTATION_ADAPTIVE_TOOLBAR = 28;
  // Target for segmentation: Determine users who are tabletproductivity users.
  OPTIMIZATION_TARGET_SEGMENTATION_TABLET_PRODUCTIVITY_USER = 29;
  // Target for client side phishing image embedding model.
  OPTIMIZATION_TARGET_CLIENT_SIDE_PHISHING_IMAGE_EMBEDDER = 30;
  // Target for ranking clusters that have passed minimal filtering for the New
  // Tab Page History Clusters module.
  OPTIMIZATION_TARGET_NEW_TAB_PAGE_HISTORY_CLUSTERS_MODULE_RANKING = 31;
  // Target for web app install promotion.
  OPTIMIZATION_TARGET_WEB_APP_INSTALLATION_PROMO = 32;
  // Target for generic text embedder model.
  OPTIMIZATION_TARGET_TEXT_EMBEDDER = 33;
  // Target for classifying and extracting search images on web page.
  OPTIMIZATION_TARGET_VISUAL_SEARCH_CLASSIFICATION = 34;
  // Target for classifying users to target bottom toolbar.
  OPTIMIZATION_TARGET_SEGMENTATION_BOTTOM_TOOLBAR = 35;
  // Target for Autofill field type classification model.
  OPTIMIZATION_TARGET_AUTOFILL_FIELD_CLASSIFICATION = 36;
  // Target for ranking ios start page modules.
  OPTIMIZATION_TARGET_SEGMENTATION_IOS_MODULE_RANKER = 37;
  // Target for segmentation: Determine what modules a user should see on their
  // Desktop New Tab Page.
  OPTIMIZATION_TARGET_SEGMENTATION_DESKTOP_NTP_MODULE = 38;
  // Target for predicting candidate links for speculation-rule based
  // preloading.
  OPTIMIZATION_TARGET_PRELOADING_HEURISTICS = 39;
  // Target for determining text safety.
  OPTIMIZATION_TARGET_TEXT_SAFETY = 40;
  // Target for ranking Android home modules.
  OPTIMIZATION_TARGET_SEGMENTATION_ANDROID_HOME_MODULE_RANKER = 41;
  // Target to support running Compose On-Device.
  OPTIMIZATION_TARGET_COMPOSE = 42;
  // Target for generating passage embeddings.
  OPTIMIZATION_TARGET_PASSAGE_EMBEDDER = 43;
  // Target for breaking up sentences into phrases.
  OPTIMIZATION_TARGET_PHRASE_SEGMENTATION = 44;
  // Target to determine whether to show promotion for Compose.
  OPTIMIZATION_TARGET_SEGMENTATION_COMPOSE_PROMOTION = 45;
  // Target for ranking URL visits used in visit resumption features.
  OPTIMIZATION_TARGET_URL_VISIT_RESUMPTION_RANKER = 46;
  // Target for background segmentation of video frames.
  OPTIMIZATION_TARGET_CAMERA_BACKGROUND_SEGMENTATION = 47;
  // Target for History search model.
  OPTIMIZATION_TARGET_MODEL_EXECUTION_FEATURE_HISTORY_SEARCH = 48;
  // Target for Prompt API feature config.
  OPTIMIZATION_TARGET_MODEL_EXECUTION_FEATURE_PROMPT_API = 49;
  // Target for metrics based segmentation clustering.
  OPTIMIZATION_TARGET_SEGMENTATION_METRICS_CLUSTERING = 50;
  // Target for Summarize API feature config.
  OPTIMIZATION_TARGET_MODEL_EXECUTION_FEATURE_SUMMARIZE = 51;
  // Target for Password Manager form classification model.
  OPTIMIZATION_TARGET_PASSWORD_MANAGER_FORM_CLASSIFICATION = 52;
  // Target for model classifying notification content as suspicious.
  OPTIMIZATION_TARGET_NOTIFICATION_CONTENT_DETECTION = 53;
  // Target for History query intent model.
  OPTIMIZATION_TARGET_MODEL_EXECUTION_FEATURE_HISTORY_QUERY_INTENT = 54;
  // Target for scam detection feature config.
  OPTIMIZATION_TARGET_MODEL_EXECUTION_FEATURE_SCAM_DETECTION = 55;
  // Target for Permissions AI feature config.
  OPTIMIZATION_TARGET_MODEL_EXECUTION_FEATURE_PERMISSIONS_AI = 56;
  // Target for assessing embedding model performance.
  OPTIMIZATION_TARGET_EXPERIMENTAL_EMBEDDER = 57;
  // Target for segmentation: FedCM user.
  OPTIMIZATION_TARGET_SEGMENTATION_FEDCM_USER = 58;
  // Target for Writing Assistance APIs (Writer and Rewriter).
  OPTIMIZATION_TARGET_MODEL_EXECUTION_FEATURE_WRITING_ASSISTANCE_API = 59;
  // Target for Geolocation Permission Relevance.
  OPTIMIZATION_TARGET_GEOLOCATION_IMAGE_PERMISSION_RELEVANCE = 60;
  // Target for Notification Permission Relevance.
  OPTIMIZATION_TARGET_NOTIFICATION_IMAGE_PERMISSION_RELEVANCE = 61;
  // Target for Proofreader API.
  OPTIMIZATION_TARGET_MODEL_EXECUTION_FEATURE_PROOFREADER_API = 62;
  // Target to determine whether to show the iOS default browser promo.
  OPTIMIZATION_TARGET_SEGMENTATION_IOS_DEFAULT_BROWSER_PROMO = 63;
}

// The model engine versions that can be used to do model inference.
//
// Please only update these enums when a new major version of TFLite rolls.
//
// For example: v1.2.3
//                 ^
//                 Change when this number increments.
enum ModelEngineVersion {
  reserved 1;

  MODEL_ENGINE_VERSION_UNKNOWN = 0;
  // A model using only operations that are supported by TensorflowLite 2.3.0.
  MODEL_ENGINE_VERSION_TFLITE_2_3_0 = 2;
  // A model using only operations that are supported by TensorflowLite 2.3.0
  // with updated FULLY_CONNECTED and BATCH_MUL versions for quantized models.
  MODEL_ENGINE_VERSION_TFLITE_2_3_0_1 = 3;
  // TensorflowLite version 2.4.2, and a bit more up to internal rev number
  // 381280669.
  MODEL_ENGINE_VERSION_TFLITE_2_4 = 4;
  // TensorflowLite version 2.7.*. This is where regular ~HEAD rolls started.
  MODEL_ENGINE_VERSION_TFLITE_2_7 = 5;
  // A model using only operations that are supported by TensorflowLite 2.8.0.
  MODEL_ENGINE_VERSION_TFLITE_2_8 = 6;
  // A model using only operations that are supported by TensorflowLite 2.9.0.
  MODEL_ENGINE_VERSION_TFLITE_2_9 = 7;
  // A model using only operations that are supported by TensorflowLite 2.9.0.
  // This adds GELU to the supported ops in Optimization Guide.
  MODEL_ENGINE_VERSION_TFLITE_2_9_0_1 = 8;
  // A model using only operations that are supported by TensorflowLite 2.10.0.
  MODEL_ENGINE_VERSION_TFLITE_2_10 = 9;
  // A model using only operations that are supported by TensorflowLite 2.11.0.
  MODEL_ENGINE_VERSION_TFLITE_2_11 = 10;
  // A model using only operations that are supported by TensorflowLite 2.12.0.
  MODEL_ENGINE_VERSION_TFLITE_2_12 = 11;
  // A model using only operations that are supported by TensorflowLite 2.13.0.
  MODEL_ENGINE_VERSION_TFLITE_2_13 = 12;
  // A model using only operations that are supported by TensorflowLite 2.14.0.
  MODEL_ENGINE_VERSION_TFLITE_2_14 = 13;
  // A model using only operations that are supported by TensorflowLite 2.14.0.
  // This adds RANDOM_UNIFORM and RANDOM_STANDARD_NORMAL to the supported opts
  // in Optimization Guide.
  MODEL_ENGINE_VERSION_TFLITE_2_14_1 = 14;
  // A model using only operations that are supported by 2.16.0.
  MODEL_ENGINE_VERSION_TFLITE_2_16 = 15;
  // A model using only operations that are supported by 2.16.0. This raises the
  // max_version for FULLY_CONNECTED to version 12.
  MODEL_ENGINE_VERSION_TFLITE_2_16_1 = 16;
  // A model using only operations that are supported by 2.17, and adds int8
  // quantization support in the seq_flow_lite custom ops.
  MODEL_ENGINE_VERSION_TFLITE_2_17 = 17;
  // A model using only operations that are supported by 2.18.
  MODEL_ENGINE_VERSION_TFLITE_2_18 = 18;
  // A model using only operations that are supported by 2.20.0.
  MODEL_ENGINE_VERSION_TFLITE_2_20_0 = 19;
  // A model using only operations that are supported by 2.20.0.
  // This adds GATHER v4 to the supported operations.
  MODEL_ENGINE_VERSION_TFLITE_2_20_1 = 20;
}

// The set of parameters that the server can use to vary the served model for
// a given install. It can also vary by OS or Finch seed but those are global
// for the install.
message ModelCacheKey {
  optional string locale = 1;
}