Problem solving method and apparatus

By combining the encoder and decoder of the question-solving model with BERT and LSTM models, the answer to the missing position in the question is automatically parsed, which solves the problem of low solution efficiency and accuracy in the existing technology and achieves efficient and accurate solution of multiple sub-questions.

CN115705356BActive Publication Date: 2026-04-14BEIJING YUANLI WEILAI SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING YUANLI WEILAI SCI & TECH CO LTD
Filing Date
2021-08-06
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

In existing technologies, problem-solving methods require the pre-creation of large-scale formula templates based on a large amount of problem data, which is cumbersome, time-consuming, and costly to maintain, and has low efficiency and accuracy.

Method used

A question-solving model is adopted, which obtains the semantic vector of the question to be solved through an encoder and decodes it using a decoder. It automatically parses the answers in the missing positions of the question and applies pre-trained BERT and LSTM models to understand the contextual semantics of the question, so as to achieve efficient and accurate problem solving.

Benefits of technology

It achieves high-precision and efficient automatic problem solving, and can determine the answers to multiple sub-problems at once, thus improving the efficiency and accuracy of problem solving.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115705356B_ABST
    Figure CN115705356B_ABST
Patent Text Reader

Abstract

The present specification provides a question answering method and device, wherein the question answering method comprises: obtaining a question to be answered, the question to be answered comprising at least two blank positions; inputting the question to be answered into an encoder of a question answering model to obtain a semantic vector corresponding to the question to be answered; and decoding the semantic vector through a decoder of the question answering model to obtain answers corresponding to the at least two blank positions of the question to be answered. In this way, the question answering model better understands the context semantics of the question, and obtains the answers of all sub-questions in the question at one time, thereby realizing high-precision automatic problem solving and greatly improving the problem solving efficiency and correctness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This manual relates to the field of artificial intelligence technology, and in particular to problem-solving methods and apparatus. Background Technology

[0002] With the continuous development of computer and artificial intelligence technologies, more and more work and study tasks can be automated. Computer technology has been gradually applied to various daily education and learning activities. For example, computer technology can be used to automatically analyze the answers to questions, thereby greatly saving human resources.

[0003] In existing technologies, formula templates of different knowledge points and types are often established in advance based on a large number of questions and abstract rules. When a question needs to be answered, the question can be automatically matched to the formula template with the highest probability, and then the corresponding answer can be determined using the formula template.

[0004] However, the above-mentioned problem-solving methods require the creation of large-scale formula templates in advance based on a large amount of problem data to ensure that the problems to be solved can be matched with the corresponding formula templates. This process is cumbersome, time-consuming, inefficient, and has extremely high maintenance costs. It also requires regular optimization of the stored formula templates, which greatly affects the efficiency and accuracy of problem-solving. Summary of the Invention

[0005] In view of this, embodiments of this specification provide a problem-solving method. This specification also relates to a problem-solving apparatus, a computing device, and a computer-readable storage medium to address the problems of low efficiency and accuracy in problem-solving in the prior art.

[0006] According to a first aspect of the embodiments of this specification, a problem-solving method is provided, including:

[0007] Retrieve the unanswered questions, which include at least two empty slots;

[0008] The question to be answered is input into the encoder of the question-answering model to obtain the semantic vector corresponding to the question to be answered;

[0009] The semantic vector is decoded by the decoder of the question-answering model to obtain the answers corresponding to at least two missing positions of the question to be answered.

[0010] According to a second aspect of the embodiments of this specification, another problem-solving method is provided, including:

[0011] The encoded information of the question to be answered is input into the encoder of the question answering model to obtain the semantic vector corresponding to the encoded information. The question to be answered includes at least one missing position.

[0012] The semantic vector is decoded using the decoder of the question-answering model to obtain the i-th answer character of the question to be answered;

[0013] The i-th answer character is concatenated after the encoded information to obtain the updated encoded information. i is incremented by 1, and the operation steps of inputting the encoded information into the encoder of the question-solving model are returned until the last answer character of the question to be solved is obtained, thus obtaining the answer corresponding to at least one missing position of the question to be solved.

[0014] According to a third aspect of the embodiments of this specification, a problem-solving apparatus is provided, comprising:

[0015] The first acquisition module is configured to acquire questions to be answered, which include at least two empty positions.

[0016] The first acquisition module is configured to input the question to be answered into the encoder of the question answering model to obtain the semantic vector corresponding to the question to be answered;

[0017] The second obtaining module is configured to decode the semantic vector through the decoder of the question-answering model to obtain the answers corresponding to at least two missing positions of the question to be answered.

[0018] According to a fourth aspect of the embodiments of this specification, another problem-solving apparatus is provided, comprising:

[0019] The third acquisition module is configured to input the encoded information of the question to be answered into the encoder of the question answering model to obtain the semantic vector corresponding to the encoded information. The question to be answered includes at least one missing position.

[0020] The fourth module is configured to decode the semantic vector using the decoder of the question-answering model to obtain the i-th answer character of the question to be answered.

[0021] The execution module is configured to concatenate the i-th answer character after the encoded information to obtain the updated encoded information, increment i by 1, and return to execute the operation steps of the encoder that inputs the encoded information into the question-solving model until the last answer character of the question to be solved is obtained, thus obtaining the answer corresponding to at least one missing position of the question to be solved.

[0022] According to a fifth aspect of the embodiments of this specification, a computing device is provided, comprising:

[0023] Memory and processor;

[0024] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the operational steps of any of the above problem-solving methods.

[0025] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the operational steps of the problem-solving method described above.

[0026] The problem-solving method provided in this manual can obtain the question to be solved, then input the question into the encoder of a problem-solving model to obtain the semantic vector corresponding to the question, and then decode the semantic vector through the decoder of the problem-solving model to obtain the answers corresponding to at least two missing positions of the question. In this case, the question to be solved can be input into the problem-solving model, which can output the answers corresponding to at least two missing positions of the question. By utilizing the problem-solving model to better understand the contextual semantics of the question, the answers to all sub-questions in the question can be obtained at once. In this way, based on a pre-trained problem-solving model, the correct answers to each question can be automatically, efficiently, and accurately analyzed. By applying deep learning methods to the problem-solving process, high-precision automatic problem-solving is achieved, which greatly improves the efficiency and accuracy of problem solving. Attached Figure Description

[0027] Figure 1 This is a flowchart of a problem-solving method provided in one embodiment of this specification;

[0028] Figure 2 This is a model architecture diagram of a problem-solving model provided in the embodiments of this specification;

[0029] Figure 3 This is a schematic diagram illustrating an automatic problem-solving process provided in one embodiment of this specification;

[0030] Figure 4 This is a flowchart of another problem-solving method provided in one embodiment of this specification;

[0031] Figure 5 This is a model architecture diagram of another problem-solving model provided in the embodiments of this specification;

[0032] Figure 6 This is a schematic diagram of the structure of a problem-solving device provided in one embodiment of this specification;

[0033] Figure 7 This is a schematic diagram of another problem-solving device provided in one embodiment of this specification;

[0034] Figure 8 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation

[0035] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0036] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “the,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0037] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0038] First, the terms and concepts used in one or more embodiments of this specification will be explained.

[0039] The Transformer model is essentially an Encoder-Decoder structure. The encoder consists of 6 encoding blocks (each block of the encoder consists of self-attention and FFNN), and the decoder consists of 6 decoding blocks (each block of the decoder consists of self-attention, encoder-decoder attention, and FFNN). As with all generative models, the output of the encoder is used as the input of the decoder.

[0040] BERT model: A bidirectional attention neural network model. The BERT model can predict the current word and the next sentence based on the context from both the left and right sides. The goal of the BERT model is to train on a large-scale unlabeled corpus to obtain a semantic representation of the text containing rich semantic information, then fine-tune this semantic representation for a specific NLP task, and finally apply it to that NLP task.

[0041] Long Short-Term Memory (LSTM) models are a type of temporal recurrent neural network suitable for processing and predicting important events with relatively long intervals and delays in time series. LSTM models can be used to connect previous information to the current task, such as using past statements to infer the understanding of the current statement.

[0042] Token: Before any actual processing is performed on the input text, it needs to be segmented into linguistic units such as words, punctuation marks, numbers, or alphanumeric characters. These units are called tokens. For English text, a token can be a single word, a punctuation mark, a number, etc. For Chinese text, the smallest token can be a single character, a punctuation mark, a number, etc.

[0043] Word embedding refers to embedding a high-dimensional space with the number of all words into a continuous vector space with a much lower dimension, where each word or phrase is mapped to a vector in the real number field.

[0044] Cross-entropy loss function: A function used to measure the difference between two probability distributions.

[0045] Encoding: The process of converting information from one form or format to another. In this specification, it refers to the process of converting text into vectors, i.e., using embedded encoding, which is achieved through the embedding layer of the reading comprehension model.

[0046] Embedding layer: Located in the input layer of the network model, it is used to encode the input text data (i.e., embedded encoding) and output text vectors; and to perform embedded encoding on the input image data and output image features.

[0047] Attention layer: A hierarchical structure in the network model used to perform self-attention or mutual attention processing on text vectors and output a vector matrix; and to perform self-attention or mutual attention processing on image features and output a feature matrix.

[0048] It's important to note that the current problem-solving method determines the correct answer based on formula templates. Therefore, before solving a problem, it's necessary to pre-create formula templates for different knowledge points and types based on a large number of questions and abstracted rules. Subsequently, when a specific question needs to be answered, the question can be automatically matched to the formula template with the highest probability, and then the corresponding answer can be determined based on that template. However, this method requires pre-creating a large number of formula templates based on a vast amount of question data to ensure that every question has a corresponding template. This process is cumbersome, time-consuming, inefficient, and has extremely high maintenance costs, requiring regular optimization of the stored formula templates.

[0049] Additionally, the seq2seq method can be used to construct an encoder that encodes the problem text and a decoder that generates the solution formula. Typically, both the encoder and decoder are RNN structures. However, RNN-based problem encoding methods cannot well understand text in certain specific domains (such as mathematical problems), resulting in a low accuracy rate. Furthermore, RNNs are recursive computation structures, meaning that calculations at time t depend on information at time t-1, preventing parallel computation and leading to low efficiency. Currently, there are various types of problems, some with more complex solutions. A problem text typically contains several sub-problems, and the answers are often more complex, including but not limited to numbers, symbols, Chinese characters, and formulas.

[0050] Therefore, this manual provides a problem-solving method to automatically solve various types of problems. Compared to ordinary automatic problem solving, it can provide answers to all sub-problems in the problem. Furthermore, by applying a pre-trained BERT model and using bidirectional context encoding, it can better understand the problem text and improve prediction accuracy.

[0051] This specification provides a problem-solving method, and also relates to a problem-solving apparatus, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.

[0052] Figure 1 A flowchart of a problem-solving method according to an embodiment of this specification is shown, which specifically includes the following steps:

[0053] Step 102: Obtain the questions to be answered, which include at least two empty positions.

[0054] It should be noted that the unanswered question can be a question awaiting an answer, and it may include at least two sub-questions. The question-solving model can determine the answers to each sub-question in the unanswered question all at once. In practical applications, the unanswered question can directly be the content of a fill-in-the-blank question. Of course, in practical applications, the unanswered question can also be other types of questions, such as multiple-choice questions or calculation problems with multiple parts. The question-solving model can output the answers to all questions at once.

