File: model_quality_metadata.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 (217 lines) | stat: -rw-r--r-- 7,885 bytes parent folder | download | duplicates (8)
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
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto3";

option optimize_for = LITE_RUNTIME;
option java_package = "org.chromium.components.optimization_guide.proto";

option java_outer_classname = "ModelQualityMetadataProto";

package optimization_guide.proto;

import "components/optimization_guide/proto/model_execution.proto";
import "components/optimization_guide/proto/on_device_base_model_metadata.proto";
import "third_party/metrics_proto/system_profile.proto";

// Contains metadata about a specific feature's AiLoggingData (e.g. training
// opt-out, etc.).
message LoggingMetadata {
  metrics.SystemProfileProto system_profile = 1;

  // Auxiliary system profile information that is not captured in system_profile
  // but is critical for understanding on-device model execution.
  OnDeviceSystemProfile on_device_system_profile = 2;

  // The client's unique identifier. Each ModelExecutionFeature will have a
  // different ID every day. It should only be used for model quality logging,
  // and should not be linked to any other data sources.
  int64 client_id = 3;

  // Field id 4 is intentionally reserved for internal use.
  reserved 4;

  // Whether this Chrome installation (most likely) has a Google-managed dogfood
  // account. Note that this will be `true` whenever at least one Chrome profile
  // is signed into an @google.com account, regardless of whether that profile
  // is currently active. Precisely, the reported value matches the return value
  // of `VariationsService::IsLikelyDogfoodClient()`:
  // https://source.chromium.org/chromium/chromium/src/+/main:components/variations/service/variations_service.h?q=symbol:%5Cbvariations::VariationsService::IsLikelyDogfoodClient%5Cb
  bool is_likely_dogfood_client = 5;
}

message OnDeviceSystemProfile {
  // The performance class determined for the device based on benchmarking at
  // the start of the session.
  PerformanceClass performance_class = 1;
}

enum PerformanceClass {
  PERFORMANCE_CLASS_UNSPECIFIED = 0;
  PERFORMANCE_CLASS_VERY_LOW = 1;
  PERFORMANCE_CLASS_LOW = 2;
  PERFORMANCE_CLASS_MEDIUM = 3;
  PERFORMANCE_CLASS_HIGH = 4;
  PERFORMANCE_CLASS_VERY_HIGH = 5;
}

// Data about model execution. This includes information about whether it was
// done on a server or on a device. This includes an ID that can be mapped to
// the ModelExecutionService logs on the server.
message ModelExecutionInfo {
  reserved 1, 5, 6;

  // Information for how the on-device model execution was done.
  OnDeviceModelExecutionInfo on_device_model_execution_info = 2;

  // The error code returned by the model execution server, if any.
  ErrorResponse error_response = 3;

  // The model execution error enum. It offers more granularity over
  // `error_state` in `error_response`. This corresponds to the error enum:
  // OptimizationGuideModelExecutionError::ModelExecutionError. See more in
  // components/optimization_guide/core/model_execution/optimization_guide_model_execution_error.h
  uint32 model_execution_error_enum = 7;

  // The ID for the execution.
  //
  // If on-device, this will be prefixed with on-device:. Otherwise, this is the
  // server-side id as received from the server response used for joining with
  // ModelExecutionService logs when server-side execution is used.
  string execution_id = 4;
}

message OnDeviceModelExecutionInfo {
  reserved 1;

  // List of internal requests/responses that were performed to fulfill the
  // on-device model execution request.
  repeated InternalOnDeviceModelExecutionInfo execution_infos = 2;

  // Versions of the model being used for this execution.
  OnDeviceModelVersions model_versions = 3;
}

message OnDeviceModelVersions {
  // The model version for the on-device model.
  OnDeviceModelServiceVersion on_device_model_service_version = 1;

  // The model version for the text-safety model.
  int64 text_safety_model_version = 2;
}

message OnDeviceModelServiceVersion {
  // The version of the component used.
  string component_version = 1;

  // The version metadata of the base model used.
  OnDeviceBaseModelMetadata on_device_base_model_metadata = 2;

  // The version of the model adaptation downloaded from the server, if the
  // feature requires model adaptation.
  int64 model_adaptation_version = 3;
}

// InternalOnDeviceModelExecutionInfo is a request/response pair from a call to
// a model used to fulfill the on-device execution request.
message InternalOnDeviceModelExecutionInfo {
  InternalOnDeviceRequest request = 1;
  InternalOnDeviceResponse response = 2;
}

message InternalOnDeviceRequest {
  oneof request {
    // The request made to the on-device model service.
    OnDeviceModelServiceRequest on_device_model_service_request = 1;
    // The request made to the text safety model.
    TextSafetyModelRequest text_safety_model_request = 2;
  }
}

message InternalOnDeviceResponse {
  oneof response {
    // The response returned from the on-device model service.
    OnDeviceModelServiceResponse on_device_model_service_response = 1;
    // The response returned from the text safety model.
    TextSafetyModelResponse text_safety_model_response = 2;
  }
}

message OnDeviceModelServiceRequest {
  // The full input context constructed to be sent to the model.
  //
  // To better understand what was used as the input context, this string should
  // be truncated by `input_context_num_tokens_processed`.
  string input_context_string = 1;

  // The number of tokens processed for the input context.
  uint32 input_context_num_tokens_processed = 2;

  // The full execution string constructed to be sent to the model.
  //
  // To better understand what was used as the full string executed, this
  // string, truncated by `executed_num_tokens_processed`, should be
  // concatenated with the input context.
  string execution_string = 3;

  // The number of tokens processed for the execution string.
  uint32 execution_num_tokens_processed = 4;

  // The time in milliseconds from the context started being processed to the
  // request being initiated.
  int64 time_from_input_context_processed_to_request_initiated_millis = 5;
}

message OnDeviceModelServiceResponse {
  // The last output string sent to the calling code.
  string output_string = 1;

  // The time in milliseconds from Execute being called to the first response
  // tokens being output.
  int64 time_to_first_response_millis = 2;
  // The time in milliseconds from Execute being called to response completion.
  int64 time_to_completion_millis = 3;

  // The status of the completed response.
  OnDeviceModelServiceResponseStatus status = 4;

  // Whether the response was stopped because of repeating text.
  bool has_repeats = 5;
}

enum OnDeviceModelServiceResponseStatus {
  ON_DEVICE_MODEL_SERVICE_RESPONSE_STATUS_UNSPECIFIED = 0;
  // The response completed.
  ON_DEVICE_MODEL_SERVICE_RESPONSE_STATUS_SUCCESS = 1;
  // The response is retracted by the service.
  ON_DEVICE_MODEL_SERVICE_RESPONSE_STATUS_RETRACTED = 2;
}

message TextSafetyModelRequest {
  // The text sent to the text safety model for evaluation.
  string text = 1;

  // The URL sent to the text safety model for evaluation, if any.
  string url = 2;
}

message TextSafetyModelResponse {
  // The scores output by the model.
  repeated float scores = 1;

  // Whether the output was deemed unsafe.
  bool is_unsafe = 2;

  // The ID for the execution of the text safety model if it leveraged the
  // server for text safety evaluation.
  string server_execution_id = 3;

  // The language code of the detected language. If detection was indeterminate,
  // this is "und" per ISO 639-2.
  string language_code = 4;

  // The confidence score for the detected language. Will be a value from
  // [0.0, 1.0].
  float language_confidence = 5;
}