File: autofill_field_classification_model_metadata.proto

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (122 lines) | stat: -rw-r--r-- 4,592 bytes parent folder | download | duplicates (5)
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
// 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 = "AutofillFieldClassificationModelMetadata";

package optimization_guide.proto;

message AutofillFieldClassificationEncodingParameters {
  // Per-field features that can be included in the model input.
  enum AutofillFieldClassificationFeature {
    // Don't use.
    FEATURE_UNKNOWN = 0;
    // The label of the field.
    FEATURE_LABEL = 1;
    // The placeholder in the field.
    FEATURE_PLACEHOLDER = 2;
    // The autocomplete attribute of the field.
    FEATURE_AUTOCOMPLETE = 3;
    // The id attribute of the field.
    FEATURE_ID = 4;
    // The name attribute of the field (not FormFieldData::name() which falls
    // back to the id attribute if the name attribute does not exist).
    FEATURE_NAME = 5;
    // The form control type attribute of the field.
    FEATURE_TYPE = 6;
  }

  // Per-form features that can be included in the model input.
  enum AutofillFieldClassificationFormLevelFeature {
    // Don't use.
    FORM_FEATURE_UNKNOWN = 0;
    // The titles of <button> and <submit> elements in a form containing the
    // field.
    FEATURE_FORM_BUTTON_TITLES = 1;
    // The id attribute of a form containing the field.
    FEATURE_FORM_ID = 2;
    // The name attribute of a form containing the field.
    FEATURE_FORM_NAME = 3;
    // The URL path of the frame containing the field.
    FEATURE_FRAME_URL_PATH = 4;
  }

  // Maximum number of form fields for which the model can predict types.
  // When calling the executor with a larger form, predictions are only returned
  // for the first `maximum_number_of_fields` many fields.
  int32 maximum_number_of_fields = 1;

  // Max tokens per field per feature.
  int32 max_tokens_per_feature = 2;

  // The per-field features provided to the model in the order they are
  // presented to the model.
  repeated AutofillFieldClassificationFeature features = 3;

  // Pre-processing of feature strings:
  // labels, name, id attributes, etc. are preprocessed by the following steps:

  // Split a camelCase or UpperCamelCase string into separate words with
  // spaces in between.
  bool split_on_camel_case = 4;

  // If true, map the string to lowercase.
  bool lowercase = 5;

  // Replace all characters listed in `replace_chars_with_whitespace` with a
  // single space. If empty, this step is skipped.
  string replace_chars_with_whitespace = 6;

  // Replace all characters listed in `remove_chars` with the empty string.
  // If empty, this step is skipped.
  string remove_chars = 7;

  // The per-form features provided to the model in the order they are presented
  // to the model.
  repeated AutofillFieldClassificationFormLevelFeature form_features = 8;
}

message AutofillFieldClassificationPostprocessingParameters {
  // If set, types are only assigned to fields that have predictions
  // with at least the specified minimum confidence.
  optional float confidence_threshold_per_field = 1;

  // If set, the model returns predictions only if *all* fields have predictions
  // with at least the specified minimum confidence.
  optional float confidence_threshold_to_disable_all_predictions = 2;

  // If true, the model is not allowed to return the same prediction for
  // multiple fields in the form.
  optional bool disallow_same_type_predictions = 3;
}

// Metadata for OPTIMIZATION_TARGET_AUTOFILL_FIELD_CLASSIFICATION.
message AutofillFieldClassificationModelMetadata {
  // The dictionary used for vectorization of the input labels. The strings
  // are mapped to integers in the order that they are present in the repeated
  // field. Index 0 of `input_token` maps to integer 2, since 0 is reserved for
  // padding and 1 is reserved for unknown tokens.
  repeated string input_token = 1;

  // The mapping from the model's outputs to the (integer representation of) the
  // corresponding `autofill::FieldType`.
  repeated fixed32 output_type = 2;

  // Deprecated in M132.
  reserved 3;

  // The version of the input, based on which the relevant model
  // version will be used from server.
  optional int64 input_version = 4;

  // Encoding parameters, used for input versions >= 3.
  AutofillFieldClassificationEncodingParameters encoding_parameters = 5;

  // Output processing parameters.
  AutofillFieldClassificationPostprocessingParameters
      postprocessing_parameters = 6;
}