[0055] In addition, unanswered questions can be questions from various fields, such as math problems, language arts problems, and English problems. Furthermore, unanswered questions can be questions waiting to be answered, or questions waiting for a confirmed answer. For example, an unanswered question might be a question that a student doesn't know how to answer and is searching for, in which case the unanswered question is waiting for an answer and there is no answer information entered by the user; or an unanswered question might be a question that a student has submitted an answer to, in which case the unanswered question is waiting for a confirmed answer and there is answer information entered by the user.

[0056] In practical applications, the input to the subsequent question-solving model is the question to be solved. Through this question-solving model, the text and numerical information related to the question in the question stem can be understood, and the answers corresponding to the number of blanks to be filled in the question can be automatically output. Therefore, the question to be solved can be obtained first, and then the obtained question to be solved can be analyzed and processed to obtain the corresponding number of answers.

[0057] For example, the question to be answered is "A watermelon weighs about 8 (), a cabbage weighs about 800 (), the weight of the watermelon is () times that of the cabbage".

[0058] In one optional implementation of this embodiment, since some questions may include numerical values, and semantic analysis processes are often not very sensitive to numerical values, directly performing semantic analysis and processing based on the original numerical values ​​through a question-answering model for numerical questions may greatly reduce the accuracy of the answer. Therefore, the numerical values ​​in the question to be answered can also be mapped to corresponding first preset characters. That is, after obtaining the question to be answered, the following steps are also included:

[0059] Extract the numerical values ​​included in the question to be answered;

[0060] Based on the preset mapping rules, a corresponding first preset character is set for each value, and a value mapping list for the question to be answered is constructed.

[0061] Specifically, the preset mapping rule can refer to a pre-set rule used to indicate which position's value is mapped to which first preset character; in addition, the first preset character refers to a pre-set symbol used to represent values ​​at different positions, such as d1, d2, d3, d4, a, b, c, d, etc.

[0062] In practical applications, based on pre-set mapping rules, it is possible to determine which first preset character each value in the question to be solved should be mapped to, and based on the value and the corresponding first preset character, a value mapping list for the question to be solved can be constructed.

[0063] In one optional implementation of this embodiment, the preset mapping rule can be sequential numbering from left to right. In this case, according to the preset mapping rule, a corresponding first preset character is set for each value, and a value mapping list for the question to be solved is constructed. The specific implementation process can be as follows:

[0064] Arrange the values ​​from left to right according to their order in the questions to be answered;

[0065] Set the corresponding first preset character for each of the numerical values ​​in turn;

[0066] Each value and its corresponding first preset character are stored to construct a value mapping list for the question to be answered.

[0067] It should be noted that the values ​​included in the question to be solved can be numbered sequentially from left to right. Therefore, the values ​​can be arranged sequentially from left to right according to their order in the question to be solved, and then the first preset character can be set for each value in the order of arrangement.

[0068] In practical applications, the first preset character can be a letter. Then, the values ​​at different positions are sequentially numbered. That is, assuming the letter 'd' is used to represent the values ​​at different positions in the problem to be solved, the first preset character 'd1' can be set for the first value in the problem to be solved, the first preset character 'd2' can be set for the second value in the problem to be solved, and so on, until the first preset character 'dn' can be set for the nth value in the problem to be solved, where n represents the total number of values ​​in the problem to be solved. The resulting value mapping list for the problem to be solved is {d1: value 1, d2: value 2, ..., dn: value n}.

[0069] Using the previous example, the extracted values ​​for the questions to be answered are 8 and 800. The first preset character of the value 8 is set as d1, and the first preset character of the value 800 is set as d2. The resulting numerical mapping list for the questions to be answered is {d1: 8, d2: 800}.

[0070] In this manual, the numerical values ​​in the question to be answered can be mapped to the corresponding first preset character. When the question to be answered is subsequently processed by the question-answering model for semantic analysis, the numerical values ​​in the question to be answered have already been mapped to the corresponding symbols. The question-answering model does not need to analyze the semantic relationships between a large number of numbers, which improves the accuracy of the subsequent question-answering model for semantic analysis of the question to be answered, thereby improving the accuracy of subsequent question answers.

[0071] In one optional implementation of this embodiment, the missing positions in the question are generally represented by special symbols such as parentheses, underscores, and spaces. However, the model is more sensitive to characters than symbols. To facilitate a more accurate analysis of the semantic information of the question by the subsequent model, the missing positions can also be replaced with corresponding characters. That is, after obtaining the question to be solved, the following steps are also included:

[0072] Identify at least one missing position in the unsolved question;

[0073] Replace at least one empty position with a second preset character.

[0074] Specifically, the second preset character can be a pre-set character used to identify the missing positions in the question to be solved, so as to inform the question-solving model which position's answer needs to be parsed. For example, the second preset character can be... <blank>.

[0075] It should be noted that a question to be solved typically includes at least one empty position, and each empty position is a sub-question that needs to be parsed to obtain the corresponding answer. In practical applications, in order to analyze and process the various sub-questions of the question to be solved together and output the answers to each sub-question, after obtaining the question to be solved, each empty position in the question to be solved can be replaced with a second preset character. This allows the subsequent question-solving model to accurately determine which positions should be parsed and output the parsed answers.

[0076] Continuing with the previous example, the obtained question is "A watermelon weighs approximately 8(), a cabbage weighs approximately 800(), and the weight of the watermelon is () times that of the cabbage". This question contains 3 blank positions. Replace each blank position with the second preset character. <blank>The question obtained, with a second preset character added, is "A watermelon weighs approximately 8..." <blank>A large Chinese cabbage weighs approximately 800 kilograms. <blank>The weight of a watermelon is the same as that of a cabbage. <blank>times".

[0077] In this manual, the various sub-problems included in the question to be solved can be input together into the problem-solving model for analysis and processing. Therefore, in order to separate and identify the position of each sub-problem, at least one empty position in the question to be solved can be replaced with a second preset character, so that the answers to all sub-problems in the question can be obtained accurately at once, realizing high-precision and high-efficiency automatic problem solving.

[0078] Step 104: Input the question to be answered into the encoder of the question answering model to obtain the semantic vector corresponding to the question to be answered.

[0079] In an optional implementation of this embodiment, a numerical mapping list can be constructed for the numerical values ​​in the question to be answered. Therefore, the numerical values ​​in the question to be answered can be replaced with the corresponding first preset character. Then, the question to be answered is input into the encoder of the question-answering model to obtain the semantic vector corresponding to the question to be answered. That is, the question to be answered is input into the encoder of the question-answering model to obtain the semantic vector corresponding to the question to be answered. The specific implementation process can also be as follows:

[0080] Replace the numerical values ​​in the question to be answered with the corresponding first preset character;

[0081] The replaced question is input into the encoder of the question-answering model to obtain the semantic vector corresponding to the question.

[0082] In practice, besides replacing at least one missing character in the question to be solved with a second preset character, the numerical value in the question to be solved can also be replaced with a first preset character. The processed question is then input into the subsequent encoder for analysis. Of course, in practical applications, both the replacement of missing characters and the replacement of numerical values ​​can be performed, or only one of these replacement processes can be performed; this specification does not impose any restrictions on this.

[0083] It's important to note that deep learning models can be used to learn the contextual semantic information of the problem to be solved. Among these methods, the BERT model is the best performing. Through extensive use of natural language text paragraphs, it develops strong contextual understanding capabilities, making it suitable for relevant natural language tasks. Therefore, this specification uses the BERT model structure as the architecture for the automatic problem solver. Specifically, the encoder in this specification can be a BERT model. The BERT model is essentially a bidirectional encoder representation based on Transformer, rooted in Transformer and derived from the concept of "attention is all you need." The bidirectional meaning indicates that when processing a word, it considers information from both preceding and following words to obtain the semantic context. In other words, the encoder can be a basic BERT model pre-trained on a large amount of news, community Q&A, and encyclopedia data.

[0084] In practical applications, question-solving models include an encoder and a decoder. The encoder analyzes the contextual semantic relationships of the question to be solved, obtaining a semantic vector. Then, the decoder decodes the semantic vector to obtain the answers for each missing position in the question. In other words, the stem information of the question can be encoded using a pre-trained BERT model.

[0085] In one optional implementation of this embodiment, the encoder includes an embedding layer and a semantic information analysis layer; the question to be answered is input into the encoder of the question-answering model to obtain the semantic vector corresponding to the question to be answered. The specific implementation process can be as follows:

[0086] The question to be answered is broken down into word units, and a start position marker word unit is added before the first word unit and an end position marker word unit is added after the last word unit;

[0087] Each word unit is input into the embedding layer for embedding processing to obtain the encoding matrix corresponding to each word unit;

[0088] The encoding matrix is ​​input into the semantic information analysis layer to obtain the semantic vector corresponding to each word unit.

[0089] Specifically, the embedding layer encodes each word unit to obtain the corresponding encoding matrix. This layer allows for word embedding of the problem to be solved, embedding the high-dimensional problem into a much lower-dimensional continuous vector space. Additionally, the semantic information analysis layer encodes the contextual semantic information of the encoding matrix corresponding to each word unit, resulting in a semantic vector for each word unit.

[0090] It should be noted that the encoder can be a BERT model structure. Since the BERT model can only receive single characters as input, the problem to be solved needs to be broken down into word units. Each word unit can include only one character or multiple characters.

[0091] In practical applications, the embedding layer can be the Embedding layer in the BERT model, and the semantic information analysis layer can be the Transformer Encoder layer in the BERT model. First, the question to be solved can be segmented into multiple word units. Then, a start position marker word unit is added before the first word unit, and an end position marker word unit is added after the last word unit. The start position marker word unit indicates the beginning position of the question to be solved, and the end position marker word unit indicates the end position. Finally, the word units obtained from segmenting the question to be solved, along with the start and end position marker word units, are used as input to the Embedding layer.

[0092] Furthermore, after each word unit is input into the Embedding layer, the Embedding layer encodes the input. The encoding in the Embedding layer is consistent with that in the BERT model. The Embedding layer consists of word embedding, position embedding, and sentence embedding, converting the discrete word vector input into a vector representation. Specifically, it obtains the word vector, sentence vector, and position vector for each word unit. The word vector corresponds to each word unit, the sentence vector corresponds to the sentence to which each word unit belongs, and the position vector corresponds to the position of each word unit. The sum of the word embedding, position embedding, and sentence embedding is the final output of the Embedding layer.

[0093] Furthermore, after the Embedding layer outputs the encoding matrix, it can be input into the Transformer Encoder layer. The Transformer Encoder layer can then encode the contextual information of the encoding matrix. The Transformer Encoder layer can consist of Multi-Self-Attention, a Fully Connected Feed-Forward Network, and Layer Normalization. The Transformer Encoder layer can output the corresponding semantic vectors for each word unit, including semantic vectors indicating the start and end positions of the word unit.

