Intelligent question answering method, computer device and storage medium based on pre-training model
By determining the similarity between user questions and basic questions in the intelligent question-answer system, and using the combination of manual processing and pre-trained models, the questions in intelligent question-answer are solved that answers too broadly and fabricated answers are achieved, and more accurate and professional answers are achieved.
Patent Information
- Application Number
- CN202410763356.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-06-13
AI Technical Summary
The existing large-scale pre-trained models have too broad and ordinary answers in intelligent Q&A, and are easy to fabricate answers, resulting in the phenomenon of "abnormal answers".
By determining the similarity between user questions and the preset basic problem database, if the similarity is lower than the preset value, send the question to the manual processing terminal to obtain the basic problem configuration information, convert it into a database question and answer statement, and enter the pretrained model To get answers, ensure the accuracy and professionalism of the answers.
It improves the accuracy of intelligent questions and answers, reduces the situation of model fabricating answers, and ensures the professionalism and accuracy of the answers.
Smart Images

Figure CN118332095B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to an intelligent question-answering method, a computer device and a storage medium based on a pre-training model. Background Art
[0002] Large-scale pre-trained models (intelligent question-answering models) are currently the hottest AI technology. Its emergence makes many scenarios possible.
[0003] At present, the existing general large models usually have the following technical problems when providing intelligent answers: the answers are too broad and general, not professional enough; when asked specific questions, they will fabricate answers and give "abnormal answers". Summary of the invention
[0004] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.
[0005] Some embodiments of the present disclosure propose an intelligent question-answering method, a computer device, and a computer-readable storage medium based on a pre-trained model to solve the technical problems mentioned in the above background technology section.
[0006] In a first aspect, some embodiments of the present disclosure provide an intelligent question-answering method based on a pre-trained model, the method comprising: in response to receiving a user question about a target product raised by a user, determining the question similarity between each basic question in a preset basic question library and the user question; in response to determining that the question similarity is less than or equal to the preset similarity, sending the user question to an associated manual processing terminal to receive basic question configuration information corresponding to the user question sent by the manual processing terminal; generating model question prompt information based on the basic question configuration information and the user question, wherein the model question prompt information indicates converting the basic question configuration information and the user question into a database question-answering statement; inputting the model question prompt information into a pre-trained intelligent question-answering model to obtain a corresponding database statement; inputting the database statement into an associated database for execution; in response to determining that the database statement is executed normally, combining the database query result corresponding to the database statement with the user question into question information, and sending the question information to the intelligent question-answering model to obtain question answer information; and sending the question answer information to the user terminal of the user.
[0007] In a second aspect, the present disclosure further provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the method described in any implementation of the first aspect is implemented.
[0008] In a third aspect, the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the method described in any implementation manner of the first aspect is implemented.
[0009] The above-mentioned embodiments of the present disclosure have the following beneficial effects: the accuracy of large-model intelligent question and answer is improved, and the occurrence of model fabricated answers is reduced. First, in response to receiving a user question about a target product raised by a user, the problem similarity between each basic question in a preset basic question library and the above-mentioned user question is determined. Thus, it can be determined whether the user question is a professional question scenario to ensure the professionalism of the answer. Secondly, in response to determining that the above-mentioned question similarity is less than or equal to the preset similarity, the above-mentioned user question is sent to the associated manual processing terminal to receive the basic question configuration information corresponding to the above-mentioned user question sent by the above-mentioned manual processing terminal. Thus, when there is no similar user question in the basic question library, the user question configuration is performed manually to ensure that the intelligent question and answer model can accurately reply. Then, according to the above-mentioned basic question configuration information and the above-mentioned user question, a model question prompt information is generated, wherein the above-mentioned model question prompt information indicates that the above-mentioned basic question configuration information and the above-mentioned user question are converted into a database question and answer statement; the above-mentioned model question prompt information is input into the pre-trained intelligent question and answer model to obtain the corresponding database statement. Thus, the question can be converted into a standard database statement, which is convenient for the intelligent question and answer model to answer. Then, the above database statement is input into the associated database for execution. Thus, it can be determined whether the database statement replied by the intelligent question and answer model is correct. Afterwards, in response to determining that the above database statement is executed normally, the database query result corresponding to the above database statement is combined with the above user question into question information, and the above question information is sent to the above intelligent question and answer model to obtain question answer information. Finally, the above question answer information is sent to the user terminal of the above user. Thus, the accuracy of the large model intelligent question and answer is improved, and the occurrence of the model fabricating answers is reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The above and other features, advantages and aspects of the embodiments of the present invention will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar figure labels represent the same or similar elements. It should be understood that the drawings are schematic and that the components and elements are not necessarily drawn to scale.
[0011] Figure 1 is a flowchart of some embodiments of the intelligent question-answering method based on the pre-training model according to the present disclosure;
[0012] Figure 2 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION
[0013] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0014] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.
[0015] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0016] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0017] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0018] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.
[0019] Figure 1 1 is a flowchart of some embodiments of the intelligent question-answering method based on a pre-trained model according to the present disclosure. 100 of some embodiments of the intelligent question-answering method based on a pre-trained model according to the present disclosure is shown. The intelligent question-answering method based on a pre-trained model comprises the following steps:
[0020] Step 101, in response to receiving a user question about a target product raised by a user, determining the question similarity between each basic question in a preset basic question library and the user question.
[0021] In some embodiments, the execution subject (e.g., a computer) of the intelligent question-answering method based on the pre-trained model can determine the problem similarity between each basic question in the preset basic question library and the above-mentioned user question in response to receiving a user question about the target product raised by the user. The target product may refer to a certain product brand. For example, a product that has been on the shelves for a week. The user question may be a question raised about the target product. For example, the user question may be: "What is the maximum number of views of the xxx product on a certain reading platform?" The basic question library may be a plurality of basic questions configured based on a survey of users, and each basic question represents a problem scenario. Each basic question is associated with a configuration information, which includes the table name of the database that this question may involve. The data structure of the answer to each basic question is fixed, and a data visualization program is associated with the basic question, which is displayed as a list, pie chart, bar chart, line chart, etc.
[0022] For example, a base question bank could be:
[0023] Basic question 1: What is the brand 1’s voice, interaction volume, number of posts, and industry ranking in the past N days? Users expect factual numbers and text descriptions.
[0024] Basic question 2: What are the top 3 key communication contents of brand 1 in the past N days? Users expect a list of the hottest blog posts, notes or short videos on social media.
[0025] Basic question 3: Gender distribution of the interactive population of brand 1 in the past N days. What users expect is the percentage of users, pie chart.
[0026] Basic question 4: What are the user pain points and selling points that Brand 1 has focused on in the past N days? Users expect to extract the key touch points of users from past articles.
[0027] In an actual application scenario, the execution entity may determine the similarity between each basic question in the preset basic question library and the user question through the following steps:
[0028] First, the above basic questions are segmented according to the pre-divided word type groups to obtain the basic word sequence. The word type groups can be various word types divided according to the word type, which can include: brand words, feature words, auxiliary words (ingredients, selling points, efficacy), tag words (volume, interaction volume, number of comments), effects, function words, etc.
[0029] Second, the user questions are segmented according to the word type groups to obtain user word sequences.
[0030] For example, the word segmentation result of basic question A can be "{a_1, a_2, ..., a_m}"; the word segmentation result of user question B can be "{b_1, b_2, ..., b_n}". Words a_i and b_j both have a word vector v(a_i) and v(b_j).
[0031] Third, according to the word weight corresponding to each word type in the above word type group, generate the weighted basic word vector corresponding to the above basic word sequence and the weighted user word vector corresponding to the above user word sequence. Define a word weight function w(c), where c is a word. For example:
[0032] w(c)=0.5 / / If c is a brand word, auxiliary word, or function word
[0033] w(c)=2.0 / / If c is an indicator word (volume, interaction volume, number of comments, etc.) or a feature word (ingredient, selling point, efficacy);
[0034] w(c)=1.0 / / Other cases.
[0035] That is, a word weight is preset for each word type.
[0036] The weighted basic word vector corresponding to the basic word sequence can be expressed as:
[0037] V(A)=1 / m∑_{i=1}^{m}w(a_i)×v(a_i);
[0038] The weighted user word vector corresponding to the user word sequence can be expressed as:
[0039] V(B)=1 / n∑_{j=1}^{n}w(b_j)×v(b_j).
[0040] Fourth, the similarity between the weighted basic word vector and the weighted user word vector is determined as the question similarity. For example, the similarity between the weighted basic word vector and the weighted user word vector can be determined by a cosine similarity formula.
[0041] For another example, the similarity between the weighted basic word vector and the weighted user word vector may be: similarity(A,B)=V(A)•V(B) / (||V(A)||.||V(B)||);
[0042] Here, dot product represents the dot product of two vectors, and ||.|| represents the L2 norm of the vector.
[0043] Therefore, the words are classified and different weights are set, so that the model can identify key words.
[0044] Step 102, in response to determining that the question similarity is less than or equal to a preset similarity, sending the user question to an associated manual processing terminal to receive basic question configuration information corresponding to the user question sent by the manual processing terminal.
[0045] In some embodiments, the execution entity may, in response to determining that the similarity of the above-mentioned question is less than or equal to the preset similarity, send the above-mentioned user question to the associated manual processing terminal to receive the basic question configuration information corresponding to the above-mentioned user question sent by the manual processing terminal. Among them, the numerical value of the preset similarity can be set according to actual needs. The manual processing terminal may be a terminal for manually processing new user questions (user questions for which there are no similar basic questions). The basic question configuration information may refer to the configured database table name and table structure, as well as constraint information. For example, the constraint information is a mandatory constraint condition configured according to the basic question, which is some constraints on the database conditions.
[0046] For example, to determine the preset similarity, the following formula is used:
[0047] F1-score=2×(precision×recall) / (precision+recall);
[0048] Among them, precision=True Positives / (True Positives+False Positives);
[0049] recall=True Positives / (True Positives+False Negatives);
[0050] The program traverses all thresholds to maximize the F1 score and find the best preset similarity (0.89392783). This threshold is recalculated every time the basic question library and user question training set are expanded.
[0051] For example, the constraint information can be:
[0052] quarter: When matching "quarter|Q1|Q2|Q3|Q4", the prompt is "quarter: the calculation field count requires sum". When matching any content, the prompt is "the calculation field count requires sum". When matching "number of posts", the prompt is "the number of posts is equivalent to volume".
[0053] Marketing: When matching "marketing [action|activity]", the prompt is "marketing action is equivalent to popular content". When matching "delivery", the prompt is "delivery is equivalent to popular content". For other matches, the prompt is "Required condition for sorting by interaction volume: user_type=3".
[0054] region: When matching "region|city|province|province|place|place", the prompt is a series of information about the region. When matching "province", the prompt is "only province\province:province NOT IN ('','Overseas','Other')". When matching "region|city|province|province", the prompt content is generated by a function that generates a specific prompt based on the query content. When matching "age", the prompt is "Required field: age<>null".
[0055] top5: For any match, the prompt is "Default top5, default sorting by interaction volume".
[0056] term: For any match, the hint is generated by a function that generates a specific hint based on the query and the term type. When matching "term_all", the hint is generated by another function that generates a hint based only on the term type.
[0057] official: When matching "official", the prompt is "Please select fields with the prefix 'official_user'".
[0058] official_voice: When matching "official", the prompt is "Required conditions: user_type=2and official_user=1".
[0059] Topic: When matching "campaign|topic", the prompt is "The condition of brand_ids uses the find_in_set function, and you must select *. The default sorting is by interaction volume."
[0060] Step 103: Generate model question prompt information according to the basic question configuration information and the user question.
[0061] In some embodiments, the execution subject may generate model question prompt information based on the basic question configuration information and the user question. The model question prompt information indicates converting the basic question configuration information and the user question into a database question and answer statement. For example, the basic question configuration information may be combined with the user question and the preset database statement question information to obtain the model question prompt information. For example, the database statement question information may be "What is the SQL statement (Structured Query Language)?" The model question prompt information may be "The database table name is: xxx, the table structure is xxx, convert the user question xxxx into a SQL statement, what is the SQL statement?".
[0062] Step 104, input the above model question prompt information into the pre-trained intelligent question answering model to obtain the corresponding database statement.
[0063] In some embodiments, the above-mentioned execution subject can input the above-mentioned model question prompt information into a pre-trained intelligent question and answer model to obtain a corresponding database statement. The intelligent question and answer model can be a pre-trained neural network model that intelligently replies to user questions. For example, the intelligent question and answer model can be a BERT-based semantic model, an SBERT (SentenceEmbeddings using Siamese BERT) model, or a GPT pre-trained model. For example, by inputting the model question prompt information into a pre-trained intelligent question and answer model, a database statement for the user's question that is replied by the intelligent question and answer model can be obtained.
[0064] For example, suppose the user question is: Brand x "queries all users older than 30" on the XX platform, the database table is named "users", and the table structure contains the fields "id", "name", and "age".
[0065] The model question prompt information can be: "The database table name is: users, the table structure is id, name, age, convert the question 'Query all users older than 30' into an SQL statement, what is the SQL statement?"
[0066] The intelligent question answering model may return a SQL statement similar to the following:
[0067] "SELECT * FROM users WHERE age>30;".
[0068] Furthermore, the intelligent question answering model can be trained through the following steps:
[0069] First, obtain a set of product question sample groups. Each product question sample group corresponds to a scenario type. The scenario type may represent a pre-set problem scenario type. The product question sample may refer to a sample of questions raised by users regarding a certain product brand. For example, the product questions included in the product question sample may be: What is the brand 1's voice, interaction volume, number of posts, and industry ranking in the past N days.
[0070] Second, determine the initial intelligent question and answer model. The initial intelligent question and answer model includes an initial intelligent question and answer network group, and one initial intelligent question and answer network corresponds to one scenario type. The initial intelligent question and answer model can be an untrained neural network model for intelligently replying to user questions. For example, the intelligent question and answer model can be a BERT-based semantic model, an SBERT (Sentence Embeddings using Siamese BERT) model, or a GPT pre-trained model. The initial intelligent question and answer network can be an untrained neural network model for intelligently replying to user questions.
[0071] Third, for each product problem sample group in the above product problem sample group set, perform the following processing steps:
[0072] 1. Determine the initial intelligent question-answering network corresponding to the above product question sample group. That is, determine the initial intelligent question-answering network corresponding to the question scenario type corresponding to the above product question sample group.
[0073] 2. Select a target product problem sample from the above product problem sample group. A product problem sample can be randomly selected from the above product problem sample group as the target product problem sample.
[0074] 3. Input the product questions included in the above target product question sample into the above initial intelligent question answering network to obtain the initial intelligent question answering results.
[0075] 4. Determine the loss value between the initial intelligent question and answer result and the corresponding sample label. The loss value between the initial intelligent question and answer result and the corresponding sample label can be determined by a preset loss function. For example, the preset loss function can be a cross entropy loss function or a hinge loss function.
[0076] 5. In response to determining that the loss value is less than or equal to a preset loss value, the initial intelligent question-answering network is determined as a trained intelligent question-answering network.
[0077] Fourth, the determined intelligent question-answering networks are integrated into an intelligent question-answering model.
[0078] Therefore, the intelligent question answering network can be set according to different question scenario types, thereby improving the robustness of the intelligent question answering model.
[0079] Step 105: input the above database statement into the associated database for execution.
[0080] In some embodiments, the execution subject may input the database statement into an associated database for execution. The associated database may be a local database or a database pre-set for executing the question statement.
[0081] In an actual application scenario, the execution subject may input the database statement into the associated database for execution through the following steps:
[0082] First, the above database statements are input into the associated database for execution, the statement execution results are obtained, and the execution times are recorded.
[0083] Second, in response to determining that the execution result of the above statement indicates an execution error, determine whether the number of executions is greater than or equal to a preset number.
[0084] Third, in response to determining that the number of executions is less than the preset number, the model problem prompt information and the statement execution result are combined into new model problem prompt information. The statement execution result is now error execution information.
[0085] Fourth, the model question prompt information is input into the above-mentioned intelligent question and answer model to obtain the corresponding database statement, and the database statement is input into the above-mentioned database for execution.
[0086] For example, the table structure, SQL statement and error execution information are combined into a new model problem prompt information.
[0087] Use this model question prompt information to query the intelligent question answering model to correct the SQL statement.
[0088] Repeat the above steps until the correct SQL is obtained or the number of attempts exceeds a predetermined number (for example, 3 times).
[0089] Example: Assume that the SQL statement returned by the intelligent question answering model is incorrect, for example:
[0090] "SELECT*FORM users WHERE age>30;".
[0091] Executing this statement will result in an error because "FORM" is a typo. The error message may be "Syntaxerror: Unexpected 'FORM'".
[0092] The new intelligent question-answering model may look like this:
[0093] "The database table name is: users, the table structure is id, name, age, the SQL statement 'SELECT *FORM usersWHERE age>30;' failed to execute, the error message is 'Syntax error: Unexpected 'FORM'.' Please correct the SQL statement, what is the correct SQL?"
[0094] In this way, the intelligent question answering model may correct its mistakes and return:
[0095] "SELECT*FROM users WHERE age>30;".
[0096] Thus, this self-correcting process leverages the ability of the large model to understand and fix errors in SQL statements. However, if the model still returns incorrect SQL after multiple attempts, human intervention may be required. This approach effectively leverages the ability of the large model while ensuring the accuracy of the generated SQL statements.
[0097] Fifth, in response to determining that the number of executions is greater than or equal to the preset number of times, the above-mentioned model problem prompt information and the statement execution result are sent to the manual processing terminal.
[0098] Step 106, in response to determining that the above-mentioned database statement is executed normally, the database query result corresponding to the above-mentioned database statement is combined with the above-mentioned user question into question information, and the above-mentioned question information is sent to the above-mentioned intelligent question and answer model to obtain question answer information.
[0099] In some embodiments, the execution entity may, in response to determining that the database statement is executed normally, combine the database query result corresponding to the database statement with the user question into question information, and send the question information to the intelligent question and answer model to obtain question answer information.
[0100] In an actual application scenario, the execution subject can send the question information to the intelligent question-answering model through the following steps to obtain the question answer information:
[0101] First, the question information is sent to the intelligent question answering model to obtain an intelligent question answering result, which may be a reply to the question information.
[0102] Second, in response to determining that the above-mentioned intelligent question and answer result represents a target type text, the above-mentioned intelligent question and answer result is subjected to word segmentation processing to generate an intelligent question and answer word sequence. The target type text may refer to a result text whose byte length is greater than or equal to a preset byte length. The word segmentation processing may be to perform Chinese word segmentation processing on the above-mentioned intelligent question and answer result according to the word type group to generate an intelligent question and answer word sequence.
[0103] For example, the intelligent question answering word sequence can be: {x0, x1, ..., xn}; where xi represents a token in {x0, x1, ..., xn}.
[0104] Third, determine the self-information value of each intelligent question and answer word in the above intelligent question and answer word sequence.
[0105] For example, the intelligent question answering model is used to calculate the log probability of the intelligent question answering words. Then, the negative value is taken to obtain the self-information value.
[0106] I(x)=−log(P(x)).
[0107] Where: I(x): self-information of intelligent question answering word x; P(x): probability of intelligent question answering word x in the intelligent question answering model. P(x) can refer to log probability.
[0108] It should be noted that the logprobs parameter is pre-set in the smart question answering model. The default value is empty, and N (1~5) must be set here. N represents the N smart question answering words with the highest probability. token_logprobs is the log probability of the smart question answering words.
[0109] Fourth, the intelligent question and answer words whose self-information values are less than or equal to a preset threshold value in the above intelligent question and answer word sequence are removed to update the intelligent question and answer word sequence, and the updated intelligent question and answer word sequence is used as question and answer information.
[0110] Thus, the redundant information can be deleted, making the question and answer information more concise, thereby reducing the waste of communication resources.
[0111] Step 107: Send the question answer information to the user terminal of the user.
[0112] In some embodiments, the execution entity may send the question-answer information to the user terminal of the user. For example, for the chart type that should be used for display that matches the basic question, the chart is rendered on the server side after the data is obtained, and the data itself is sent to the big model, so that the intelligent question-answering model can interpret the data. Then, the interpretation and the chart are combined and returned to the user. According to the type of basic question, the data executed by SQL is encapsulated into a display form suitable for reading. For example, pie charts, line charts, etc.
[0113] Further, in response to receiving feedback information submitted by the user regarding the question answer information, it is determined whether the feedback information meets the adjustment condition.
[0114] In some embodiments, the execution entity may determine whether the feedback information submitted by the user for the question answer information meets the adjustment condition in response to receiving the feedback information. The feedback information may indicate satisfactory or unsatisfactory information. The adjustment condition may be: the feedback information indicates unsatisfactory.
[0115] Further, in response to determining that the feedback information meets the adjustment conditions, the database statement and the question and answer information are corrected to obtain corrected database statement and question and answer information.
[0116] In some embodiments, the execution subject may correct the database statement and the question and answer information in response to determining that the feedback information meets the adjustment conditions, and obtain a corrected database statement and corrected question and answer information. For example, the database statement and the question and answer information may be sent to a manual processing terminal for correction processing. Thus, the corrected database statement and corrected question and answer information sent by the manual processing terminal are received.
[0117] Furthermore, the corrected database statements and the corrected question and answer information are used as data labels, and the data labels are combined with the user questions as model fine-tuning samples.
[0118] In some embodiments, the execution entity may use the corrected database statements and the question-answer information as data labels, and combine the data labels with the user questions as model fine-tuning samples.
[0119] Furthermore, the above model fine-tuning samples are added to the current model fine-tuning sample set, and the above intelligent question and answer model is fine-tuned and trained.
[0120] In some embodiments, the execution entity may add the model fine-tuning samples to the current model fine-tuning sample set, and perform fine-tuning training on the intelligent question-answering model.
[0121] For example, use the data collected and labeled in the above steps to build a fine-tuning dataset (model fine-tuning sample set). This dataset should include:
[0122] Question - original answer from the model - manually corrected answer or SQL - annotation information;
[0123] For example, a dataset might have the following structure:
[0124] Question: "Query all users whose age is greater than 30";
[0125] Model answer: "SELECT * FORM users WHERE age>30";
[0126] Manual correction: "SELECT*FROM users WHERE age>30;";
[0127] Annotation: Error.
[0128] Among them, fine-tuning the above intelligent question answering model may include:
[0129] Fine-tune the model using the fine-tuning dataset above. Perform additional training iterations on the fine-tuning dataset using a smaller learning rate.
[0130] θnew=θold−η∇L(θold);
[0131] θnew is the fine-tuned model parameter;
[0132] θold is the model parameter before fine-tuning;
[0133] ∇L(θold) is the gradient of the loss calculated on the fine-tuning dataset.
[0134] For another example, the fine-tuning step may include:
[0135] 1. Data preparation: Get the data set.
[0136] Data preprocessing: word segmentation and conversion into a format acceptable to the model.
[0137] 2. Load pre-trained model: Load the pre-trained intelligent question-answering model from Hugging Face's model library.
[0138] 3. Model fine-tuning: define a head suitable for the task (for example, a linear layer for classification tasks); set training parameters (such as learning rate, batch size, number of training rounds); and perform training.
[0139] 4. Evaluate and save: Evaluate model performance on the validation set; save the trained model.
[0140] Therefore, the continuous expansion of problem scenarios (in the marketing field) and continuous fine-tuning of the big model will enable the big model to answer marketing questions better, forming a positive feedback loop of use -> accumulation -> fine-tuning -> improvement -> use.
[0141] Figure 2 A schematic block diagram of the structure of a computer device provided in an embodiment of the present disclosure. The computer device may be a terminal.
[0142] like Figure 2 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0143] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any intelligent question-answering method based on a pre-trained model.
[0144] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0145] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any intelligent question-answering method based on the pre-trained model.
[0146] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 2 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present disclosure, and does not constitute a limitation on the computer device to which the scheme of the present disclosure is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0147] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0148] In one embodiment, the processor is used to run a computer program stored in a memory to implement the following steps: in response to receiving a user question about a target product raised by a user, determining the question similarity between each basic question in a preset basic question library and the user question; in response to determining that the question similarity is less than or equal to the preset similarity, sending the user question to an associated manual processing terminal to receive basic question configuration information corresponding to the user question sent by the manual processing terminal; generating model question prompt information based on the basic question configuration information and the user question, wherein the model question prompt information indicates converting the basic question configuration information and the user question into a database question and answer statement; inputting the model question prompt information into a pre-trained intelligent question and answer model to obtain a corresponding database statement; inputting the database statement into an associated database for execution; in response to determining that the database statement is executed normally, combining the database query result corresponding to the database statement with the user question into question information, and sending the question information to the intelligent question and answer model to obtain question answer information; sending the question answer information to the user terminal of the user.
[0149] An embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the various embodiments of the intelligent question-answering method based on the pre-trained model of the present disclosure.
[0150] The computer-readable storage medium may be an internal storage unit of the computer device in the aforementioned embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMediaCard, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., provided on the computer device.
[0151] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0152] The serial numbers of the embodiments of the present disclosure are only for description and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present disclosure, and these modifications or replacements should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be based on the protection scope of the claims.
Claims
1. An intelligent question answering method based on a pre-trained model, the method comprising: In response to receiving a user question about a target product raised by a user, determining a question similarity between each basic question in a preset basic question library and the user question; In response to determining that the question similarity is less than or equal to a preset similarity, sending the user question to an associated manual processing terminal to receive basic question configuration information corresponding to the user question sent by the manual processing terminal; Generate model question prompt information according to the basic question configuration information and the user question, wherein the model question prompt information indicates converting the basic question configuration information and the user question into a database question-answering statement; Obtain a set of product problem sample groups, where each product problem sample group corresponds to a scenario type; Determine an initial intelligent question answering model, wherein the initial intelligent question answering model includes an initial intelligent question answering network group, and one initial intelligent question answering network corresponds to one scenario type; For each product problem sample group in the product problem sample group set, the following processing steps are performed: Determine an initial intelligent question-answering network corresponding to the product question sample group; Selecting a target product problem sample from the product problem sample group; Inputting the product questions included in the target product question sample into the initial intelligent question answering network to obtain an initial intelligent question answering result; Determine the loss value between the initial intelligent question answering result and the corresponding sample label; In response to determining that the loss value is less than or equal to a preset loss value, determining the initial intelligent question-answering network as a trained intelligent question-answering network; Merging the determined intelligent question answering networks into an intelligent question answering model; Inputting the model question prompt information into the pre-trained intelligent question answering model to obtain the corresponding database statement; Input the database statement into the associated database for execution; In response to determining that the database statement is executed normally, combining the database query result corresponding to the database statement with the user question into question information, and sending the question information to the intelligent question-answering model to obtain question answer information; Sending the question answer information to the user terminal of the user; In response to receiving feedback information submitted by the user regarding the question answer information, determining whether the feedback information meets an adjustment condition; In response to determining that the feedback information meets the adjustment condition, the database statement and the question and answer information are corrected to obtain a corrected database statement and corrected question and answer information; Using the corrected database statements and the corrected question answer information as data labels, and combining the data labels with the user questions as model fine-tuning samples; Add the model fine-tuning sample to the current model fine-tuning sample set, and perform fine-tuning training on the intelligent question-answering model; The step of inputting the database statement into a related database for execution includes: Input the database statement into the associated database for execution, obtain the statement execution result, and record the execution times; In response to determining that the statement execution result indicates an execution error, determining whether the number of executions is greater than or equal to a preset number of times; In response to determining that the number of executions is less than a preset number, combining the model problem prompt information with the statement execution result into new model problem prompt information; Inputting model question prompt information into the intelligent question-answering model to obtain corresponding database statements, and inputting the database statements into the database for execution; In response to determining that the number of executions is greater than or equal to a preset number of times, sending the model problem prompt information and the statement execution result to a manual processing terminal; The step of sending the question information to the intelligent question-answering model to obtain question-answering information includes: Sending the question information to the intelligent question answering model to obtain an intelligent question answering result; In response to determining that the intelligent question and answer result represents a target type of text, performing word segmentation processing on the intelligent question and answer result to generate an intelligent question and answer word sequence; Determining the self-information value of each intelligent question-answering word in the intelligent question-answering word sequence; Removing the intelligent question-answering words whose self-information values are less than or equal to a preset threshold value from the intelligent question-answering word sequence to update the intelligent question-answering word sequence, and using the updated intelligent question-answering word sequence as question answering information; The step of determining the question similarity between each basic question in the preset basic question library and the user question includes: According to the pre-divided word type groups, the basic question is segmented to obtain a basic word sequence; According to the word type group, the user question is segmented to obtain a user word sequence; Generating a weighted basic word vector corresponding to the basic word sequence and a weighted user word vector corresponding to the user word sequence according to the word weight corresponding to each word type in the word type group; The similarity between the weighted basic word vector and the weighted user word vector is determined as the question similarity.
2. A computer device, wherein: The computer device comprises a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein the computer program implements the steps of the method according to claim 1 when executed by the processor.
3. A computer-readable storage medium, wherein: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the method according to claim 1 are implemented.
