A method for identifying entities and intentions in the financial field based on prior knowledge

CN114036953BActive Publication Date: 2024-10-29SSE INFORMATION NETWORK LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111428058.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-29
Publication Date
2024-10-29
Estimated Expiration
2041-11-29

AI Technical Summary

Technical Problem

[0003]本发明的目的在于解决金融领域复杂上下文环境下查询语句的实体识别问题,提供了一种基于先验知识的金融领域实体及意图识别方法,具体如下:

Benefits of technology

[0028] 1. It can learn adaptively and can identify intended entities, associated entities and most entity attribute values.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114036953B_ABST
    Figure CN114036953B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical fields of human-computer dialogue and intelligent semantic search, and in particular to a method for identifying entities and intentions in the financial field based on prior knowledge, which is specifically as follows: context model definition, defining the relevant information of the entire relational database table as context, including the names, comments, types of table and column names, and the definition of a data dictionary; context model analysis, analyzing the database with a data dictionary, attribute values ​​of related fields, and data types, defining the attribute values ​​of the fields as open types or limited enumerable types; adaptive learning, capable of identifying intent entities, associated entities, and most entity attribute values; identifying entities can be limited to specific tables, firstly, avoiding similarity matching in the global space, and omitting the steps of synonym filtering and scoring; secondly, the identified words can be limited to the context, and the unidentified words can be filtered out as irrelevant words to avoid affecting the accuracy of recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of human-computer dialogue and intelligent semantic search technology, and specifically to a method for identifying entities and intentions in the financial field based on prior knowledge. Background Art

[0002] At present, there are two main ways to identify entities in this type of query: one is to solve it through the form of a dictionary and the configuration of synonyms based on the dictionary, and the other is to identify general entities such as names of people, names of institutions, and time based on deep learning methods. The first method can directly and quickly solve the problem of identifying some entities, but the generalization ability is insufficient. Although it can be alleviated by adding synonyms, there are many synonym configurations, which are cumbersome to operate and cannot support semantic understanding. For example, "Shanghai Pudong Development Bank's transaction volume in May 2020" and "Shanghai Pudong Development Bank's transaction volume on May 6, 2020" are transaction volumes under two different entity tables in the financial industry. The former belongs to the monthly transaction volume, and the latter belongs to the daily transaction volume. It cannot be solved by simple word configuration. The second method is to use some learning models to identify general entities such as names of people, names of institutions, and time. However, entities in the financial field often exist as column names or attribute values ​​of data table fields, and the expression of words in the financial field is also diverse. It needs to be analyzed in detail in the context. The recognition method of general entities is obviously not enough. Summary of the invention

[0003] The purpose of the present invention is to solve the problem of entity recognition of query statements in a complex context environment in the financial field, and provide a method for identifying entities and intentions in the financial field based on prior knowledge, which is as follows:

[0004] Step 1: Context model definition, defining the relevant information of the entire relational database table as context, including the name, comment, type of the table and column name, and the definition of the data dictionary;

[0005] Step 2: Context model analysis: Analyze the attribute values ​​and data types of the relevant fields according to the database data dictionary, and define the attribute values ​​of the fields as open types or restricted enumerable types;

[0006] Step 3: Encode the context model, encode the table name and column name, construct a unique identifier for the database table name and column name, and establish a mapping relationship. Concatenate the identifier with the meaning of the table name and column name to form a context as the prior knowledge of the query statement;

[0007] Step 4: Construct the input, concatenate the query question and the context encoded in step 3 as the input of the BERT model;

[0008] Step 5: Build a training model. Use the output of the BERT model to build two fully connected classifiers and a CRF. The association classifier and intent classifier are used to identify whether the question has an association relationship or an intent relationship with the context. CRF is used to identify entities.

[0009] Step 6: Model training: Based on the input samples and corresponding output sets constructed in step 4 and the model constructed in step 5, perform BERT fine-tuning training in the GPU environment;

[0010] Step 7: Inference model conversion, converting 32-bit float to 16-bit float;

[0011] Step 8: In the reasoning phase, the query questions are combined with the candidate table context models one by one, and input into the model using the method of step 4. The output results are restored according to the mapping relationship of step 3, and the entity name corresponding to the context is obtained.

[0012] Furthermore, step three is as follows:

[0013] A. Determine the global maximum length of the input, max_seq_length, which includes the query, context, and auxiliary characters;