[0094] Example, Figure 2 This is a model architecture diagram of a problem-solving model provided in the embodiments of this specification, such as... Figure 2 As shown, the left side of the question-answering model is the encoder, and the right side is the decoder. The encoder includes an embedding layer and a Transformer Encoder layer. In the BERT model, the start position is labeled cls, and the end position is labeled sep, which are used to identify the start and end positions of the input text, respectively. Figure 2 Chinese w i (i = 1, 2, ..., n) represents the i-th word unit of the input question to be solved, and n represents the number of word units obtained from word segmentation. After adding a start position marker word unit before the first word unit and an end position marker word unit after the last word unit, the input of the Embedding layer is W = [cls, w1, w2, ..., w n , sep]. Input this W into the Embedding layer, and the output is an encoding matrix of size (n+2)*hidden_size, where hidden_size represents the size of the encoding.

[0095] Next, the Embedding layer inputs the output encoding matrix into the Transformer Encoder layer. The Transformer Encoder layer can then encode the contextual information of the encoding matrix to obtain the semantic vectors corresponding to each word unit. cls e1, e2, ..., e n e sep ], where e cls e represents the semantic vector corresponding to the starting position identifier word unit. sep The semantic vector representing the term unit corresponding to the end position identifier, e1 to e n This represents the semantic vector corresponding to the n word units obtained from the word segmentation of the question to be answered.

[0096] In an optional implementation of this embodiment, after obtaining the semantic vectors corresponding to each word unit through the semantic information analysis layer, the state parameters in the decoder can be initialized based on the obtained semantic vectors. That is, after obtaining the semantic vectors corresponding to each word unit, the following steps are also included:

[0097] Determine the target semantic vector corresponding to the word unit at the starting position in the semantic vector of each word unit;

[0098] The state parameters of the decoder are initialized based on the target semantic vector.

[0099] Specifically, the decoder can be an LSTM model, and the state parameters of the decoder can be the parameters of the cell state (neuron) and hidden state (hidden layer) in the LSTM model. The output of the hidden state is the output of the LSTM model, that is, the output of the decoder.

[0100] It's important to note that the length of an input text is not fixed. The semantic information analysis layer continuously aggregates information from the entire sentence. The start position marker unit initially appears as a meaningless unit, but through multiple layers of information aggregation, it can represent the meaning of the entire sentence. In other words, the start position marker unit initially only indicates the beginning of the question to be answered; during the encoding process in the semantic information analysis layer, the features of subsequent word units can be aggregated into the start position marker unit.

[0101] In other words, after encoding by the semantic information analysis layer, the vector at the first position can represent the information thereafter. Therefore, the state parameters of the decoder can be initialized based on the semantic vector of the starting position identifier word unit. In specific implementation, the state parameters of the decoder can be set to the semantic vector of the starting position identifier word unit.

[0102] Of course, in practical applications, in addition to initializing the state parameters in the decoder based on the semantic vector of the starting position identifier word unit as described above, the state parameters in the decoder can also be initialized based on the average value of the semantic vector of each word unit. This specification does not impose any restrictions on this.

[0103] Step 106: Decode the semantic vector using the decoder of the question-answering model to obtain the answers corresponding to at least two missing positions of the question to be answered.

[0104] It should be noted that after the encoder in the question-solving model encodes the question to be solved, it obtains the semantic vectors corresponding to each word unit of the question. These semantic vectors can then be input into the decoder of the question-solving model. The decoder uses a decoding lexicon to decode the semantic vectors corresponding to each word unit, sequentially decoding the answers corresponding to each missing position. In other words, this specification demonstrates that the BERT model structure can be used to encode the question information, and then the LSTM model structure can be used to automatically generate the answer to the question.

[0105] In one optional implementation of this embodiment, the decoder includes a decoding lexicon; the semantic vector is decoded using the decoder of the question-answering model to obtain the answers corresponding to at least two missing positions of the question to be answered. The specific implementation process can be as follows:

[0106] Input the semantic vector into the decoder;

[0107] By using a decoding dictionary, the output answer for the first missing position of the question to be solved is decoded;

[0108] If the end symbol is not decoded, a preset separator is generated after the answer is output, and the output answer at the next empty position of the question to be solved is continued to be decoded until the end symbol is decoded, so as to obtain the answer corresponding to at least two empty positions of the question to be solved.

[0109] Specifically, the decoding dictionary can consist of all Chinese characters, symbols, and numbers.

[0110] It should be noted that the decoder of the question-answering model can be an LSTM network, which is a long short-term memory network model. When decoding the semantic vectors corresponding to each word unit, it recursively decodes each answer in an autoregressive manner and uses the Teacher Forece strategy, that is, when predicting the decoding output at time t, it will consider the input of all the previous t-1 time steps in the target.

[0111] In practical applications, the LSTM model can recursively decode the answers for each missing position until the end symbol is decoded. This end symbol can be a preset end symbol in the decoder, such as "eos". Furthermore, to separate the decoded answers, a preset separator can be output after decoding the answer for one missing position, and then the answer for the next missing position can be decoded and output, and so on, until the end symbol is decoded, thus obtaining all the answers to the problem. The preset separator can be a pre-set identifier used to separate two answers, such as "sep".

