Machine-learning model for intelligent rule generation
The present disclosure relates to systems and methods for automatic rule generation based on natural language input. Natural language input can be received. The natural language input can be tokenized. First tokens can be mapped to a first condition of a rule, and second tokens can be mapped to a second condition of the rule. A graph representation of the natural language input can be generated. A pre-generated, tenant-specific graph can be selected that corresponds to the graph representation of the natural language input. A rule can be generated based on the tenant-specific graph. The rule can be provided to facilitate implementation of the rule.
1 . A computer-implemented method comprising:
receiving, by a computing device, natural language input representing a request by an entity to create a rule characterized by a rule type, the rule type including one or more conditions and one or more actions based on the one or more conditions;
tokenizing, by the computing device, the natural language input to generate a set of tokens that represents the natural language input;
mapping, by the computing device and using a trained graph-based machine-learning model, a first subset of the tokens to a first condition of the one or more conditions and a second subset of the tokens to a second condition of the one or more conditions;
generating, by the computing device, a graph representation of the natural language input, the graph representation including one or more nodes corresponding to the first subset of the tokens and one or more attributes, each attribute of the one or more attributes including a different token of the second subset of the tokens;
training, by the computing device, the graph-based machine-learning model using at least (a) a set of custom schema corresponding to tenant-specific data, wherein each custom schema included in the set of custom schema is different and associated with a different tenant, and (b) tenant-ambiguous data;
generating a tenant-specific graph of a set of tenant-specific graphs that uses at least part of the set of custom schema and at least part of the tenant-ambiguous data;
determining, by the computing device, the tenant-specific graph of the set of tenant-specific graphs corresponds to the graph representation of the natural language input, wherein the set of tenant-specific graphs is generated by the trained graph-based machine-learning model;
generating, by the computing device, the rule by adjusting a template of the rule type using nodes of the tenant-specific graph and attributes of the tenant-specific graph;
causing display, by the computing device, of information indicating at least the first condition and the second condition of the rule; and
wherein the rule as generated, when evaluated by one or more computing devices and the first condition and the second condition are determined to be satisfied, causes the one or more computing devices to execute an action defined by the rule.
2 . The computer-implemented method of claim 1 , wherein the trained graph-based machine-learning model includes a graph neural network-BERT (GNN-BERT) model, a graph convolutional network (GCN), a gated-graph convolutional network (G-GCN), or a graph isomorphism network (GIN).
3 . The computer-implemented method of claim 1 , wherein each tenant-specific graph of the set of tenant-specific graphs corresponds to a different custom schema of the set of custom schema, and wherein the tenant-specific graph is included in the set of tenant-specific graphs.
4 . The computer-implemented method of claim 1 , wherein:
receiving the natural language input comprises receiving, by the computing device, the natural language input via a user interface provided by a user interface layer that is communicatively coupled to an application programming interface layer;
generating the rule comprises generating, by the computing device, the rule using a machine-learning layer that is communicatively coupled to the application programming interface layer;
the application programming interface layer is configured to transmit the natural language input from the user interface layer to the machine-learning layer and to transmit the rule from the machine-learning layer to the user interface layer;
training the graph-based machine-learning model comprises training, by the computing device, the graph-based machine-learning model using a pre-training layer that is communicatively coupled to the machine-learning layer; and
the pre-training layer is configured to provide the machine-learning layer with access to each graph of the set of tenant-specific graphs.
5 . The computer-implemented method of claim 1 , wherein providing the rule to the entity comprises providing, by the computing device and via a user interface, the rule in an entity-readable format with one or more adjustable fields that, when adjusted, cause the rule to be edited.
6 . The computer-implemented method of claim 5 , further comprising:
receiving, by the computing device and via the user interface, input indicating an adjustment to the rule; and
retraining, by the computing device, the trained graph-based machine-learning model using the adjustment to the rule.
7 . The computer-implemented method of claim 6 , wherein retraining the trained graph-based machine-learning model comprises:
identifying, by the computing device, the adjustment to the rule by comparing the rule to an adjusted rule received by the computing device;
generating, by the computing device, a tokenized adjustment based on the adjustment to the rule; and
retraining, by the computing device and using the tokenized adjustment, the trained graph-based machine-learning model.
8 . A non-transitory machine-readable storage medium comprising a computer-program product that includes instructions configured to cause a data processing apparatus to perform operations comprising:
receiving, by a computing device, natural language input representing a request by an entity to create a rule characterized by a rule type, the rule type including one or more conditions and one or more actions based on the one or more conditions;
tokenizing, by the computing device, the natural language input to generate a set of tokens that represents the natural language input;
mapping, by the computing device and using a trained graph-based machine-learning model, a first subset of the tokens to a first condition of the one or more conditions and a second subset of the tokens to a second condition of the one or more conditions;
generating, by the computing device, a graph representation of the natural language input, the graph representation including one or more nodes corresponding to the first subset of the tokens and one or more attributes, each attribute of the one or more attributes including a different token of the second subset of the tokens;
training, by the computing device, the graph-based machine-learning model using at least (a) a set of custom schema corresponding to tenant-specific data, wherein each custom schema included in the set of custom schema is different and associated with a different tenant, and (b) tenant-ambiguous data;
generating a tenant-specific graph of a set of tenant-specific graphs that uses at least part of the set of custom schema and at least part of the tenant-ambiguous data;
determining, by the computing device, the tenant-specific graph of the set of tenant-specific graphs corresponds to the graph representation of the natural language input, wherein the set of tenant-specific graphs is generated by the trained graph-based machine-learning model;
generating, by the computing device, the rule by adjusting a template of the rule type using nodes of the tenant-specific graph and attributes of the tenant-specific graph;
causing display, by the computing device, of information indicating at least the first condition and the second condition of the rule; and
wherein the rule as generated, when evaluated by one or more computing devices and the first condition and the second condition are determined to be satisfied, causes the one or more computing devices to execute an action defined by the rule.
9 . The non-transitory machine-readable storage medium of claim 8 , wherein the trained graph-based machine-learning model includes a graph neural network-BERT (GNN-BERT) model, a graph convolutional network (GCN), a gated-graph convolutional network (G-GCN), or a graph isomorphism network (GIN).
10 . The non-transitory machine-readable storage medium of claim 8 , wherein each tenant-specific graph of the set of tenant-specific graphs corresponds to a different custom schema of the set of custom schema, and wherein the tenant-specific graph is included in the set of tenant-specific graphs.
11 . The non-transitory machine-readable storage medium of claim 8 , wherein:
receiving the natural language input comprises receiving the natural language input via a user interface provided by a user interface layer that is communicatively coupled to an application programming interface layer;
generating the rule comprises generating the rule using a machine-learning layer that is communicatively coupled to the application programming interface layer;
the application programming interface layer is configured to transmit the natural language input from the user interface layer to the machine-learning layer and to transmit the rule from the machine-learning layer to the user interface layer;
training the graph-based machine-learning model comprises training the graph-based machine-learning model using a pre-training layer that is communicatively coupled to the machine-learning layer; and
the pre-training layer is configured to provide the machine-learning layer with access to each graph of the set of tenant-specific graphs.
12 . The non-transitory machine-readable storage medium of claim 8 , wherein providing the rule to the entity comprises providing, via a user interface, the rule in an entity-readable format with one or more adjustable fields that facilitate manual editing of the rule.
13 . The non-transitory machine-readable storage medium of claim 12 , wherein the operations further comprise:
receiving, via the user interface, input indicating an adjustment to the rule; and
retraining the trained graph-based machine-learning model using the adjustment to the rule.
14 . The non-transitory machine-readable storage medium of claim 13 , wherein the operation of retraining the trained graph-based machine-learning model comprises:
identifying the adjustment to the rule by comparing the rule to a received, adjusted rule;
generating a tokenized adjustment based on the adjustment to the rule; and
retraining, using the tokenized adjustment, the trained graph-based machine-learning model.
15 . A system, comprising:
one or more data processors; and
a non-transitory computer-readable storage medium containing instructions which, when executed on the one or more data processors, cause the one or more data processors to perform operations comprising:
receiving, by a computing device, natural language input representing a request by an entity to create a rule characterized by a rule type, the rule type including one or more conditions and one or more actions based on the one or more conditions;
tokenizing, by the computing device, the natural language input to generate a set of tokens that represents the natural language input;
mapping, by the computing device and using a trained graph-based machine-learning model, a first subset of the tokens to a first condition of the one or more conditions and a second subset of the tokens to a second condition of the one or more conditions;
generating, by the computing device, a graph representation of the natural language input, the graph representation including one or more nodes corresponding to the first subset of the tokens and one or more attributes, each attribute of the one or more attributes including a different token of the second subset of the tokens;
training, by the computing device, the graph-based machine-learning model using at least (a) a set of custom schema corresponding to tenant-specific data, wherein each custom schema included in the set of custom schema is different and associated with a different tenant, and (b) tenant-ambiguous data;
generating a tenant-specific graph of a set of tenant-specific graphs that uses at least part of the set of custom schema and at least part of the tenant-ambiguous data;
determining, by the computing device, the tenant-specific graph of the set of tenant-specific graphs corresponds to the graph representation of the natural language input, wherein the set of tenant-specific graphs is generated by the trained graph-based machine-learning model;
generating, by the computing device, the rule by adjusting a template of the rule type using nodes of the tenant-specific graph and attributes of the tenant-specific graph;
causing display, by the computing device, of information indicating at least the first condition and the second condition of the rule; and
wherein the rule as generated, when evaluated by one or more computing devices and the first condition and the second condition are determined to be satisfied, causes the one or more computing devices to execute an action defined by the rule.
16 . The system of claim 15 , wherein the trained graph-based machine-learning model includes a graph neural network-BERT (GNN-BERT) model, a graph convolutional network (GCN), a gated-graph convolutional network (G-GCN), or a graph isomorphism network (GIN).
17 . The system of claim 15 , wherein:
each tenant-specific graph of the set of tenant-specific graphs corresponds to a different custom schema of the set of custom schema;
the tenant-specific graph is included in the set of tenant-specific graphs;
receiving the natural language input comprises receiving the natural language input via a user interface provided by a user interface layer that is communicatively coupled to an application programming interface layer;
generating the rule comprises generating the rule using a machine-learning layer that is communicatively coupled to the application programming interface layer;
the application programming interface layer is configured to transmit the natural language input from the user interface layer to the machine-learning layer and to transmit the rule from the machine-learning layer to the user interface layer;
training the graph-based machine-learning model comprises training the graph-based machine-learning model using a pre-training layer that is communicatively coupled to the machine-learning layer; and
the pre-training layer is configured to provide the machine-learning layer with access to each graph of the set of tenant-specific graphs.
18 . The system of claim 15 , wherein providing the rule to the entity comprises providing, and via a user interface, the rule in an entity-readable format with one or more adjustable fields that, when adjusted, cause the rule to be edited.
19 . The system of claim 18 , wherein the operations further comprise:
receiving, via the user interface, input indicating an adjustment to the rule; and
retraining the trained graph-based machine-learning model using the adjustment to the rule.
20 . The system of claim 19 , wherein the operation of retraining the trained graph-based machine-learning model comprises:
identifying the adjustment to the rule by comparing the rule to a received, adjusted rule;
generating a tokenized adjustment based on the adjustment to the rule; and
retraining, using the tokenized adjustment, the trained graph-based machine-learning model.
21 . The computer-implemented method of claim 1 , wherein the first subset of the tokens includes a first token that specifies the first condition and one or more other tokens and the second subset of the tokens includes a second token that specifies the second condition and the one or more other tokens.
22 . The non-transitory machine-readable storage medium of claim 8 , wherein the first subset of the tokens includes a first token that specifies the first condition and one or more other tokens and the second subset of the tokens includes a second token that specifies the second condition and the one or more other tokens.
23 . The system of claim 15 , wherein the first subset of the tokens includes a first token that specifies the first condition and one or more other tokens and the second subset of the tokens includes a second token that specifies the second condition and the one or more other tokens.