[0014] B. For relational data table name and column name annotation information, a single column name field annotation value or its corresponding synonym is used as a column name unit (hereinafter referred to as column name unit). All column name units in the table are randomly shuffled and combined to generate N combinations. The table name field annotation value or its corresponding synonym (hereinafter referred to as table name unit) is respectively concatenated with the N combinations to generate N contexts, which together with the original context generate a total of N+1 contexts.

[0015] C. Input segmentation: concatenate the query sentence and N+1 contexts to form N+1 inputs. Each input is segmented by column name unit to ensure that the length of (query sentence + 3 + table name unit + mcols*column name unit) after segmentation does not exceed max_seq_length, where mcols is the number of fields accommodated this time. After segmentation, the sub-inputs are added to a new set for use in subsequent steps.

[0016] Furthermore, step five is as follows:

[0017] A. Perform full connection operation on the bert output word encoding, M is the maximum number of entity tags in the context, hidden_size is the hidden layer dimension of bert, output_w is a [2+M, hidden_size]-dimensional vector, output_b is a [2+M]-dimensional vector, and after full connection, it becomes a [batch_size, seq_length, 2+M]-dimensional vector. The fully connected vector is split, one of which [batch_size, seq_length, 1] is denoted as R, [batch_size, seq_length, 1] is denoted as I, and the other [batch_size, seq_length, M] is denoted as C_V, which are used for the identification of association classification vector, intent classification vector, and entity recognition vector respectively;

[0018] B. Relevance classifier: used to distinguish whether the query question is related to the context, that is, the condition of the question;

[0019] C. Intent classifier: used to distinguish whether the query question is intentionally associated with the context, that is, the true intent of the question;

[0020] D. Entity recognizer: used to identify entities in the context and match the content in the query with the label information in the context.

[0021] Furthermore, step eight is as follows:

[0022] A. Take the entity recognition result record whose intent classifier or association classifier is 1;

[0023] B. Restore the fields to the corresponding field names according to the mapping relationship;

[0024] C. Sort entities according to their positions, and remove duplicates and merge multiple entity recognition result records;

[0025] D. Loop through the result set and sort it in ascending order according to the position interval;

[0026] E. Loop through the sorted results and perform two-way merges on adjacent records for a total of n-1 times, where n is the length of the result set. When the results have an intersection, the interval union is taken, otherwise if there is no intersection, the records are merged and joined.

[0027] Compared with the prior art, the present invention has the following advantages:

[0028] 1. It can learn adaptively and recognize intended entities, related entities, and most entity attribute values.

[0029] 2. The recognized entities can be limited to a specific table. First, it avoids matching similarities in the global space and saves the steps of synonym filtering and scoring. Second, the recognized words can be limited to the context, and the unrecognized words can be filtered out as irrelevant words to avoid affecting the recognition accuracy.

[0030] 3.Support association identification. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 is a flow chart of the method used for prediction. DETAILED DESCRIPTION

[0032] The present invention is further described below in conjunction with the accompanying drawings, and the structure and principle of the present invention are very clear to people in the field. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0033] The present invention is a method for identifying entities and intentions in the financial field based on prior knowledge, and the specific steps are as follows:

[0034] 1. Context model definition. Taking a relational database table as an example, the meaning of the table name is defined as an entity, the column name of the table is defined as an entity attribute, and the value of the table column name is defined as the entity attribute value. We define the relevant information of the entire relational database table as the context, including the name, comment, type of the table and column name, and the definition of the data dictionary.

[0035] 2. Context model analysis. Analyze the attribute values ​​of the relevant fields and data types according to the database data dictionary, and define the attribute values ​​of the fields as open types or restricted enumerable types. For example, NUMBER type, name type, organization name type, time type, character type, etc., numbers, characters, etc. are open types, while names and organization names are restricted enumerable types.

[0036] 3. Encode the context model. Encode the table name and column name, build a unique identifier for the database table name and column name, and establish a mapping relationship. Concatenate the identifier with the meaning of the table name and column name to form a context as the prior knowledge of the query statement. Since the pre-trained model (such as BERT) has a length limit, the extra-long part can also be truncated and re-concatenated into multiple semantic contexts. When concatenating, the meaning of the table name is connected to multiple column names respectively. The concatenation and truncation algorithm is as follows:

[0037] A. Determine the global maximum length of the input, max_seq_length, which includes the query, context, and auxiliary characters;