[0112] For example, such as Figure 2 As shown, the Transformer Encoder layer outputs the corresponding semantic vectors for each word unit [e cls e1, e2, ..., e n e sep After that, the semantic vectors corresponding to each word unit can also be [e] cls e1, e2, ..., e n e sep The input is fed into the LSTM Decoder layer. The LSTM Decoder layer, combined with its own decoding vocabulary, decodes each semantic vector. Here, `bos` represents the start of the decoding vocabulary in the LSTM Decoder layer, `eos` is the end symbol in the LSTM Decoder layer, used to indicate the end of decoding. k,n This represents the word in the k-th row and n-th column of the decoding vocabulary. The LSTMDecoder layer decodes each semantic vector to obtain the output answer A1 at the first missing position of the question to be solved, and then outputs the preset separator. <sep>Then continue decoding to obtain the output answer A2 at the next empty position of the question to be solved, and then output the preset separator. <sep>By analogy, decoding yields the output answer A at the kth empty position of the problem to be solved. k The decoding continues until the end symbol eos is reached, at least one missing position in the question is found to correspond to the answer "A1". <sep> A2…… <sep>A k ".

[0113] Another example: the replaced question with a second preset character is "A watermelon weighs approximately d1". <blank>A large cabbage weighs approximately d2 <blank>The weight of a watermelon is the same as that of a cabbage. <blank>The question to be answered is input into the question-solving model, and the decoded answer can be "kilogram". <sep>gram <sep>x=d1*1000 / d2”, where “kilogram” is the answer for the first blank position, “gram” is the answer for the second blank position, and “x=d1*1000 / d2” is the answer for the third blank position.

[0114] In one optional implementation of this embodiment, the question-answering model is trained using the following method:

[0115] Obtain the first training sample, and replace the numerical values ​​in the first training sample with the corresponding first preset characters according to the preset mapping rules to obtain the second training sample. The first training sample carries the sample label.

[0116] Input the second training sample into the solution model to obtain the predicted answer;

[0117] Based on the predicted answer and sample labels, calculate the loss value of the solution model, train the solution model based on the loss value, and return to execute the operation step of obtaining the first training sample until the training stopping condition is met.

[0118] It should be noted that after obtaining the first training sample, the values ​​in the first training sample need to be replaced with corresponding first preset characters according to a preset mapping rule to obtain the second training sample. This preset mapping rule is the same as the preset mapping rule used to process the values ​​in the question to be solved when the question-solving model is subsequently applied. That is, when training the question-solving model, the value at a specific position in the training sample is mapped to a specific symbol; when the question-solving model is subsequently applied to solve a question, the value at that position in the question to be solved will also be mapped to that symbol, thus ensuring that the trained question-solving model can accurately identify the relationships between the various first preset characters in the question to be solved.

[0119] For example, when training a problem-solving model, the values ​​in the training samples are mapped from left to right as d1, d2, ..., dn. When applying the problem-solving model to solve a problem, the values ​​in the problem to be solved are also mapped from left to right as d1, d2, ..., dn.

[0120] In addition, the missing positions in the first training sample can be replaced with the corresponding second preset character. The second preset character needs to be the same as the second preset character replaced in the subsequent application process. That is, when training the question-answering model, the missing positions in the training sample are replaced with the corresponding character. When the question-answering model is applied to answer questions in the future, the missing positions in the question to be answered will also be replaced with the corresponding character. This ensures that the trained question-answering model can accurately identify the missing positions in the question to be answered.

[0121] In an optional implementation of this embodiment, the obtained first training sample needs to carry a sample label. That is, the specific implementation process of obtaining the first training sample can be as follows:

[0122] Obtain the first training sample and at least one answer corresponding to the first training sample;

[0123] A preset separator is set between every two adjacent answers of at least two answers to construct the sample labels of the first training sample.

[0124] It should be noted that the first training sample is a question sample containing at least two sub-questions. To ensure that the answers to the questions to be answered are separated by a preset separator when the question-solving model is applied, the training sample should carry labels, and the answers to the sub-questions within these labels should also be separated by a preset separator. That is, a preset separator is set between every two adjacent answers of the at least two answers in the training sample to construct the sample labels for the first training sample.

[0125] In addition, after obtaining the first training sample, the numerical values ​​in the first training sample are replaced with the corresponding first preset characters according to the preset mapping rules to obtain the second training sample. The question-answering model is then trained based on the second training sample. That is, the training sample for training the question-answering model does not actually include numerical values, but rather the mapped first preset characters. Therefore, when constructing the sample labels for the first training sample, it is also necessary to map the numerical values ​​of each answer in the first training sample to the corresponding first preset characters.

[0126] In practice, sample labels refer to the true answers of the input training samples, while predicted answers are the answers predicted by the question-solving model after analyzing the question. In practical applications, a cross-entropy loss function can be calculated based on the predicted answers and sample labels to generate a loss value. This loss value is then used to adjust the parameters of the question-solving model in reverse, and it is determined whether the training stopping condition has been met. If not, the next training sample is acquired, and the parameter adjustment process continues until the training stopping condition is met.

[0127] Specifically, training termination conditions may include the loss value being less than a preset threshold. The preset threshold can be a critical value for the loss value. If the loss value is greater than or equal to the preset threshold, it indicates that there is still a certain deviation between the prediction result of the question-answering model and the actual result, and the parameters of the question-answering model still need to be adjusted. Training should then continue on the next training sample. If the loss value is less than the preset threshold, it indicates that the prediction result of the question-answering model is sufficiently close to the actual result, and training can stop. The value of the preset threshold can be determined according to the actual situation; this specification does not impose any restrictions on it.

[0128] In addition, the more iterations of training, the more accurate the problem-solving model will be. However, the number of training iterations cannot be unlimited. Therefore, the training stopping condition can be determined by whether the number of iterations reaches a threshold. This manual does not impose any restrictions on this.

[0129] It should be noted that the sample label refers to the actual answer that the question-answering model is expected to output. In other words, the sample label is the actual result. When the training sample is input into the question-answering model, the output predicted answer is the predicted result. When the difference between the predicted result and the actual result is small enough, it means that the predicted result is close enough to the actual result. At this time, the question-answering model is trained and can automatically answer questions and output the answers corresponding to each missing position.

[0130] This manual describes how to train a question-solving model using a large number of labeled samples within the problem domain. By calculating the loss value, the difference between the model's predictions and the actual results can be visually shown. Targeted adjustments to the parameters of the question-solving model can then effectively improve the training speed and effectiveness. Furthermore, this manual allows you to determine the specific training status of the question-solving model based on the loss value. If training fails, you can reverse-engineer the model's parameters based on the loss value to improve its problem-solving and analytical capabilities. This results in a high training speed and good training performance.

[0131] In an optional implementation of this embodiment, since the specific numerical values ​​in the question to be solved are mapped, each answer output by the question-solving model may include a first preset character that is mapped. Therefore, when determining the answer to the question to be solved, it is also necessary to substitute the specific numerical values ​​in the question to be solved and calculate the corresponding correct answer. That is, after obtaining the answer corresponding to at least one missing position of the question to be solved, the following steps are also included:

[0132] Determine whether there is a target answer containing a first preset character in the answer corresponding to at least one empty position;

[0133] If a target answer exists, then the target value corresponding to the first preset character is determined according to the numerical mapping list;

[0134] Substitute the target value into the first preset character of the target answer to obtain the correct answer to the question.

[0135] It should be noted that the numerical mapping list stores the mapping relationship between the specific numerical values ​​in the question to be solved and the first preset character. Based on this numerical mapping list, the specific numerical values ​​of the first preset character included in the target answer in the question to be solved can be determined, and thus the final correct answer can be calculated.

[0136] Continuing with the previous example, the constructed numerical mapping list of the unsolved problem is {d1: 8, d2: 800}, and the answer to the unsolved problem output by the problem-solving model is "kilograms". <sep>gram <sep>The answer is "x = d1 * 1000 / d2". Since the third answer in this problem contains the first preset characters "d1" and "d2", it is the target answer. Searching the numerical mapping list, we find that "d1" corresponds to the value 8 and "d2" corresponds to the value 800 in this problem. Substituting the values ​​of "d1" and "d2" into the target answer, we calculate that the target answer should be 10. Therefore, the correct answer to the problem is "kilogram". <sep>gram <sep>10".

[0137] Example, Figure 3 This is a schematic diagram illustrating an automatic problem-solving process provided in one embodiment of this specification, such as... Figure 3 As shown, the problem to be solved is "A watermelon weighs approximately 8 ( ), a cabbage weighs approximately 800 ( ), and the weight of the watermelon is ( ) times that of the cabbage". The problem is processed to transform it into "A watermelon weighs approximately d1". <blank>A large cabbage weighs approximately d2 <blank>The weight of a watermelon is the same as that of a cabbage. <blank>The value is calculated as "times", and a numerical mapping list for the unsolved problem is constructed as {d1: 8, d2: 800}.

[0138] Then, "a watermelon weighs approximately d1" <blank>A large cabbage weighs approximately d2 <blank>The weight of a watermelon is the same as that of a cabbage. <blank>When the input "times" is given to the trained question-answering model, the original answer output by the model is "kilograms". <sep>gram <sep>x=d1*1000 / d2”. Based on the numerical mapping list of the question to be solved, the original answer is analyzed and the correct answer to the question to be solved is “kilogram, gram, 10”.

[0139] In one optional implementation of this embodiment, the correct answer to the question to be answered can be automatically output through the question-and-answer model. Therefore, the user's input answer can also be automatically corrected based on the correct answer. Thus, after obtaining the question to be answered, the method further includes:

[0140] Get the answer information for the question to be answered;

[0141] Accordingly, after obtaining the correct answer to the question, the process also includes:

[0142] The solution information is compared with the correct answer to determine the solution to the question.

[0143] It should be noted that when acquiring the question to be answered, the answer information of the user can also be acquired at the same time. After the correct answer to the question to be answered is automatically determined based on the question-answering model, the answer information and the correct answer can be compared to automatically determine whether the user's answer is correct and provide the answer result of the question to be answered. This achieves the automation of determining the answer result of the question and saves human resources.

[0144] The problem-solving method provided in this manual allows you to input the problem into a problem-solving model. This model can output the answer to at least one missing position in the problem. By utilizing the problem-solving model to better understand the contextual semantics of the problem, the answers to all sub-problems in the problem can be obtained at once. In this way, based on a pre-trained problem-solving model, the correct answers to each problem can be automatically, efficiently, and accurately analyzed. By applying deep learning methods to the problem-solving process, high-precision automatic problem-solving is achieved, which greatly improves the efficiency and accuracy of problem-solving.

[0145] Figure 4 A flowchart is shown below illustrating another problem-solving method provided according to an embodiment of this specification, which specifically includes the following steps:

[0146] Step 402: Input the encoded information of the question to be answered into the encoder of the question answering model to obtain the semantic vector corresponding to the encoded information. The question to be answered includes at least one missing position.

[0147] Specifically, the unanswered question can be a question awaiting an answer, and it may include at least one sub-question. The question-solving model can determine the answers to each sub-question in the unanswered question all at once. In practical applications, the unanswered question can directly be the content of a fill-in-the-blank question. Of course, in practical applications, the unanswered question can also be other types of questions, such as multiple-choice questions or calculation problems containing one or more sub-questions. The question-solving model can output the answers to all questions at once.

[0148] In addition, unanswered questions can be questions from various fields, such as math problems, language arts problems, and English problems. Furthermore, unanswered questions can be questions waiting to be answered, or questions waiting for a confirmed answer. For example, an unanswered question might be a question that a student doesn't know how to answer and is searching for, in which case the unanswered question is waiting for an answer and there is no answer information entered by the user; or an unanswered question might be a question that a student has submitted an answer to, in which case the unanswered question is waiting for a confirmed answer and there is answer information entered by the user.

[0149] Furthermore, the encoded information of the question to be answered can refer to the information generated based on the question to be answered, which is waiting to be encoded by the input question answering model.

[0150] In an optional implementation of this embodiment, before inputting the encoded information of the question to be answered into the encoder of the question-solving model for encoding, the question to be answered can be segmented into words, and then the segmented word units can be used as the initial encoded information of the question to be answered. That is, before inputting the encoded information of the question to be answered into the encoder of the question-solving model, the method further includes:

[0151] Get the questions to be answered;

[0152] The question to be answered is broken down into word units, and a start position marker word unit is added before the first word unit and an end position marker word unit is added after the last word unit;

[0153] Each word unit is used as encoded information.

[0154] It should be noted that the input to the subsequent question-solving model is the encoded information of the question to be answered. Through this question-solving model, the text and numerical information related to the question in the encoded information can be understood, and the answers for the number of blanks to be filled in the corresponding question can be automatically output. Therefore, the question to be answered can be obtained first, and the corresponding encoded information can be generated based on the obtained question to be answered. Subsequently, the encoded information can be analyzed and processed through this question-solving model to obtain the corresponding number of answers.

[0155] In practical applications, after obtaining the question to be answered, it can first be segmented into multiple word units. Then, a start position marker word unit is added before the first word unit, and an end position marker word unit is added after the last word unit. The start position marker word unit indicates the beginning position of the question to be answered, and the end position marker word unit indicates the end position. Then, the word units obtained from segmenting the question to be answered, along with the start and end position marker word units, are used as the initial encoding information for the question to be answered and input into the encoder of the question-solving model for encoding.

[0156] In an optional implementation of this embodiment, since some questions to be answered may include numerical values, and semantic analysis processes are often not very sensitive to numerical values, directly performing semantic analysis and processing based on the original numerical values ​​through a question-answering model for numerical questions may greatly reduce the accuracy of the answer. Therefore, the numerical values ​​in the questions to be answered can also be mapped to corresponding first preset characters. That is, after obtaining the questions to be answered, the method further includes:

[0157] Extract the numerical values ​​included in the question to be answered;

[0158] Based on the preset mapping rules, a corresponding first preset character is set for each value, and a value mapping list for the question to be answered is constructed.

[0159] Specifically, the preset mapping rule can refer to a pre-set rule used to indicate which position's value is mapped to which first preset character; in addition, the first preset character refers to a pre-set symbol used to represent values ​​at different positions, such as d1, d2, d3, d4, a, b, c, d, etc.

[0160] In practical applications, based on pre-set mapping rules, it is possible to determine which first preset character each value in the question to be solved should be mapped to, and based on the value and the corresponding first preset character, a value mapping list for the question to be solved can be constructed.

[0161] In one optional implementation of this embodiment, the preset mapping rule can be sequential numbering from left to right. In this case, according to the preset mapping rule, a corresponding first preset character is set for each value, and a value mapping list for the question to be solved is constructed. The specific implementation process can be as follows:

[0162] Arrange the values ​​from left to right according to their order in the questions to be answered;

[0163] Set the corresponding first preset character for each of the numerical values ​​in turn;

[0164] Each value and its corresponding first preset character are stored to construct a value mapping list for the question to be answered.

[0165] It should be noted that the values ​​included in the question to be solved can be numbered sequentially from left to right. Therefore, the values ​​can be arranged sequentially from left to right according to their order in the question to be solved, and then the first preset character can be set for each value in the order of arrangement.

[0166] In practical applications, the first preset character can be a letter. Then, the values ​​at different positions are sequentially numbered. That is, assuming the letter 'd' is used to represent the values ​​at different positions in the problem to be solved, the first preset character 'd1' can be set for the first value in the problem to be solved, the first preset character 'd2' can be set for the second value in the problem to be solved, and so on, until the first preset character 'dn' can be set for the nth value in the problem to be solved, where n represents the total number of values ​​in the problem to be solved. The resulting value mapping list for the problem to be solved is {d1: value 1, d2: value 2, ..., dn: value n}.

[0167] For example, the obtained question is "A watermelon weighs approximately 8(), a cabbage weighs approximately 800(), and the weight of the watermelon is () times that of the cabbage". In this case, the extracted values ​​are 8 and 800. The first preset character of the value 8 is set to d1, and the first preset character of the value 800 is set to d2. The resulting numerical mapping list for the question is {d1: 8, d2: 800}.

[0168] This manual allows mapping numerical values ​​in the question to be answered to corresponding first preset characters. Then, the mapped question can be segmented to generate encoded information. When the question-solving model performs semantic analysis on the encoded information, the numerical values ​​in the encoded information have already been mapped to the corresponding symbols. The question-solving model does not need to analyze the semantic relationships between a large number of numbers, which improves the accuracy of the subsequent semantic analysis of the encoded information and thus improves the accuracy of the subsequent question-solving.

[0169] In one optional implementation of this embodiment, the missing positions in the question to be solved are generally represented by special symbols such as parentheses, underscores, and spaces. However, the model is more sensitive to characters than symbols. To facilitate a more accurate analysis of the semantic information of the encoded information of the question to be solved by the subsequent model, the missing positions in the question to be solved can be further replaced with corresponding characters. That is, after obtaining the question to be solved, the following can also be included:

[0170] Identify at least one missing position in the unsolved question;

[0171] Replace at least one empty position with a second preset character.

[0172] Specifically, the second preset character can be a pre-set character used to identify the missing positions in the question to be solved, so as to inform the question-solving model which position's answer needs to be parsed. For example, the second preset character can be... <blank>.

[0173] It should be noted that a question to be answered typically includes at least one empty position, and each empty position is a sub-question that needs to be parsed to obtain the corresponding answer. In practical applications, in order to analyze and process the various sub-questions of the question to be answered together and output the answers to each sub-question, after obtaining the question to be answered, each empty position in the question to be answered can be replaced with a second preset character. Then, the replaced question to be answered is segmented to generate the encoded information of the question to be answered. When the question answering model analyzes this encoded information later, the question answering model can accurately determine which positions should be parsed and output the parsed answers.

[0174] Continuing with the previous example, the obtained question is "A watermelon weighs approximately 8(), a cabbage weighs approximately 800(), and the weight of the watermelon is () times that of the cabbage". This question contains 3 blank positions. Replace each blank position with the second preset character. <blank>The question obtained, with a second preset character added, is "A watermelon weighs approximately 8..." <blank>A large Chinese cabbage weighs approximately 800 kilograms. <blank>The weight of a watermelon is the same as that of a cabbage. <blank>times".

[0175] In this manual, the encoded information of the question to be solved can be input into the question-solving model for analysis and processing. That is, all the sub-questions included in the question to be solved can be input into the question-solving model for analysis and processing. Therefore, in order to separate and identify the position of each sub-question, at least one empty position in the question to be solved can be replaced with a second preset character, so that the answers to all the sub-questions in the question can be obtained accurately at one time, realizing high-precision and high-efficiency automatic problem solving.

[0176] It should be noted that after obtaining the question to be answered, a numerical mapping list can be constructed for the numerical values ​​in the question, thereby replacing the numerical values ​​with the corresponding first preset character; in addition, at least one missing position in the question can be replaced with a second preset character. Next, the question to be answered is segmented into words, and the segmented word units are used as the initial encoding information for the question. This encoded information can then be input into the encoder of the question-answering model for further encoding to obtain the semantic vector corresponding to the encoded information.

[0177] Of course, in practical applications, both replacement processing for missing positions and replacement processing for logarithmic values ​​can be performed, or only one replacement processing can be performed. This manual does not impose any restrictions on this.

[0178] In practical applications, deep learning models can be used to learn the contextual semantic information of the encoded input. Among these methods, the BERT model is the best performing, as it utilizes a large amount of natural language text to develop powerful contextual understanding capabilities, making it suitable for related natural language tasks. Therefore, this specification uses the BERT model structure as the architecture for the automatic solver. Specifically, the encoder in this specification can be a BERT model. The BERT model is essentially a bidirectional encoder representation based on Transformer, rooted in Transformer and derived from the concept of "attention is all you need." The bidirectional meaning indicates that when processing a word, it considers information from both preceding and following words to obtain the semantic context. In other words, the encoder can be a basic BERT model pre-trained on a large amount of news, community Q&A, and encyclopedia data.

[0179] Furthermore, the question-solving model can include an encoder and a decoder. The encoder analyzes the contextual semantic relationships of the input encoded information to obtain a semantic vector. The decoder then decodes the semantic vector to obtain the answers at each missing position of the question. In other words, the input encoded information can be encoded using a pre-trained BERT model.

[0180] In one optional implementation of this embodiment, the encoder may include an embedding layer and a semantic information analysis layer; the encoded information of the question to be answered is input into the encoder of the question-answering model to obtain the semantic vector corresponding to the encoded information. The specific implementation process can be as follows:

[0181] The encoded information is input into the embedding layer for embedding processing to obtain the encoding matrix corresponding to the encoded information;

[0182] The encoding matrix is ​​input into the semantic information analysis layer to obtain the semantic vector corresponding to the encoded information.

[0183] Specifically, the embedding layer is used to encode the encoded information to obtain the corresponding encoding matrix. Through the embedding layer, word embedding can be performed on the encoded information, embedding the high-dimensional encoded information into a much lower-dimensional continuous vector space. Additionally, the semantic information analysis layer is used to encode the contextual semantic information of the encoding matrix corresponding to the encoded information, obtaining the semantic vector corresponding to the encoded information.

[0184] It should be noted that the encoder can be a BERT model structure. Since the BERT model can only receive single characters as input, the encoding information is generated by breaking down the question to be answered into word units. Each word unit can include only one character or multiple characters.

[0185] In practical applications, the embedding layer can be the Embedding layer in the BERT model, and the semantic information analysis layer can be the Transformer Encoder layer in the BERT model. Furthermore, after the encoded information is input into the Embedding layer, the Embedding layer encodes the input encoded information. The encoding in the Embedding layer is consistent with that in the BERT model. The Embedding layer can consist of word embedding, position embedding, and sentence embedding, converting the discrete word vector input into a vector representation. That is, it obtains the word vector, sentence vector, and position vector for each word unit in the encoded information. The word vector is the vector corresponding to each word unit, the sentence vector is the sentence vector to which each word unit belongs, and the position vector is the vector generated at the position corresponding to each word unit. The sum of the WordEmbedding, Position Embedding, and Sentence Embedding is the final output of the Embedding layer.

[0186] Furthermore, after the Embedding layer outputs the encoding matrix, it can be input into the Transformer Encoder layer. The Transformer Encoder layer can then encode the contextual information of the encoding matrix. The Transformer Encoder layer can consist of Multi-Self-Attention, a Fully Connected Feed-Forward Network, and Layer Normalization. The Transformer Encoder layer can output the corresponding semantic vectors for each word unit, including semantic vectors indicating the start and end positions of the word unit.

[0187] Example, Figure 5 This is a model architecture diagram of another problem-solving model provided in the embodiments of this specification, such as... Figure 5 As shown, the encoder of the question-answering model includes an embedding layer and a Transformer Encoder layer. In the BERT model, the start position is labeled cls and the end position is labeled sep, which are used to identify the start and end positions of the input text, respectively. Figure 5 Chinese w i (i = 1, 2, ..., n) represents the i-th word unit in the encoded information of the input question to be solved, and n represents the number of word units obtained from word segmentation. After adding a start position marker word unit before the first word unit and an end position marker word unit after the last word unit, the input of the Embedding layer (i.e., the initial encoded information) is W0 = [cls, w1, w2, ..., w n , sep]. Input W0 into the Embedding layer, and the output is an encoding matrix of size (n+2)*hidden_size, where hidden_size represents the size of the encoding.

[0188] Next, the Embedding layer inputs the output encoding matrix into the Transformer Encoder layer. The Transformer Encoder layer can then encode the contextual information of the encoding matrix to obtain the semantic vectors corresponding to each word unit. cls e1, e2, ..., e n e sep ], where e cls e represents the semantic vector corresponding to the starting position identifier word unit. sep The semantic vector representing the term unit corresponding to the end position identifier, e1 to e n This represents the semantic vector corresponding to the n word units obtained from the word segmentation of the question to be answered.

[0189] Step 404: Decode the semantic vector using the decoder of the question-answering model to obtain the i-th answer character of the question to be answered.

[0190] In practical applications, the prediction usually starts from the first answer character in the first missing position of the question and proceeds sequentially, so i can initially be equal to 1.

[0191] It should be noted that after the encoder in the question-answering model encodes the encoded information of the question to be answered, it can obtain the semantic vector corresponding to each word unit in the encoded information. At this time, the semantic vector corresponding to each word unit can be input into the decoder of the question-answering model, so as to use the decoder to decode the semantic vector and obtain the current answer character.

[0192] In practical implementation, the decoder of the question-answering model can be a Transformer model structure. Since the encoder of the question-answering model is a BERT model structure, which is also a Transformer model structure, the encoder and decoder structures of the question-answering model are identical and can share a set of parameters. Therefore, it is unnecessary to initialize the decoder parameters based on the encoder's output. That is, this specification can use the BERT model structure to encode the information of the question to be answered, and then use the Transformer model structure to decode it, automatically generating the answer to the question. For example, the decoder of the question-answering model can be a Mask Language Model Head (MLM Head) classifier.

[0193] It should be noted that after the model outputs the complete answer for each missing position, it can output a preset separator after the complete answer. Then, it can output the first answer character for the next missing position after the preset separator, and so on, thus separating the answers for different missing positions. The preset separator can be a pre-set symbol used to separate the answers for two missing positions, such as "sep".

[0194] In one optional implementation of this embodiment, the question-answering model can be trained using the following method:

[0195] Obtain the third training sample, which carries sample labels;

[0196] Input the third training sample and sample label into the question-answering model to obtain the predicted answer of the third training sample;

[0197] Based on the predicted answer and sample labels, calculate the loss value of the question-answering model, train the question-answering model based on the loss value, and return to execute the operation step of obtaining the third training sample until the training stopping condition is met.

[0198] It should be noted that the obtained third training samples may carry sample labels, which can refer to the sample answers corresponding to each sub-question in the third training samples. In this specification, the sample labels and the third training samples can be input together into the question-solving model, allowing the model to analyze the input sample labels and the third training samples, thereby outputting the corresponding predicted answers. Then, based on the predicted answers and sample labels, the parameters of the question-solving model can be adjusted until the training stopping condition is met, resulting in a fully trained question-solving model.

[0199] In one optional implementation of this embodiment, the third training sample and sample labels are input into the question-answering model to obtain the predicted answer. The specific implementation process can be as follows:

[0200] The first i sample characters in the sample label are concatenated into the third training sample to obtain the sample encoding information, where i is a natural number;

[0201] Input the sample encoding information into the encoder of the question-answering model to obtain the sample semantic vector corresponding to the sample encoding information;

[0202] The decoder of the question-answering model decodes the semantic vector of the sample to obtain the (i+1)th reference sample character of the third training sample. Then, i is incremented by 1, and the process is returned to concatenate the first i sample characters in the sample label to the third training sample to obtain the sample encoding information, until the last reference sample character of the third training sample is obtained.

[0203] Based on the preset spacers in the characters of each obtained reference sample, the predicted answer for the third training sample is determined.

[0204] It should be noted that the sample labels can include sample answers corresponding to each sub-question in the third training sample. Each sample answer consists of multiple sample characters. In practical applications, the first 0 sample characters from the sample labels can be concatenated to the third training sample to obtain the sample encoding information, which is the third training sample. Inputting this encoding information into the encoder and decoder of the question-solving model yields the first reference sample character of the third training sample. Then, the first sample character from the sample labels can be concatenated to the third training sample to obtain the sample encoding information, which is the third training sample plus the first sample character from the sample labels. Inputting this encoding information into the encoder and decoder of the question-solving model yields the second reference sample character of the third training sample. Then, the first two sample characters from the sample labels can be concatenated to the third training sample to obtain the sample encoding information, which is the third training sample plus the first and second sample characters from the sample labels. Inputting this encoding information into the encoder and decoder of the question-solving model yields the third reference sample character, and so on, until the last reference sample character is obtained. The predicted answer of the third training sample can then be determined based on the preset spacers in each reference sample character.

[0205] It should be noted that during the training process of the question-answering model, the training samples and sample characters are concatenated together and input into the model. The teacher force strategy is used, that is, when predicting the output at time t, the content of the true answer at time t-1 before can be considered as input. This allows the trained question-answering model to refer to the content at time t before and predict the output at time t, thereby improving the accuracy of the output answer.

[0206] In practical applications, when concatenating the first i sample characters from the sample label into the third training sample to obtain sample encoding information, a preset separator can be set between every two sample answers in order to separate different sample answers. That is, the preset separator between every two sample answers can also be used as a sample character from the sample label to be concatenated into the third training sample, so that when the question-solving model is applied to output the answers to the question to be answered, the answers can be separated by the preset separator.