[0038] B. For relational data table names and column name annotation information, the column name field annotation value or its corresponding synonym is used as the column name unit (hereinafter referred to as the column name unit), all column name units in the table are randomly shuffled to generate N combinations, and the table name field annotation value or its corresponding synonym (hereinafter referred to as the table name unit) is spliced ​​with the N combinations to generate N contexts, which together with the original contexts generate a total of N+1 contexts. For example, the original table name and column name information are as follows: company_basic^Basic information of listed companies|stock_abbr^Securities abbreviation|col2^xxx|col3^xxxx|…, according to the fixed table name, the column name field is regenerated into N combinations according to the random order, one of which is: company_basic^Basic information of listed companies|col2^xxx|stock_abbr^Securities abbreviation|col3^xxxx|…

[0039] C. Input cutting: concatenate the query sentence and N+1 contexts into strings to form N+1 inputs. Cut each input into column name units to ensure that the length of (query sentence + 3 + table name unit + mcols*column name unit) after cutting does not exceed max_seq_length, where mcols is the number of fields accommodated this time. After cutting, the sub-inputs are added to the new set for use in subsequent steps.

[0040] 4. Construct input. Concatenate the query question and the context encoded in step 3 as the input of the BERT model. The encoding is constructed as follows: [cls]question[sep]context[sep], where question is the input question and context is the encoding in step 3.

[0041] 5. Build the output (position output). Entity tags use RBi, RIi, IBi, IIi, VBi, VIi, O, [SEP], [CLS], [X], [PAD] tags. i corresponds to the context unique identifier. RBi, RIi represent the beginning and connection parts of the ith associated entity, IBi, IIi represent the beginning and connection parts of the ith intent entity, and VBi, VIi represent the beginning and connection parts of the ith associated entity attribute value. For example, when will Shanghai Pudong Development Bank go public? It can be represented by VB1 VI1 VI1 VI1 IB2 II2II2 II2 II2 II2 O

[0042] 6. Build a training model, and use the output of step 5 to build two fully connected classifiers and a CRF (Conditional Random Fields). The association classifier and intent classifier are used to identify whether the question and context are in an association relationship or an intent relationship, and CRF is used to identify entities. The loss function uses the average of the three. Convert the word encoding of the BERT model, and output the association classification vector, intent classification vector, and entity recognition vector.

[0043] The specific steps are as follows:

[0044] A. Perform full connection operation on BERT output word encoding, M is the maximum number of entity tags in the context, hidden_size is the hidden layer dimension of BERT, output_w is a [2+M, hidden_size]-dimensional vector, output_b is a [2+M]-dimensional vector, and after full connection, it becomes a [batch_size, seq_length, 2+M]-dimensional vector. The fully connected vector is split, one [batch_size, seq_length, 1] (denoted as R), the other [batch_size, seq_length, 1] (denoted as I), and [batch_size, seq_length, M] (denoted as C_V) are used for the association classification vector, intent classification vector, and entity recognition vector respectively.

[0045] B. Association classifier: used to distinguish whether the query question is related to the context, that is, the condition of the question. For example, the total market value of the company where Zhang San works, then "the company where Zhang San works" is the related content, and the context is the information of the executive information table (Senior_P), then the association classification of Senior_P is 1. Make a full connection on the association classification vector again to identify whether the question is related to the context. r_weight is a [label_category_num, seq_length] vector, and r_bias is a [label_category_num] vector, where label_category_num is the number of labels of the association classifier, and seq_length is the maximum length of the input. The loss function is calculated based on softmax cross_entropy and is calculated as Lossb.

[0046] C. Intent classifier: used to distinguish whether the query question is intentionally associated with the context, that is, the true intent of the question. For example, the total market value of the company where Zhang San works, then "total market value" is the intent content, and the context is the information in the market information table (quatation_info), then the intent classification of quatation_info is 1. i_weight is [label_category_num, seq_length] vector, i_bias = [label_category_num] vector. The loss function is calculated based on softmax cross_entropy and is calculated as Lossc.

[0047] D. Entity Recognizer: It is used to identify entities in the context and match the content in the query with the label information in the context. For example, [cls] The total market value of the company where Zhang San works [sep] C0: Market table | C1: Trading day | C2: Total market value | ... [SEP].

[0048] The recognition result is [cls]OOOOOOOO IB2 II2 II2 II2[sep]C0: market table|C1: trading day|C2: market value|…[SEP], which means the intent field is the second field of the table. Then, according to the unique identifier mapping, we can find the MKT_VALUE: market value field. trans is a [M,M] vector used as the transition probability in crf, C_V is used as the initial probability, and the loss function is calculated as Lossd:

[0049]

[0050] Loss function: Loss_total = (Lossb + Losssc + Lossd) / 3

[0051] 7. Model training. Based on the input samples and corresponding output sets constructed in step 4 and the model constructed in step 5, perform BERT fine-tuning training in a GPU environment.

[0052] 8. Inference model conversion: Use FastTransformer to convert 32-bit float to 16-bit float or TensorRT to improve inference speed.

[0053] 9. In the reasoning phase, the questions are combined with the candidate table context models one by one, and input into the model using the method in step 4. The output results are restored according to the mapping relationship in step 3, and the entity names corresponding to the context are obtained.

[0054] The specific algorithm is as follows:

[0055] 1. Take the entity recognition result record whose intent classifier or association classifier is 1.

[0056] 2. Restore the fields to the corresponding field names based on the mapping relationship.

[0057] 3. Sort entities according to their positions, and deduplicate and merge multiple entity recognition result records.

[0058] 3.1. Loop through the result set and sort it in ascending order according to the position interval.

[0059] 3.2. Loop through the sorted results and perform two-way merge on adjacent records for a total of n-1 times (n is the length of the result set). When the results have an intersection, take the interval union, otherwise if there is no intersection, merge and join.

[0060] The algorithm for determining crossover is as follows:

[0061]

[0062]

[0063] In a preferred embodiment, the method flow is as follows Figure 1 shown.

[0064] s1: Questions input by users, such as "When will Pudong Development Bank go public?", used to express the user's most direct questions.

[0065] S2: Context model definition and analysis. This example uses the annotations of relational database tables and column names as context, but it is not limited to relational database tables. Common key-value pairs such as json, mongodb, and graph database structures are also applicable to this method, as are text content with unique identifiers. The analysis mainly analyzes which content is potential entity attributes and which content is entity attribute values. Entity attributes are table annotations and column name annotations. For example, the structure of the basic information table of listed companies is as follows:

[0066] "company_basic^Basic information of listed companies|stock_abbr^Stock abbreviation|col2^xxx|col3^xxxx|…"

[0067] The basic information of the listed company is the entity name, the securities abbreviation is the entity attribute, and Shanghai Pudong Development Bank is the value of the entity attribute "Securities abbreviation".

[0068] S3: Encode the context model. Encode and concatenate all contexts according to the pre-defined maximum length. For example:

[0069] In addition to the basic information of listed companies, the context database also contains information such as margin trading and short selling transaction information. Due to space limitations, only the margin trading and short selling transaction information structure is listed:

[0070] margin_info^Margin trading information|stock_code^Securities code|stock_abbr^Securities abbreviation|margin_amount^Margin balance|...

[0071] For example, "When will Shanghai Pudong Development Bank go public?", and the basic information table of listed companies contains C1-Cp fields, then it can be coded as shown in Table 1:

[0072] Serial number question Context Encoding 1 When will Pudong Development Bank go public? [C0] Basic information of listed companies | [C1] Securities abbreviation | [C2] Listing time | ... [Cn] xxx 2 When will Pudong Development Bank go public? [C0] Basic information of listed companies | [Cn+1] xxx | [Cn+2] xxx | … [Cn+n] xxx 3 When will Pudong Development Bank go public? … 4 When will Pudong Development Bank go public? [C0] Basic information of listed companies | [Cm+1] xxx | [Cm+1] xxx |… [Cp] xxx 5 When will Pudong Development Bank go public? [C0] Margin trading information | [C1] Securities code | [C2] Securities abbreviation | [C3] Margin balance… [Cn] xxx

[0073] Table 1

[0074] Randomly combine the contexts and concatenate them.

[0075] Training phase: construct sample output, corresponding to the following Table 2:

[0076] Serial number question Output (whether it is associated, whether it is intended, entity sequence) 1 When will Pudong Development Bank go public? 1, 1, VB1 VI1 VI1 VI1 IB2 II2 II2 II2 II2 II2 O 2 When will Pudong Development Bank go public? 0,0,OOOOOOOOOOOO 3 When will Pudong Development Bank go public? … 4 When will Pudong Development Bank go public? 0,0,OOOOOOOOOOOO 5 When will Pudong Development Bank go public? 1, 0, VB2 VI2 VI2 VI2 OOOOOOO

[0077] Table 2

[0078] S4: Combine the question and context. Taking the BERT pre-trained model as an example, the encoding construction method is: [cls]question[sep]context[sep]BERT encoding. Alternative training models include distillation models such as Albert and Distilling Bert, as well as other similar pre-training models such as GPT.

[0079] S5: Build a training model to model whether it is an associated entity, whether it is an intended entity, and context entity sequence.

[0080] Training phase: Based on the encoding information of S4 and the context information of S3, the entire model is constructed, and the loss functions of whether the entity is associated, whether the entity is intended, and the context entity sequence are calculated respectively, and the average value is taken as the overall loss function.