[0207] Additionally, whether the last reference sample character has been obtained can be determined by whether the end symbol has been decoded. If the end symbol has not been decoded, it means that there are still other reference sample characters that have not been predicted. Therefore, the first i sample characters in the sample label can be concatenated with the third training sample to obtain the sample encoding information for prediction. If the end symbol has been decoded, it means that the last reference sample character has been obtained, the prediction is complete, and the prediction answer has been obtained. Further training can then be performed using other training samples. The end symbol can be a preset end symbol in the decoder, such as "eos".

[0208] Furthermore, since the training samples may also include numerical values, after obtaining the third training sample, the numerical values ​​in the third training sample can be replaced with the corresponding first preset characters according to a preset mapping rule. Then, training can be performed based on the replaced third training sample. This preset mapping rule is the same as the preset mapping rule used to process the numerical values ​​in the question to be answered when the question-solving model is subsequently applied to solve the problem. That is, when training the question-solving model, the numerical value at a specific position in the training sample is mapped to a specific symbol; when the question-solving model is subsequently applied to solve a problem, the numerical value at that position in the question to be answered will also be mapped to that symbol, thus ensuring that the trained question-solving model can accurately identify the relationships between the various first preset characters in the question to be answered.

[0209] Furthermore, since the third training sample of the training problem-solving model does not actually include numerical values, but rather the first preset character that is mapped, the numerical values ​​included in the sample labels of the third training sample can also be mapped to the corresponding first preset character.

[0210] For example, when training a problem-solving model, the values ​​in the training samples are mapped from left to right as d1, d2, ..., dn. When applying the problem-solving model to solve a problem, the values ​​in the problem to be solved are also mapped from left to right as d1, d2, ..., dn.

[0211] It should be noted that the missing positions in the third training sample can also be replaced with the corresponding second preset character. This second preset character needs to be the same as the second preset character replaced in the subsequent application process. That is, when training the question-answering model, the missing positions in the training sample are replaced with the corresponding character. When applying the question-answering model to answer questions in the future, the missing positions in the question to be answered will also be replaced with the corresponding character. This ensures that the trained question-answering model can accurately identify the missing positions in the question to be answered.

[0212] In practice, sample labels refer to the true answers of the input training samples, while predicted answers are the answers predicted by the question-solving model after analyzing the question. In practical applications, a cross-entropy loss function can be calculated based on the predicted answers and sample labels to generate a loss value. This loss value is then used to adjust the parameters of the question-solving model in reverse, and it is determined whether the training stopping condition has been met. If not, the next training sample is acquired, and the parameter adjustment process continues until the training stopping condition is met.

[0213] Specifically, training termination conditions may include the loss value being less than a preset threshold. The preset threshold can be a critical value for the loss value. If the loss value is greater than or equal to the preset threshold, it indicates that there is still a certain deviation between the prediction result of the question-answering model and the actual result, and the parameters of the question-answering model still need to be adjusted. Training should then continue on the next training sample. If the loss value is less than the preset threshold, it indicates that the prediction result of the question-answering model is sufficiently close to the actual result, and training can stop. The value of the preset threshold can be determined according to the actual situation; this specification does not impose any restrictions on it.

[0214] In addition, the more iterations of training, the more accurate the problem-solving model will be. However, the number of training iterations cannot be unlimited. Therefore, the training stopping condition can be determined by whether the number of iterations reaches a threshold. This manual does not impose any restrictions on this.

[0215] It should be noted that the sample label refers to the actual answer that the question-answering model is expected to output. In other words, the sample label is the actual result. When the training sample is input into the question-answering model, the output predicted answer is the predicted result. When the difference between the predicted result and the actual result is small enough, it means that the predicted result is close enough to the actual result. At this time, the question-answering model is trained and can automatically answer questions and output the answers corresponding to each missing position.

[0216] This manual describes how to train a question-solving model using a large number of labeled samples within the problem domain. By calculating the loss value, the difference between the model's predictions and the actual results can be visually shown. Targeted adjustments to the parameters of the question-solving model can then effectively improve the training speed and effectiveness. Furthermore, this manual allows you to determine the specific training status of the question-solving model based on the loss value. If training fails, you can reverse-engineer the model's parameters based on the loss value to improve its problem-solving and analytical capabilities. This results in a high training speed and good training performance.

[0217] Step 406: Concatenate the i-th answer character after the encoded information to obtain the updated encoded information.

[0218] In the specific implementation, let i be incremented by 1, and return to the operation step 402 above until the last answer character of the question to be solved is obtained, so as to obtain the answer corresponding to at least one empty position of the question to be solved.

[0219] In practical applications, the initial encoded information is the information obtained after segmenting the question to be answered. That is, the initial encoded information only includes the question to be answered. This encoded information is input into the question-solving model. Based on the encoder and decoder of the question-solving model, the first answer character of the question to be answered can be obtained. At this time, the first answer character can be concatenated to the encoded information to obtain the updated encoded information. This encoded information is then input into the question-solving model. Based on the encoder and decoder of the question-solving model, the second answer character of the question to be answered can be obtained. Then, the second answer character can be concatenated to the current encoded information (including the question to be answered and the first answer character) to obtain the updated encoded information. This encoded information is then input into the question-solving model. Based on the encoder and decoder of the question-solving model, the third answer character of the question to be answered can be obtained. And so on, until the last answer character of the question to be answered is obtained.

[0220] It should be noted that after obtaining each answer character, it needs to be concatenated to the current encoding information, and the next answer character is output using this encoding information. In other words, the answer character to be output at time t can be determined by using the question to be solved and the answer characters output at the previous time step t-1.

[0221] Furthermore, since there are no preceding answer characters to refer to when determining the first answer character of a question, the first answer character can only be determined based on the semantic information of the question. That is, the semantic vectors of each word unit of the question can be input into the decoder, which analyzes the semantic vectors of each word unit to determine the first answer character.

[0222] Furthermore, the length of an input text is not fixed. In the semantic information analysis layer (TransformerEncoder layer), the information of the entire sentence is continuously aggregated. The start position marker unit and the end position marker unit are initially meaningless word units, but after multiple layers of information aggregation, the end position marker unit can represent the meaning of the entire sentence. Therefore, only the end position marker unit can be input into the decoder. The decoder analyzes the semantic vector of the end position marker unit to determine the first answer character of the question to be answered.

[0223] In an optional implementation of this embodiment, after obtaining the last answer character of the question to be answered, the method further includes:

[0224] Based on the preset separators in each of the obtained answer characters, determine the answer corresponding to at least one missing position in the question to be answered.

[0225] It should be noted that after outputting the complete answer corresponding to a missing position, the decoder can output a preset spacer before continuing to output the first answer character corresponding to the next missing position. That is, when the decoder is decoding the semantic vector and outputting the current answer character, if the previously output answer character was the last answer character of the previous missing position, then the currently output answer character is the preset spacer. In this case, this answer character (i.e., the preset spacer) can be concatenated after the encoded information to obtain the updated encoded information. Then, i is incremented by 1, and the decoder continues to output the first answer character corresponding to the next missing position.

[0226] In practical applications, the preset separators in each answer character can be determined, and the answer character between every two preset separators is the answer corresponding to a missing position.

[0227] One possible implementation, such as Figure 5 As shown, the Transformer Encoder layer outputs the corresponding semantic vectors for each word unit [e cls e1, e2, ..., e n e sep After that, the semantic vector e of the term unit that identifies the end position can also be... sep The input is fed into the MLM Head layer, which decodes the semantic vector of the word unit that marks the end position. Here, eos is the end symbol in the MLM Head layer, used to indicate the end of the decoding in the MLM Head layer.

[0228] The MLM Head layer can decode the semantic vector of the term unit that marks the end position to obtain the first answer character A1 of the question to be answered. A1 is then concatenated into W0 (i.e., [cls, w1, w2, ..., w... n After [sep]), the current encoded information is obtained as W1 = [cls, w1, w2, ..., w n [cls, sep, A1], this encoded information is input into the Embedding layer, TransformerEncoder layer, and MLM Head layer to obtain the second answer character A2 of the question to be solved. Then, A2 can be concatenated into W1 (i.e., [cls, w1, w2, ..., w...]). n After [sep, A1]), the current encoded information is obtained as W2 = [cls, w1, w2, ..., w n [sep, A1, A2], input W2 into the Embedding layer, Transformer Encoder layer, and MLM Head layer to obtain the third answer character A3 of the question to be solved. This process continues until the end symbol eos is decoded to obtain the last answer character A of the question to be solved. k Assume A4, A7, ..., A k-3 The default separator is "sep". At this point, the answer corresponding to at least one missing position in the question to be answered is "A1A2A3". <sep>A5A6 <sep> …… <sep>A k-2 A k-1 A k ".

[0229] For example, the question to be answered is "The sum of the interior angles of a triangle is (), and the sum of the interior angles of a quadrilateral is ().", which can be encoded into the information "[CLS] The sum of the interior angles of a triangle is ()". <blank>The sum of the interior angles of a quadrilateral is <blank>[SEP]”. Inputting this encoded information into the model yields the first answer character as 1. This 1 is then appended to the end of the encoded information to obtain the updated encoded information: "[CLS] The sum of the interior angles of a triangle is...". <blank>The sum of the interior angles of a quadrilateral is <blank>[SEP]1”, then input the updated encoded information into the model to get the second answer character 8. Then append 8 to the end of the encoded information to get the updated encoded information "[CLS] The sum of the interior angles of a triangle is <blank>The sum of the interior angles of a quadrilateral is <blank>[SEP]18.

[0230] The updated encoded information is then input into the model to obtain the third answer character 0. This 0 is then appended to the end of the encoded information to obtain the updated encoded information: "[CLS] The sum of the interior angles of a triangle is..." <blank>The sum of the interior angles of a quadrilateral is <blank>[SEP]180". Then input the updated encoded information into the model to get the fourth answer character, sep. Then append sep to the end of the encoded information to get the updated encoded information: "[CLS] The sum of the interior angles of a triangle is..." <blank>The sum of the interior angles of a quadrilateral is <blank>[SEP]180sep”, then input the updated encoded information into the model to get the fifth answer character 3, then append 3 to the end of the encoded information to get the updated encoded information "[CLS]The sum of the interior angles of a triangle is <blank>The sum of the interior angles of a quadrilateral is <blank>[SEP]180sep3”, and so on, until the last answer character 0 is obtained. At this point, the answer corresponding to at least one missing position in the question is "180". <sep>360".

[0231] In an optional implementation of this embodiment, if the specific numerical values ​​in the question to be solved are mapped, the answer characters output by the question-solving model may include the mapped first preset character. That is, the answer corresponding to at least one empty position may include the first preset character. Therefore, when determining the correct answer to the question to be solved, it is also necessary to substitute the specific numerical values ​​in the question to be solved and calculate the corresponding correct answer. That is, after determining the answer corresponding to at least one empty position of the question to be solved based on the preset separators in each of the obtained answer characters, the method further includes:

[0232] Determine whether there exists a first answer containing a first preset character in the answer corresponding to at least one empty position;

[0233] If a first answer exists, then determine the target value corresponding to the first preset character according to the numerical mapping list;

[0234] Substitute the target value into the first preset character of the first answer, and parse to obtain the correct answer corresponding to at least one missing position of the question to be solved.

[0235] It should be noted that the numerical mapping list stores the mapping relationship between the specific numerical values ​​in the question to be solved and the first preset character. Based on this numerical mapping list, the specific numerical values ​​of the first preset character included in the target answer in the question to be solved can be determined, and thus the final correct answer can be calculated.

[0236] Continuing with the previous example, the constructed numerical mapping list of the unsolved questions is {d1: 8, d2: 800}. Assume that the answer corresponding to at least one missing position in the unsolved questions output by the problem-solving model is "kilogram". <sep>gram <sep>Since the third target answer "x = d1 * 1000 / d2" in the answer corresponding to at least one missing position includes the first preset characters "d1" and "d2", it is necessary to calculate the third target answer. Searching in the numerical mapping list, we determine that the value corresponding to "d1" in the question is 8, and the value corresponding to "d2" in the question is 800. Then, we can substitute the values ​​corresponding to "d1" and "d2" into the third target answer, calculating that the third target answer should be 10. Therefore, we obtain the correct answer "kilogram" corresponding to at least one missing position in the question. <sep>gram <sep>10".

[0237] In one optional implementation of this embodiment, the correct answer to the question to be answered can be automatically output through the question-answering model. Therefore, the solution result of the user-inputted solution information can also be determined based on the correct answer. Thus, after obtaining the question to be answered, the method further includes:

[0238] Get the answer information for the question to be answered;

[0239] Accordingly, after parsing and obtaining the correct answer corresponding to at least one missing position in the question to be solved, it also includes:

[0240] The solution information is compared with the correct answer to determine the solution to the question.

[0241] It should be noted that when acquiring the question to be answered, the answer information of the user can also be acquired at the same time. After the correct answer to the question to be answered is automatically determined based on the question-answering model, the answer information and the correct answer can be compared to automatically determine whether the user's answer is correct and provide the answer result of the question to be answered. This achieves the automation of determining the answer result of the question and saves human resources.

[0242] The problem-solving method provided in this manual allows inputting the encoded information of the problem to be solved into a problem-solving model. This model outputs the answer corresponding to at least one missing position in the problem. By utilizing the problem-solving model, the contextual semantics of the problem are better understood, and answers to all sub-problems within the problem can be obtained at once. Furthermore, after obtaining each answer character, it can be concatenated to the current encoded information. The next answer character can be determined using the concatenated encoded information. The answer character to be output at time t can be determined by considering the problem to be solved and the answer characters output at time t-1, significantly improving the accuracy of the answers to the problem. In this way, based on a pre-trained problem-solving model, each correct answer to a problem can be automatically, efficiently, and accurately analyzed. By applying deep learning methods to the problem-solving process, high-precision automatic problem-solving is achieved, greatly improving the efficiency and accuracy of problem-solving.

[0243] Corresponding to the above method embodiments, this specification also provides embodiments of a problem-solving device. Figure 6 A schematic diagram of a problem-solving device according to an embodiment of this specification is shown. Figure 6 As shown, the device includes:

[0244] The first acquisition module 602 is configured to acquire a question to be answered, which includes at least two empty positions.

[0245] The first obtaining module 604 is configured to input the question to be answered into the encoder of the question answering model to obtain the semantic vector corresponding to the question to be answered;

[0246] The second obtaining module 606 is configured to decode the semantic vector through the decoder of the question-answering model to obtain the answers corresponding to at least two missing positions of the question to be answered.

[0247] Optionally, the first acquisition module 602 is further configured as follows:

[0248] Extract the numerical values ​​included in the question to be answered;

[0249] Based on the preset mapping rules, a corresponding first preset character is set for each value, and a value mapping list for the question to be answered is constructed.

[0250] Optionally, the preset mapping rule is to number sequentially from left to right; the first acquisition module 702 is further configured as follows:

[0251] Arrange the values ​​from left to right according to their order in the questions to be answered;

[0252] Set the corresponding first preset character for each of the numerical values ​​in turn;

[0253] Each value and its corresponding first preset character are stored to construct a value mapping list for the question to be answered.

[0254] Optionally, the first obtaining module 604 is further configured to:

[0255] Replace the numerical values ​​in the question to be answered with the corresponding first preset character;

[0256] The replaced question is input into the encoder of the question-answering model to obtain the semantic vector corresponding to the question.

[0257] Optionally, the second obtaining module 606 is further configured to:

[0258] Determine whether there is a target answer that includes the first preset character in the answers corresponding to at least two empty positions;

[0259] If a target answer exists, then the target value corresponding to the first preset character is determined according to the numerical mapping list;

[0260] Substitute the target value into the first preset character of the target answer to obtain the correct answer to the question.

[0261] Optionally, the encoder includes an embedding layer and a semantic information analysis layer; the first acquisition module 707 is further configured to:

[0262] The question to be answered is broken down into word units, and a start position marker word unit is added before the first word unit and an end position marker word unit is added after the last word unit;

[0263] Each word unit is input into the embedding layer for embedding processing to obtain the encoding matrix corresponding to each word unit;

[0264] The encoding matrix is ​​input into the semantic information analysis layer to obtain the semantic vector corresponding to each word unit.

[0265] Optionally, the device further includes an initialization module configured to:

[0266] Determine the target semantic vector corresponding to the word unit at the starting position in the semantic vector of each word unit;

[0267] The state parameters of the decoder are initialized based on the target semantic vector.

[0268] Optionally, the decoder includes a decoding dictionary; the second acquisition module 606 is further configured to:

[0269] Input the semantic vector into the decoder;

[0270] By using a decoding dictionary, the output answer for the first missing position of the question to be solved is decoded;

[0271] If the end symbol is not decoded, a preset separator is generated after the answer is output, and the output answer at the next empty position of the question to be solved is continued to be decoded until the end symbol is decoded, so as to obtain the answer corresponding to at least two empty positions of the question to be solved.

[0272] Optionally, the device also includes a replacement module configured to:

[0273] Identify at least two missing positions in the unanswered question;

[0274] Replace at least two empty positions with the second preset character.

[0275] Optionally, the device also includes a training module configured to:

[0276] Obtain the first training sample, and replace the numerical values ​​in the first training sample with the corresponding first preset characters according to the preset mapping rules to obtain the second training sample. The first training sample carries the sample label.

[0277] Input the second training sample into the question-answering model to obtain the predicted answer;

[0278] Based on the predicted answer and sample label, calculate the loss value of the question-answering model, train the question-answering model based on the loss value, and return to execute the operation step of obtaining the first training sample until the training stopping condition is met.

[0279] Optionally, the training module is further configured as follows:

[0280] Obtain the first training sample and at least two answers corresponding to the first training sample;

[0281] If there is only one answer, use that answer as the sample label for the first training sample.

[0282] When there are at least two answers, a preset separator is set between every two adjacent answers to construct the sample labels for the first training sample.

[0283] The problem-solving device provided in this manual allows input of a problem into a problem-solving model. This model outputs the answers to at least two missing positions in the problem. By utilizing the problem-solving model to better understand the contextual semantics of the problem, it obtains the answers to all sub-problems in the problem at once. Thus, based on a pre-trained problem-solving model, it can automatically, efficiently, and accurately analyze each correct answer to the problem. By applying deep learning methods to the problem-solving process, it achieves high-precision automatic problem-solving, greatly improving the efficiency and accuracy of problem-solving.

[0284] The above is an illustrative scheme of a question-answering device according to this embodiment. It should be noted that the technical solution of this question-answering device is similar to that described above. Figure 1 The technical solutions for the problem-solving methods shown belong to the same concept. For details not described in the technical solution of the problem-solving device, please refer to the above. Figure 1 A description of the technical solution for the problem-solving method shown.

[0285] Corresponding to the above method embodiments, this specification also provides embodiments of a problem-solving device. Figure 7 A schematic diagram of another problem-solving device provided in one embodiment of this specification is shown. For example... Figure 7 As shown, the device includes:

[0286] The third obtaining module 702 is configured to input the encoded information of the question to be answered into the encoder of the question answering model to obtain the semantic vector corresponding to the encoded information. The question to be answered includes at least one missing position.

[0287] The fourth module 704 is configured to decode the semantic vector through the decoder of the question-answering model to obtain the i-th answer character of the question to be answered;

[0288] Execution module 706 is configured to concatenate the i-th answer character after the encoding information to obtain the updated encoding information, increment i by 1, and return to execute the third obtaining module 702 until the last answer character of the question to be solved is obtained, thus obtaining the answer corresponding to at least one empty position of the question to be solved.

[0289] Optionally, the device further includes a second acquisition module configured to:

[0290] Get the questions to be answered;

[0291] The question to be answered is broken down into word units, and a start position marker word unit is added before the first word unit and an end position marker word unit is added after the last word unit;

[0292] Each word unit is used as encoded information.

[0293] Optionally, the second acquisition module is further configured as follows:

[0294] Extract the numerical values ​​included in the question to be answered;

[0295] Based on the preset mapping rules, a corresponding first preset character is set for each value, and a value mapping list for the question to be answered is constructed.

[0296] Optionally, the preset mapping rule is to number the data sequentially from left to right; the second acquisition module is further configured as follows:

[0297] Arrange the values ​​from left to right according to their order in the questions to be answered;

[0298] Set the corresponding first preset character for each of the numerical values ​​in turn;

[0299] Each value and its corresponding first preset character are stored to construct a value mapping list for the question to be answered.

[0300] Optionally, each obtained answer character includes a preset separator;

[0301] The device also includes a parsing module, configured as follows:

[0302] Based on the preset separators in each of the obtained answer characters, determine the answer corresponding to at least one missing position in the question to be answered;

[0303] Determine whether there exists a first answer containing a first preset character in the answer corresponding to at least one empty position;

[0304] If a first answer exists, then determine the target value corresponding to the first preset character according to the numerical mapping list;

[0305] Substitute the target value into the first preset character of the first answer, and parse to obtain the correct answer corresponding to at least one missing position of the question to be solved.

[0306] Optionally, the device further includes a second training module configured to:

[0307] Obtain the third training sample, which carries sample labels;

[0308] Input the third training sample and sample label into the question-answering model to obtain the predicted answer of the third training sample;

[0309] Based on the predicted answer and sample labels, calculate the loss value of the question-answering model, train the question-answering model based on the loss value, and return to execute the operation step of obtaining the third training sample until the training stopping condition is met.

[0310] Optionally, the second training module is further configured as follows:

[0311] The first i sample characters in the sample label are concatenated into the third training sample to obtain the sample encoding information, where i is a natural number;

[0312] Input the sample encoding information into the encoder of the question-answering model to obtain the sample semantic vector corresponding to the sample encoding information;

[0313] The decoder of the question-answering model decodes the semantic vector of the sample to obtain the (i+1)th reference sample character of the third training sample. Then, i is incremented by 1, and the process is returned to concatenate the first i sample characters in the sample label to the third training sample to obtain the sample encoding information, until the last reference sample character of the third training sample is obtained.

[0314] Based on the preset spacers in the characters of each obtained reference sample, the predicted answer for the third training sample is determined.

[0315] The problem-solving device provided in this specification allows inputting the encoded information of the problem to be solved into a problem-solving model. This model outputs the answer corresponding to at least one missing position in the problem. By utilizing the problem-solving model, the device better understands the contextual semantics of the problem and obtains the answers to all sub-problems at once. Furthermore, after obtaining each answer character, it can be concatenated to the current encoded information. The next answer character is determined by the concatenated encoded information. The answer character to be output at time t can be determined by considering the problem to be solved and the answer characters output at time t-1, significantly improving the accuracy of the answers to the problem. Thus, based on a pre-trained problem-solving model, the correct answers to the problem can be automatically, efficiently, and accurately analyzed. By applying deep learning methods to the problem-solving process, high-precision automatic problem-solving is achieved, greatly improving the efficiency and accuracy of problem-solving.

[0316] The above is an illustrative scheme of a question-answering device according to this embodiment. It should be noted that the technical solution of this question-answering device is similar to that described above. Figure 4 The technical solutions for the problem-solving methods shown belong to the same concept. For details not described in the technical solution of the problem-solving device, please refer to the above. Figure 4 A description of the technical solution for the problem-solving method shown.

[0317] Figure 8 A structural block diagram of a computing device 800 according to an embodiment of this specification is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.

[0318] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 840 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) interface, a Wi-MAX interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0319] In one embodiment of this specification, the above-described components of the computing device 800 and Figure 8 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 8 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0320] The computing device 800 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 800 can also be a mobile or stationary server.