[0081] Inference stage: The trained model can be converted to half-floating point precision using FastTransformer or TensorRT to improve the inference speed.

[0082] S6. Merge and filter the obtained results and output them, such as:

[0083] According to the results in Table 2, we can get the results of sequence numbers 1 and 5 in the table. Further analysis shows that "Shanghai Pudong Development Bank" belongs to the entity attribute value of stock_abbr of company_basic or the entity attribute value of stock_abbr of margin_info, and "when to go public" belongs to the listing time entity attribute of company_basic.

[0084] S7: Output the result in JSON format.

Claims

1. A method for identifying entities and intentions in the financial field based on prior knowledge, characterized in that: The specific method is as follows: Step 1: Context model definition, defining the relevant information of the entire relational database table as context, including the name, comment, type of the table and column name, and the definition of the data dictionary; Step 2: Context model analysis: Analyze the attribute values ​​and data types of the relevant fields according to the database data dictionary, and define the attribute values ​​of the fields as open types or restricted enumerable types; Step 3: Encode the context model, encode the table name and column name, construct a unique identifier for the database table name and column name, and establish a mapping relationship. Concatenate the identifier with the meaning of the table name and column name to form a context as the prior knowledge of the query statement; Step 4: Construct the input, concatenate the query question and the context encoded in step 3 as the input of the BERT model; Step 5: Build a training model. Use the output of the BERT model to build two fully connected classifiers and a CRF. The association classifier and intent classifier are used to identify whether the query question has an association relationship or an intent relationship with the context. CRF is used to identify entities. Step 6: Model training: Based on the input samples and corresponding output sets constructed in step 4 and the model constructed in step 5, perform BERT fine-tuning training in the GPU environment; Step 7: Inference model conversion, converting 32-bit float to 16-bit float; Step 8: In the reasoning phase, the query questions are combined with the candidate table context models one by one, and the query questions are input into the model using the method of step 4. The output results are restored according to the mapping relationship of step 3, and the entity names corresponding to the contexts are obtained. The step three is as follows: a. Determine the global maximum length of the input, max_seq_length, which includes the query, context, and auxiliary characters; b. For relational data table names and column name annotation information, use the column name field annotation value or its corresponding synonym as the column name unit, randomly shuffle all the column name units in the table to generate N combinations, use the table name field annotation value or its corresponding synonym as the table name unit, and concatenate the table name unit with the N combinations to generate N contexts, which together with the original context generate a total of N+1 contexts; c. Input cutting: concatenate the query sentence and N+1 contexts into strings to form N+1 inputs. Cut each input into column name units to ensure that the length after cutting does not exceed max_seq_length, where mcols is the number of fields accommodated this time. After cutting, the sub-inputs are added to a new set for use in subsequent steps. The step five is as follows: A. Perform full connection operation on the BERT output word encoding, M is the maximum number of entity tags in the context, hidden_size is the hidden layer dimension of BERT, output_w is a [2+M, hidden_size]-dimensional vector, output_b is a [2+M]-dimensional vector, and after full connection, it becomes a [batch_size, seq_length, 2+M]-dimensional vector. The fully connected vector is split, one [batch_size, seq_length, 1] is denoted as R, the other [batch_size, seq_length, 1] is denoted as I, and [batch_size, seq_length, M] is denoted as C_V, which are used for the identification of association classification vector, intent classification vector, and entity recognition vector respectively; B. Relevance classifier: used to distinguish whether the query question is related to the context, that is, the condition of the question; C. Intent classifier: used to distinguish whether the query question is intentionally associated with the context, that is, the true intent of the question; D. Entity recognizer: used to identify entities in the context and match the content in the query with the label information in the context.

2. A method for identifying entities and intentions in the financial field based on prior knowledge as claimed in claim 1, characterized in that The step eight is specifically as follows: I. Take the entity recognition result record whose intent classifier or association classifier is 1; II. Restore the fields to the corresponding field names according to the mapping relationship; III. Sort entities according to their positions, and remove duplicates and merge multiple entity recognition result records; IV. Loop through the result set and sort it in ascending order according to the position interval; V. Loop through the sorted results and perform two-way merge on adjacent records for a total of n-1 times, where n is the length of the result set. When the results have an intersection, take the interval union, otherwise if there is no intersection, merge and join.

Citation Information

Patent Citations

  • Semantic recognition method and device, electronic equipment and computer readable storage medium

    CN111125331A

  • Intention recognition model training method and device and electronic equipment

    CN111143561A