[0321] The processor 820 is used to execute the following computer-executable instructions to implement any of the operational steps of the above-mentioned problem-solving method.

[0322] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the problem-solving method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the problem-solving method described above.

[0323] An embodiment of this specification also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, are used to implement any problem-solving method.

[0324] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the problem-solving method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the problem-solving method described above.

[0325] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0326] Computer instructions include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable media can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in computer-readable media can be appropriately added to or removed according to the requirements of legislation and patent practice in a jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.

[0327] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this specification is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this specification. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this specification.

[0328] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0329] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to any specific implementation. Clearly, many modifications and variations can be made based on the content of this specification. These embodiments have been selected and specifically described in this specification to better explain the principles and practical applications of this specification, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.< / sep> < / sep> < / sep> < / sep> < / sep> < / blank> < / blank> < / blank> < / blank> < / blank> < / blank> < / blank> < / blank> < / blank> < / blank> < / blank> < / blank> < / sep> < / sep> < / sep> < / blank> < / blank> < / blank> < / blank> < / blank> < / sep> < / sep> < / blank> < / blank> < / blank> < / blank> < / blank> < / blank> < / sep> < / sep> < / sep> < / sep> < / sep> < / sep> < / blank> < / blank> < / blank> < / sep> < / sep> < / sep> < / sep> < / blank> < / blank> < / blank> < / blank> < / blank>

Claims

1. A problem-solving method, characterized in that, include: Obtain the question to be answered, extract the values ​​included in the question to be answered, arrange the values ​​from left to right according to their order in the question to be answered, set a corresponding first preset character for each value, store the values ​​and the corresponding first preset characters accordingly, and construct a value mapping list for the question to be answered, wherein the question to be answered includes at least two empty positions. The numerical value in the question to be answered is replaced with the corresponding first preset character. The replaced question to be answered is then input into the encoder of the question answering model to obtain the semantic vector corresponding to the question to be answered. The semantic vector is decoded using the decoder of the question-answering model to obtain the answers corresponding to at least two missing positions of the question to be answered. It is determined whether there is a target answer that includes the first preset character among the answers corresponding to the at least two missing positions. If the target answer exists, the target value corresponding to the first preset character is determined according to the numerical mapping list. The target value is then substituted into the first preset character of the target answer to obtain the correct answer to the question to be answered.

2. The problem-solving method according to claim 1, characterized in that, The encoder includes an embedding layer and a semantic information analysis layer; The step of inputting the question to be answered into the encoder of the question-answering model to obtain the semantic vector corresponding to the question to be answered includes: The question to be answered is broken down into word units, and a start position marker word unit is added before the first word unit, and an end position marker word unit is added after the last word unit; Each of the word units is input into the embedding layer for embedding processing to obtain the encoding matrix corresponding to each word unit; The encoding matrix is ​​input into the semantic information analysis layer to obtain the semantic vector corresponding to each word unit.

3. The problem-solving method according to claim 2, characterized in that, After obtaining the semantic vector corresponding to each of the word units, the method further includes: Determine the target semantic vector corresponding to the word unit at the starting position in the semantic vector corresponding to each of the aforementioned word units; The state parameters of the decoder are initialized based on the target semantic vector.

4. The problem-solving method according to claim 1, characterized in that, The decoder includes a decoding dictionary; The step of decoding the semantic vector using the decoder of the question-answering model to obtain the answers corresponding to at least two missing positions of the question to be answered includes: The semantic vector is input into the decoder; Using the decoding dictionary, decode the output answer at the first missing position of the question to be answered; If the end symbol is not decoded, a preset spacer is generated after the output answer, and the output answer at the next empty position of the question to be solved is decoded until the end symbol is decoded, so as to obtain the answers corresponding to at least two empty positions of the question to be solved.

5. The problem-solving method according to claim 1, characterized in that, After obtaining the question to be answered, the process also includes: Identify at least two missing positions in the question to be answered; Replace the at least two empty positions with a second preset character.

6. The problem-solving method according to claim 1, characterized in that, The question-answering model was trained using the following method: Obtain a first training sample, and according to a preset mapping rule, replace the numerical values ​​in the first training sample with the corresponding first preset characters to obtain a second training sample. The first training sample carries a sample label. Input the second training sample into the question-answering model to obtain the predicted answer; Based on the predicted answer and sample label, calculate the loss value of the question-answering model, train the question-answering model based on the loss value, and return to execute the operation step of obtaining the first training sample until the training stopping condition is reached.

7. The problem-solving method according to claim 6, characterized in that, The process of obtaining the first training sample includes: Obtain the first training sample and at least two answers corresponding to the first training sample; A preset separator is set between every two adjacent answers of the at least two answers to construct the sample label of the first training sample.

8. A method for answering a problem, characterized in that, include: The process involves: acquiring a question to be answered; extracting the numerical values ​​included in the question; arranging the numerical values ​​from left to right according to their order in the question; assigning a corresponding first preset character to each numerical value; storing the numerical values ​​and their corresponding first preset characters to construct a numerical mapping list for the question to be answered; splitting the question into word units; adding a start position identifier word unit before the first word unit and an end position identifier word unit after the last word unit; using each word unit as encoding information; inputting the encoding information of the question to be answered into the encoder of the question-answering model to obtain the semantic vector corresponding to the encoding information; and ensuring that the question to be answered includes at least one missing position. The semantic vector is decoded using the decoder of the question-answering model to obtain the i-th answer character of the question to be answered; The i-th answer character is concatenated after the encoded information to obtain the updated encoded information. i is incremented by 1, and the operation step of inputting the encoded information into the encoder of the question-answering model is returned until the last answer character of the question to be answered is obtained, thus obtaining the answer corresponding to at least one missing position of the question to be answered.

9. The problem-solving method according to claim 8, characterized in that, The obtained answer characters include preset separators; After obtaining the last answer character of the question to be solved, the process also includes: Based on the preset separators in each of the obtained answer characters, determine the answer corresponding to at least one missing position of the question to be answered; Determine whether there is a first answer that includes the first preset character among the answers corresponding to the at least one empty position; If the first answer exists, then the target value corresponding to the first preset character is determined according to the numerical mapping list; Substitute the target value into the first preset character of the first answer, and parse to obtain the correct answer corresponding to at least one missing position of the question to be solved.

10. The problem-solving method according to claim 8, characterized in that, The question-answering model was trained using the following method: Obtain a third training sample, wherein the third training sample carries a sample label; The third training sample and the sample label are input into the question-answering model to obtain the predicted answer of the third training sample; Based on the predicted answer and sample labels, calculate the loss value of the question-answering model, train the question-answering model based on the loss value, and return to execute the operation step of obtaining the third training sample until the training stopping condition is met.

11. The problem-solving method according to claim 10, characterized in that, The step of inputting the third training sample and the sample label into the question-answering model to obtain the predicted answer includes: The first i sample characters in the sample label are concatenated to the third training sample to obtain the sample encoding information, where i is a natural number; The sample encoding information is input into the encoder of the question-answering model to obtain the sample semantic vector corresponding to the sample encoding information; The decoder of the question-answering model decodes the semantic vector of the sample to obtain the (i+1)th reference sample character of the third training sample. Then, i is incremented by 1, and the process is repeated to concatenate the first i sample characters in the sample label to the third training sample to obtain the sample encoding information, until the last reference sample character of the third training sample is obtained. The predicted answer for the third training sample is determined based on the preset spacer characters in each of the obtained reference sample characters.

12. A problem-solving device, characterized in that, include: The first acquisition module is configured to acquire the question to be answered, extract the values ​​included in the question to be answered, arrange the values ​​from left to right in the order of the question to be answered, set a corresponding first preset character for each value, store the values ​​and the corresponding first preset character, and construct a value mapping list for the question to be answered, wherein the question to be answered includes at least two empty positions. The first obtaining module is configured to replace the numerical value in the question to be answered with the corresponding first preset character, input the replaced question to be answered into the encoder of the question answering model, and obtain the semantic vector corresponding to the question to be answered. The second obtaining module is configured to decode the semantic vector through the decoder of the question-answering model to obtain the answers corresponding to at least two missing positions of the question to be answered, determine whether there is a target answer including the first preset character among the answers corresponding to the at least two missing positions, and if the target answer exists, determine the target value corresponding to the first preset character according to the numerical mapping list, substitute the target value into the first preset character of the target answer, and parse to obtain the correct answer to the question to be answered.

13. A question-answering device, characterized in that, include: The third acquisition module is configured to acquire the question to be answered, extract the values ​​included in the question to be answered, arrange the values ​​from left to right according to their order in the question to be answered, assign a corresponding first preset character to each value, store the values ​​and the corresponding first preset characters accordingly, construct a value mapping list for the question to be answered, split the question to be answered into word units, add a start position identifier word unit before the first word unit and an end position identifier word unit after the last word unit, use each word unit as encoding information, input the encoding information of the question to be answered into the encoder of the question answering model, and obtain the semantic vector corresponding to the encoding information. The question to be answered includes at least one missing position. The fourth obtaining module is configured to decode the semantic vector through the decoder of the question-answering model to obtain the i-th answer character of the question to be answered; The execution module is configured to concatenate the i-th answer character after the encoded information to obtain the updated encoded information, increment i by 1, and return to execute the operation steps of inputting the encoded information into the encoder of the question-answering model until the last answer character of the question to be answered is obtained, thereby obtaining the answer corresponding to at least one missing position of the question to be answered.

14. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the operation steps of the problem-solving method according to any one of claims 1-7 or 8-11.

15. A computer-readable storage medium storing computer instructions that, when executed by a processor, implement the operational steps of the problem-solving method according to any one of claims 1-7 or 8-11.

Citation Information

Patent Citations

  • Method, device and terminal device for solving grammatical fill-in problem based on neural network

    CN109086273A

  • Training method and device of problem solving model and problem solving method and device

    CN111783423A