Response statement generation method and device, electronic equipment, storage medium and program product
By using the method of question decomposition and sub-question answer prediction, more accurate answer statements are generated, which solves the problem of low accuracy of answer statements in the existing technology and achieves more efficient answer statement generation.
Patent Information
- Application Number
- CN202411237664.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2025-09-26
AI Technical Summary
The accuracy of response sentence generation in the existing technology is not high, mainly due to the complexity and diversity of the questions to be answered.
By decomposing the question to be answered into N sub-questions, and predicting the answers to the first N-1 sub-questions, the Nth sub-question is predicted based on the sub-answer statements of the first N-1 sub-questions, and finally the answer statement for the question to be answered is generated.
Improves the accuracy of response statements by referencing more sub-response statements for sub-questions, ensuring more accurate responses to pending questions.
Smart Images

Figure CN120705255A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device, storage medium and program product for generating a response statement. Background Art
[0002] Artificial Intelligence (AI) is a comprehensive discipline. Pre-trained models in AI can be large or basic models that, after fine-tuning, can be widely applied to downstream tasks across various AI disciplines. AI software technologies primarily encompass computer vision and natural language processing.
[0003] In the related art, the generation of response sentences is achieved by directly predicting the responses to the questions to be answered as a whole. However, due to the complexity and diversity of the questions to be answered, the response sentences obtained by the response prediction are not very accurate. Summary of the Invention
[0004] The embodiments of the present application provide a method for generating a response statement, a training method, device, electronic device, computer-readable storage medium and computer program product for a problem decomposition model, which can effectively improve the accuracy of the response statement.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] This embodiment of the present application provides a method for generating a response statement, including:
[0007] Decompose the question to be answered into N sub-questions;
[0008] Predicting responses to the first N-1 sub-questions to obtain sub-response statements for the first N-1 sub-questions;
[0009] Based on the sub-answer statements of the first N-1 sub-questions, an answer prediction is made for the Nth sub-question to obtain an answer statement for the question to be answered.
[0010] This embodiment of the present application provides a method for training a problem decomposition model, including:
[0011] Obtain a question training sample and M sub-question labels corresponding to the question training sample;
[0012] Calling the large language model to decompose the problem training sample to obtain multiple sub-problem training samples;
[0013] Determining the overall similarity between the M sub-question labels and the plurality of sub-question training samples, and fine-tuning the model parameters of the large language model based on the overall similarity to obtain the question decomposition model;
[0014] The question decomposition model is used to decompose the question to be answered into N sub-questions.
[0015] The present invention provides a device for generating a response statement, including:
[0016] The question decomposition module decomposes the question to be answered into N sub-questions;
[0017] An answer prediction module is used to predict answers to the first N-1 sub-questions and obtain sub-answer statements for the first N-1 sub-questions;
[0018] The determination module is used to predict the answer to the Nth sub-question based on the sub-answer statements of the first N-1 sub-questions to obtain the answer statement of the question to be answered.
[0019] The present invention provides a method for training a problem decomposition model, including:
[0020] An acquisition module is used to acquire a question training sample and M sub-question labels corresponding to the question training sample;
[0021] A question decomposition module is used to call a large language model to decompose the question training sample to obtain multiple sub-question training samples;
[0022] A training module is used to determine the overall similarity between the M sub-question labels and the multiple sub-question training samples, and based on the overall similarity, fine-tune the model parameters of the large language model to obtain the question decomposition model; wherein the question decomposition model is used to decompose the question to be answered into N sub-questions.
[0023] An embodiment of the present application provides an electronic device, including:
[0024] a memory for storing computer-executable instructions or computer programs;
[0025] The processor is used to implement the method for generating a response statement or the method for training a problem decomposition model provided in the embodiment of the present application when executing the computer-executable instructions or computer program stored in the memory.
[0026] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for causing a processor to execute the method for generating a response statement or the method for training a problem decomposition model provided in the embodiment of the present application.
[0027] An embodiment of the present application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the above-mentioned method for generating a response statement or the method for training a question decomposition model in the embodiment of the present application.
[0028] The embodiments of the present application have the following beneficial effects:
[0029] By decomposing the question to be answered into N sub-questions, the answers to the first N-1 sub-questions are predicted to obtain sub-answer statements of the first N-1 sub-questions, and based on the sub-answer statements of the first N-1 sub-questions, the answer to the Nth sub-question is predicted to obtain the answer statement of the question to be answered. Since the answer statement of the question to be answered is predicted based on the sub-answer statements of the first N-1 sub-questions, the prediction of the answer statement refers to the sub-answer statements of the N-1 sub-questions, so that the subsequent sub-questions that have not been fully predicted can refer to more abundant knowledge in the prediction process, and the subsequent sub-questions that have not been fully predicted can inherit the sub-answer statements of the previous question to be answered, so that the answer statement of the question to be answered can more accurately answer the question to be answered, thereby effectively improving the accuracy of the answer statement. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 Schematic diagram of the architecture of a system for generating a response statement provided in an embodiment of the present application;
[0031] Figure 2 Schematic diagram of the structure of an electronic device for generating a response statement provided in an embodiment of the present application;
[0032] Figure 3 Schematic diagram of the structure of an electronic device for training a problem decomposition model provided in an embodiment of the present application;
[0033] Figure 4 This is a flow chart of a method for generating a response statement provided in an embodiment of the present application;
[0034] Figure 5 Schematic diagram of a process for training a problem decomposition model according to an embodiment of the present application;
[0035] Figure 6 It is a structural diagram of the problem decomposition model provided in the embodiment of the present application;
[0036] Figure 7This is a schematic diagram of the principle of the method for generating a response statement provided in an embodiment of the present application;
[0037] Figure 8 It is a schematic diagram of the principle of the training method of the problem decomposition model provided in the embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0039] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0040] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0041] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0042] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0043] 1) Natural Language Processing (NLP): This field is a key area in computer science and artificial intelligence. It studies the theories and methods that enable effective communication between humans and computers using natural language. Natural language processing (NLP) is a discipline that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language we use daily—so it shares close ties with linguistics, yet also has important differences. Natural language processing is not simply the study of natural language in general, but rather the development of computer systems, particularly software systems, that can effectively implement natural language communication. As such, it is a part of computer science, with applications primarily in machine translation, automatic summarization, opinion extraction, text classification, question answering, text semantic comparison, and speech recognition.
[0044] 2) Large Language Model (LLM): Also known as a large language model or large model, a large language model is a deep learning model trained using large amounts of text data. It contains billions or even more parameters and can be used to generate and understand natural language text. Through training, the model learns the statistical patterns and semantic associations of language, building a vast language knowledge base that emulates human language comprehension and generation capabilities. Large language models have the following characteristics: Learning Ability: Through training on massive amounts of text data, large language models can acquire a rich set of linguistic knowledge and expressions, including grammar, semantics, and common expression conventions. Pattern Recognition: Large language models can identify common text patterns and semantic associations, such as co-occurrence relationships between words, the logical structure of sentences, and semantic roles. Contextual Understanding: Large language models can capture contextual information in text, understand the impact of previous text on subsequent text, and generate appropriate responses based on this context. Large language models have a wide range of applications, including intelligent customer service, intelligent question-answering, natural language generation, advertising recommendations, and gaming. They can improve the efficiency and accuracy of human-computer interaction and enhance the user experience.
[0045] 3) Artificial Intelligence (AI): This is an interdisciplinary discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, pre-trained model technologies, operating / interaction systems, and mechatronics. Pre-trained models, also known as large models or basic models, can be fine-tuned and widely applied to downstream tasks across various AI disciplines. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0046] 4) Machine Learning (ML): This is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning. Pretrained models are the latest development in deep learning, integrating these techniques.
[0047] 5) Convolutional Neural Networks (CNN): These are a type of feed-forward neural network (FNN) with a deep structure that incorporates convolutional computations. They are a representative algorithm for deep learning. CNNs possess representation learning capabilities and can perform shift-invariant classification on input images based on their hierarchical structure.
[0048] 6) In response to: used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed can be in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed are executed.
[0049] 7) Instruction Finetuning: This technique is used to optimize large language models (LLMs) to improve their ability to understand and follow human instructions. During instruction finetuning, the model is further trained on a specially designed dataset containing a variety of instructions and the expected output for each. This allows the model to learn how to respond more accurately to user instructions, improving its performance and controllability.
[0050] 8) Structured Query Language (SQL Statement): SQL is a standard programming language for managing and manipulating relational databases. SQL statements are used to perform various database operations, such as querying, updating, inserting, and deleting data. It is the primary tool used in a database management system (DBMS) to communicate and interact with the database. The main components of the SQL language include: Data Definition Language (DDL) is used to create, modify, and delete database objects, such as tables, views, and indexes. Common DDL commands include CREATE, ALTER, and DROP. Data Manipulation Language (DML) is used to insert, update, delete, and query data in the database. Common DML commands include INSERT, UPDATE, DELETE, and SELECT. Data Control Language (DCL) is used to manage permissions and security in the database. Common DCL commands include GRANT and REVOKE. Transaction Control Language is used to manage transactions in the database and ensure data consistency and integrity. Common commands include BEGIN TRANSACTION, ROLLBACK, and COMMIT.
[0051] During the implementation of the embodiments of this application, the applicant discovered that the related technology has the following problems:
[0052] In the related art, the generation of response sentences is achieved by directly predicting the responses to the questions to be answered as a whole. However, due to the complexity and diversity of the questions to be answered, the response sentences obtained by the response prediction are not very accurate.
[0053] The embodiments of the present application provide a method, device, electronic device, computer-readable storage medium and computer program product for generating a response statement, which can effectively improve the accuracy of the response statement. The following describes an exemplary application of the response statement generation system provided by the embodiments of the present application.
[0054] See also Figure 1 , Figure 1This is an architectural diagram of a system 100 for generating response statements provided in an embodiment of the present application. A terminal (terminal 400 is shown as an example) is connected to a server 200 via a network 300. The network 300 may be a wide area network or a local area network, or a combination of the two.
[0055] The terminal 400 is used for the user to use the client 410 and display the response statement on the graphical interface 410-1 (graphic interface 410-1 is shown as an example). The terminal 400 and the server 200 are connected to each other via a wired or wireless network.
[0056] In some embodiments, the server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal 400 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart TV, a smart watch, a car terminal, etc., but is not limited to this. The electronic device provided in the embodiment of the present application can be implemented as a terminal or as a server. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiment of the present application.
[0057] In some embodiments, the server 200 decomposes the question to be answered into N sub-questions, predicts answers to the sub-questions, obtains sub-question and answer statements for each sub-question, and sends the sub-question and answer statements to the terminal 400. The terminal 400 determines the sub-answer statement predicted by the sub-answer statements of N-1 sub-questions as the answer statement for the question to be answered.
[0058] In other embodiments, the terminal 400 predicts answers to the N sub-questions included in the question to be answered, obtains sub-question and answer statements for each sub-question, and sends the sub-question and answer statements to the server 200. The server 200 determines the sub-answer statement predicted by the sub-answer statements of N-1 sub-questions as the answer statement for the question to be answered.
[0059] In other embodiments, the embodiments of the present application can be implemented with the help of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network within a wide area network or local area network to realize data calculation, storage, processing, and sharing.
[0060] Cloud technology is a general term for network, information, integration, management platform, and application technologies used in the cloud computing business model. It can form a resource pool that can be used flexibly and conveniently on demand. Cloud computing technology will become a key support. The backend services of technical network systems require a large amount of computing and storage resources.
[0061] See also Figure 2 , Figure 2 is a structural diagram of an electronic device 500 for generating a response statement provided in an embodiment of the present application, wherein: Figure 2 The electronic device 500 shown may be Figure 1 The server 200 or the terminal 400 in Figure 2 The electronic device 500 shown includes: at least one processor 430, a memory 450, and at least one network interface 420. The various components in the electronic device 500 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not described in detail. Figure 2 Various buses are labeled as bus system 440 .
[0062] The processor 430 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0063] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 430.
[0064] The memory 450 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.
[0065] In some embodiments, the memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.
[0066] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;
[0067] The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB).
[0068] In some embodiments, the apparatus for generating a response statement provided in the embodiments of the present application may be implemented in software. Figure 2 Response statement generation device 455 stored in memory 450 is shown. This device can be software in the form of a program or plug-in, and includes the following software modules: a question decomposition module 4551, a response prediction module 4552, and a determination module 4553. These modules are logical and can be arbitrarily combined or further divided according to the functions they implement. The functions of each module will be described below.
[0069] See also Figure 3 , Figure 3 is a structural diagram of an electronic device for training a problem decomposition model provided by an embodiment of the present application, wherein: Figure 3 The electronic device 600 shown may be Figure 1 The server 200 or the terminal 400 in Figure 3 The electronic device 600 shown includes: at least one processor 530, a memory 550, and at least one network interface 520. The various components in the electronic device 600 are coupled together via a bus system 540. It is understood that the bus system 540 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 540 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 3 Various buses are labeled as bus system 540 .
[0070] The processor 530 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0071] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 550 may optionally include one or more storage devices that are physically remote from the processor 530.
[0072] The memory 550 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.
[0073] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.
[0074] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0075] The network communication module 552 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 520. Exemplary network interfaces 520 include Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB).
[0076] In some embodiments, the training device for the problem decomposition model provided in the embodiments of the present application can be implemented in software. Figure 3 A training device 555 for a problem decomposition model stored in memory 550 is shown. This device can be software in the form of a program or plug-in, and includes the following software modules: an acquisition module 5551, a problem decomposition module 5552, and a training module 5553. These modules are logical and can be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.
[0077] In other embodiments, the response statement generation device and the problem decomposition model training method provided in the embodiments of the present application can be implemented in hardware. As an example, the response statement generation device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the response statement generation method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs) or other electronic components.
[0078] In some embodiments, the terminal or server can implement the training method of the problem decomposition model and the generation method of the response statement provided in the embodiment of the present application by running a computer program or a computer executable instruction. For example, the computer program can be a native program (for example, a dedicated image generation program) or a software module in the operating system, for example, a generation module that can be embedded in any program (such as an instant messaging client, an album program, an electronic map client, a navigation client); for example, it can be a local (Native) application (APP, Application), that is, a program that needs to be installed in the operating system to run. In short, the above-mentioned computer program can be an application, module or plug-in in any form.
[0079] The method for generating a response statement provided in the embodiment of the present application will be explained in combination with the exemplary application and implementation of the server or terminal provided in the embodiment of the present application.
[0080] See also Figure 4 , Figure 4 This is a flow chart of the method for generating a response statement provided in the embodiment of the present application, which will be combined with Figure 4 Steps 101 to 103 are shown for illustration. The method for generating a response statement provided in the embodiment of the present application can be implemented by the server or the terminal alone, or by the server and the terminal in collaboration. The following will be illustrated by taking the server alone as an example.
[0081] In step 101, the question to be answered is decomposed into N sub-questions.
[0082] In some embodiments, the above step 101 can be implemented in the following manner: calling a question decomposition model to decompose the question to be answered to obtain the N sub-questions.
[0083] In some embodiments, the question to be answered includes N sub-questions, where N is a positive integer greater than or equal to 2. The semantics of different sub-questions are logically related, and the fused semantics of the N sub-questions are the same as the semantics of the question to be answered.
[0084] In some embodiments, the question to be answered refers to a question raised by the user that needs to be answered. This question may contain multiple sub-questions, which are interrelated and together constitute a complete question. Sub-question: A single question that constitutes the question to be answered. It is an integral part of the question to be answered and is used to guide the respondent to obtain the required information. N: A positive integer greater than or equal to 2, representing the number of sub-questions contained in the question to be answered. Logical association: There is a logical connection between the sub-questions, and they together constitute the overall meaning of the question to be answered. Fusion semantics: The semantics of all sub-questions are integrated, and the resulting semantics are the same as the semantics of the question to be answered.
[0085] In some embodiments, the question decomposition model can be a large language model with the ability to decompose complex questions into multiple sub-questions. This model can identify key information in the question to be answered and break it down into a series of related sub-questions for more efficient answering.
[0086] For example, see Figure 6 , Figure 6 is a structural diagram of the problem decomposition model provided in an embodiment of the present application, Figure 6 The problem decomposition model shown may include a feature extraction layer 1 and a problem decomposition layer 2. The above-mentioned calling of the problem decomposition model to decompose the question to be answered to obtain the N sub-problems can be achieved in the following way: calling the feature extraction layer 1 of the problem decomposition model to extract features of the question to be answered to obtain question features, calling the problem decomposition layer 2 of the problem decomposition model to decompose the question to be answered based on the question features to obtain N sub-problems.
[0087] In some embodiments, the problem decomposition model can be obtained in the following manner: obtaining M sub-problem labels of a problem training sample; calling a large language model to decompose the problem training sample to obtain multiple sub-problem training samples; determining the overall similarity between the M sub-problem labels and the multiple sub-problem training samples, and based on the overall similarity, fine-tuning the model parameters of the large language model to obtain the problem decomposition model.
[0088] In some embodiments, the above-mentioned fine-tuning of the model parameters of the large language model based on the overall similarity to obtain the problem decomposition model can be achieved as follows: the overall similarity is determined as the loss value of the large language model, and the model parameters of the large language model are fine-tuned based on the loss value to obtain the problem decomposition model.
[0089] In some embodiments, in the field of machine learning, especially in natural language processing tasks, subproblem labels refer to words or strings used to mark or identify subproblems. These labels are typically used to train and verify problem decomposition models so that the model can correctly decompose the problem into subproblems and understand the semantics of each subproblem.
[0090] In some embodiments, the aforementioned Large Language Model (LLM), also known as a large language model or large model, refers to a deep learning model trained using large amounts of text data. It contains billions or even more parameters and can be used to generate and understand the meaning of natural language text. Through training, the model can learn the statistical laws and semantic associations of language to build a vast language knowledge base, thereby simulating human language comprehension and generation capabilities. Large language models have the following characteristics: Learning ability: Through training on massive amounts of text data, large language models can learn a rich set of language knowledge and expressions, including grammar, semantics, and common expression conventions. Pattern recognition: Large language models can identify common text patterns and semantic associations, such as co-occurrence relationships between words, the logical structure of sentences, and semantic roles. Contextual understanding: Large language models can capture contextual information in text, understand the impact of previous text on subsequent text, and generate appropriate responses based on this context. Large language models have a wide range of application scenarios, including intelligent customer service, intelligent question-and-answer, natural language generation, advertising recommendations, and gaming. They can improve the efficiency and accuracy of human-computer interaction and enhance the user experience.
[0091] In some embodiments, the above-mentioned sub-problem training samples are described in natural language, and the above-mentioned calling of the large language model to perform problem decomposition on the problem training samples to obtain multiple sub-problem training samples can be achieved in the following manner: if the problem training samples are described in natural language, then calling the large language model to perform problem decomposition on the problem training samples to obtain the multiple sub-problem training samples; if the problem training samples are not described in natural language, then performing natural language conversion on the problem training samples to obtain the natural language sentences of the problem training samples; calling the large language model to perform problem decomposition on the natural language sentences of the problem training samples to obtain the multiple sub-problem training samples.
[0092] In some embodiments, the sub-problem training samples are described in natural language, and the determining of the overall similarity between the M sub-problem labels and the multiple sub-problem training samples can be achieved in the following manner: if the sub-problem label is described in the natural language, then determining the overall similarity between the M sub-problem labels and the multiple sub-problem training samples; if the sub-problem label is not described in the natural language, then performing natural language conversion on the M sub-problem labels to obtain M natural language labels; and determining the overall similarity between the M natural language labels and the multiple sub-problem training samples as the overall similarity between the M sub-problem labels and the multiple sub-problem training samples.
[0093] In some embodiments, it is necessary to identify the description method of the sub-problem label. If the label is already described in natural language, then these labels are used directly. If the label is not described in natural language, for labels that are not described in natural language, these labels need to be converted into natural language descriptions. Natural language processing technologies, such as text analysis, semantic understanding, etc., are used to understand the meaning of non-natural language labels and convert them into natural language expressions. Both the labels described in natural language and the converted natural language labels need to be compared with the sub-problem training samples to calculate the overall similarity between them. This can be achieved through various text similarity calculation methods, such as cosine similarity, edit distance, vector space model, etc. The calculated similarity is used as the overall similarity between the sub-problem label and the sub-problem training sample. This similarity can be used in subsequent model training, verification or evaluation processes to help the model better learn and understand the rules of problem decomposition.
[0094] In some embodiments, natural language generation (NLG) is the process of converting structured data or information into natural language text. The following steps describe the process of performing natural language conversion on the M sub-question labels to obtain M natural language labels: Obtain M sub-question labels, which are typically structured, machine-readable labels such as identifiers in XML, JSON, or other data formats. Understand the meaning and context of each sub-question label, which requires pre-defining or learning a mapping relationship between the label and natural language. Define a set of natural language conversion rules or train an NLG model to convert machine labels into natural language representations. Pass a sub-question label as input to the NLG system. If rules are used, apply the corresponding natural language conversion rules; if a model is used, perform inference and generate natural language text. The NLG system outputs the corresponding natural language label. The generated natural language labels are checked and corrected for grammar and style to ensure fluency and accuracy. Ensure consistency in terminology and style across all generated natural language labels.
[0095] For example, consider the sub-question label "error_code_404;" The definition rule is: Convert the "error_code_" prefix to "error code," and the number "404" corresponds to "page not found." The conversion is performed: Convert "error_code_404" to "Error code 404: Page not found." Post-processing: Check the generated text to confirm that there are no grammatical errors and that it conforms to linguistic conventions. Verification: Review the generated natural language labels to confirm their accuracy and appropriateness. Ultimately, each sub-question label undergoes this process and is converted into a corresponding natural language label, such as "Error code 404: Page not found." These natural language labels are easier for non-technical users to understand, improving the readability and usability of the information.
[0096] In this way, by determining the overall similarity between subquestion labels and subquestion training examples, the performance of the problem decomposition model can be more accurately evaluated, ensuring that the model correctly identifies and decomposes the problem. If the subquestion labels are described in natural language, the model's decision-making process can be more easily understood and explained, improving the model's interpretability. If the subquestion labels are not described in natural language, natural language labels are obtained through natural language conversion, allowing the model to adapt to different forms of label descriptions, increasing the model's flexibility and applicability. By accurately identifying and processing subquestion labels, we can better understand user needs and provide more personalized services to users.
[0097] In other embodiments, the above-mentioned determination of the overall similarity between the M sub-problem labels and the multiple sub-problem training samples can be achieved in the following manner: for each sub-problem label, determine the similarity between the sub-problem label and each sub-problem training sample respectively, and sum up the similarities to obtain the label similarity corresponding to the sub-problem label; sum up the label similarities corresponding to each sub-problem label to obtain the overall similarity.
[0098] As an example, the similarity between the above sub-question labels and the sub-question training samples can be expressed as:
[0099] Si=sim(ZB, ZYi) (1)
[0100] Among them, Si is used to indicate the similarity between the sub-problem label and the sub-problem training sample, ZB is used to indicate the sub-problem label, and ZYi is used to indicate the sub-problem training sample.
[0101] In some embodiments, the above-mentioned determination of the tag similarity of the sub-question tags based on the respective similarities may be achieved by summing up the respective similarities of the sub-question tags to obtain the tag similarity of the sub-question tags.
[0102] As an example, the expression of the above label similarity can be:
[0103]
[0104] Among them, S1 is used to indicate the label similarity of the sub-question label, Si is used to indicate the similarity between the sub-question label and the sub-question training sample, and T is used to indicate the number of sub-question training samples.
[0105] As an example, the expression of the above overall similarity can be:
[0106]
[0107] Among them, the above S is used to indicate the overall similarity, Sj is used to indicate the label similarity of each sub-question label, and Q is used to indicate the number of sub-question labels.
[0108] By determining the similarity between each sub-question label and the corresponding sub-question training sample, the matching degree between the label and the sample can be more accurately assessed, thereby improving the accuracy of the overall similarity. Similarity-based calculation methods can provide more information about the correlation between labels and samples, making the model's decision-making process more transparent. By summing the similarities of each sub-question label to obtain the overall similarity, this helps the model better understand and generalize the rules of problem decomposition, thereby improving model performance. Accurately determining the similarity of sub-question labels can help the model better understand user needs and provide more personalized services to users.
[0109] In some embodiments, the above-mentioned sub-problems are described in natural language, and the above-mentioned calling of the problem decomposition model to decompose the question to be answered to obtain the N sub-problems can be achieved in the following manner: if the question to be answered is described in the natural language, calling the problem decomposition model to decompose the question to be answered to obtain the N sub-problems; if the question to be answered is not described in the natural language, performing natural language conversion on the question to be answered to obtain the natural language sentence of the question to be answered; calling the problem decomposition model to decompose the natural language sentence to obtain the N sub-problems.
[0110] In some embodiments, the N subproblems include an i-th subproblem, where i is a positive integer not less than 2 and not greater than N.
[0111] As an example, when N=3, the N sub-problems include the first sub-problem, the second sub-problem, and the third sub-problem.
[0112] In some embodiments, since the question decomposition model is obtained by fine-tuning the model parameters of the large language model, the main language processing capability of the large language model is for natural language. Therefore, before calling the question decomposition model to decompose the question to be answered, it is necessary to determine whether the question to be answered is described in the natural language. If the question to be answered is described in the natural language, the question decomposition model can be directly called to decompose the question to be answered to obtain the N sub-questions; if the question to be answered is not described in the natural language, then there is no need to perform natural language conversion on the question to be answered to obtain the natural language sentence of the question to be answered; call the question decomposition model to decompose the natural language sentence to obtain N sub-questions.
[0113] In some embodiments, it is first necessary to identify the description method of the question to be answered. For questions to be answered that are not described in natural language, natural language processing technology needs to be used to convert them into natural language expressions. Through text analysis, semantic understanding and other technologies, it is ensured that the questions to be answered can be correctly processed by the question decomposition model. Whether it is a question to be answered described in natural language or a converted natural language question to be answered, it is necessary to call the question decomposition model for processing. The question decomposition model will decompose the question to be answered into N sub-questions according to predetermined rules and algorithms. After processing by the problem decomposition model, N sub-questions are obtained. These sub-questions are components of the original question to be answered and are used for further analysis and processing.
[0114] In this way, by distinguishing how the questions to be answered are described, the method can flexibly handle inputs of different formats, whether described in natural language or non-natural language. After questions described in non-natural language are converted into natural language statements through natural language, the problem decomposition model can continue to function, making the model adaptable to a wider range of question types. The problem decomposition model is specifically designed to process natural language statements, so it can more accurately decompose complex questions into sub-questions and improve the quality of sub-questions. Through accurate problem decomposition, users can obtain targeted answers or services more quickly, thereby improving the user experience. The problem decomposition model's precise decomposition capabilities help to better understand user needs and provide users with more personalized services. By automating the problem decomposition process, manual analysis time can be saved and work efficiency can be improved.
[0115] In step 102, responses to the first N-1 sub-questions are predicted to obtain sub-response statements for the first N-1 sub-questions.
[0116] In some embodiments, the above-mentioned prediction of responses to the sub-problems and obtaining of sub-response statements of the sub-problems can be achieved as follows: based on the first sub-problem, prediction of responses to the first sub-problem is performed to obtain a sub-response statement of the first sub-problem; based on the sub-response statement of the i-1th sub-problem and the i-th sub-problem, prediction of responses to the i-th sub-problem is performed to obtain a sub-response statement of the i-th sub-problem, where i is a positive integer not less than 2 and less than N; and the above processing is performed on the i-th sub-problem until a sub-response statement of the N-1th sub-problem is obtained.
[0117] In some embodiments, the sub-response statement of sub-question 1 is used to answer the question of sub-question 1.
[0118] As an example, the first sub-question above is: Please query the new employees who joined a company in the past two years among the current employees. The sub-response statement of the first sub-question is: The new employees who joined a company in the past two years among the current employees are employee A and employee B.
[0119] As an example, based on the sub-response statement of the first sub-question and the second sub-question, a response prediction is performed on the second sub-question to obtain the sub-response statement of the second sub-question; based on the sub-response statement of the second sub-question and the third sub-question, a response prediction is performed on the third sub-question to obtain the sub-response statement of the third sub-question; based on the sub-response statement of the third sub-question and the fourth sub-question, a response prediction is performed on the fourth sub-question to obtain the sub-response statement of the fourth sub-question.
[0120] In this way, by predicting the answers to each sub-question one by one, the answer to each sub-question can be predicted more accurately, thereby improving the accuracy of the overall answer. By predicting the answers to each sub-question, the user's needs can be better understood, and more personalized services can be provided to the user. By predicting the answer to the i-th sub-question based on the sub-answer statement of the i-1 sub-question and the i-th sub-question, the sub-answer statement of the i-th sub-question is obtained. By iterative prediction, the prediction of subsequent sub-questions is based on the sub-answer statement of the sub-question that has been completed, so that the subsequent sub-questions that have not been completed in the prediction process can have more abundant knowledge to refer to in the prediction process, so that the subsequent sub-questions that have not been completed in the prediction can take over the sub-answer statement of the previous question to be answered, so that the answer statement of the question to be answered can more accurately answer the question to be answered, thereby effectively improving the accuracy of the answer statement.
[0121] In some embodiments, based on the first sub-question, an answer prediction is performed on the first sub-question to obtain a sub-answer sentence of the first sub-question, which can be achieved in the following manner: feature extraction is performed on the first sub-question to obtain a first sentence feature of the first sub-question; from M preset sentence features, at least one first extended knowledge feature whose feature similarity with the first sentence feature is greater than a similarity threshold; a large language model is called to predict an answer to the first sub-question based on the first extended knowledge feature and the first sentence feature to obtain a sub-answer sentence of the first sub-question.
[0122] In some embodiments, the first extended knowledge feature is used as a reference when predicting the answer to the first sub-question.
[0123] In some embodiments, the above-mentioned determination of at least one first extended knowledge feature from the M preset sentence features, whose feature similarity with the first sentence feature is greater than the similarity threshold, can be achieved in the following manner: for each preset sentence feature, determine the feature similarity between the first sentence feature and the extended knowledge feature; if the feature similarity is greater than the feature similarity threshold, determine the preset sentence feature as the first extended knowledge feature.
[0124] In some embodiments, the M extended knowledge features are obtained by extracting features from the M extended knowledge.
[0125] In some embodiments, the above-mentioned large language model can be trained in the following manner: obtaining the answer sentence label of the question training sample, and performing feature extraction on the question training sample to obtain sentence sample features; determining at least one sample extension feature from M preset sentence features whose feature similarity with the sentence sample feature is greater than a similarity threshold; calling the preset large language model, and based on the sentence sample feature and the sample extension feature, predicting the answer to the question training sample to obtain a predicted answer sentence; based on the predicted answer sentence and the answer sentence label, fine-tuning the model parameters of the preset large language model to obtain the large language model.
[0126] In some embodiments, the above-mentioned fine-tuning of the model parameters of the preset large language model based on the predicted response sentence and the response sentence label to obtain the large language model can be achieved in the following manner: determining the similarity between the predicted response sentence and the response sentence label, determining the similarity between the predicted response sentence and the response sentence label as the loss value of the preset large language model, and based on the loss value of the preset large language model, fine-tuning the model parameters of the preset large language model to obtain the large language model.
[0127] By combining pre-set sentence features for feature similarity comparison, we can more accurately predict answers to questions, thereby improving overall answer accuracy. Incorporating extended knowledge into answer predictions allows the model to better adapt to different types of questions. By introducing pre-set sentence features, we can provide richer and more in-depth answers to questions, thereby improving the quality of answers. User questions can receive more accurate and comprehensive answers based on extended knowledge, thereby enhancing the user experience. By combining question feature extraction with pre-set sentence features, we can better understand user needs and provide more personalized services.
[0128] In some embodiments, the above-mentioned sub-response statement based on the i-1th sub-problem and the i-th sub-problem, predicting the response to the i-th sub-problem, and obtaining the sub-response statement of the i-th sub-problem can be achieved in the following manner: performing feature extraction on the i-th sub-problem to obtain the first sentence feature of the i-th sub-problem; determining at least one i-th extended knowledge feature from M preset sentence features whose feature similarity with the i-th sentence feature is greater than a similarity threshold; fusing the i-th extended knowledge feature and the i-th sentence feature to obtain a fused feature, and calling a large language model to predict the response to the i-th sub-problem based on the fused feature and the sub-response statement of the i-1th sub-problem to obtain the sub-response statement of the i-sub-problem.
[0129] In some embodiments, the i-th extended knowledge feature is used as a reference when predicting the answer to the i-th sub-question.
[0130] In some embodiments, the above-mentioned determination of at least one i-th extended knowledge feature from M preset sentence features, whose feature similarity with the i-th sentence feature is greater than a similarity threshold, can be achieved in the following manner: for each preset sentence feature, determine the feature similarity between the i-th sentence feature and the extended knowledge feature; if the feature similarity is greater than the feature similarity threshold, determine the preset sentence feature as the i-th extended knowledge feature.
[0131] In some embodiments, the above-mentioned determination of at least one i-th extended knowledge feature from M preset sentence features, whose feature similarity with the i-th sentence feature is greater than the similarity threshold, can be achieved as follows: performing the following processing for each of the preset sentence features: determining the feature similarity between the preset sentence feature and the i-th sentence feature, and comparing the feature similarity with the similarity threshold to obtain a comparison result; if the comparison result indicates that the feature similarity is greater than the similarity threshold, determining the preset sentence feature as the i-th extended knowledge feature corresponding to the i-th sentence feature.
[0132] In some embodiments, if the comparison result indicates that the feature similarity is less than or equal to the similarity threshold, the preset sentence feature is not determined as the i-th extended knowledge feature corresponding to the i-th sentence feature.
[0133] In some embodiments, the feature similarity between the above-mentioned preset sentence feature and the i-th sentence feature may refer to the feature distance between the preset sentence feature and the i-th sentence feature, and the feature distance may refer to a distance expression such as Euclidean distance and Manhattan distance.
[0134] In this way, by extracting the features of the sub-questions in each step and comparing and fusing them with the features of the relevant preset statements for similarity, the answer to each sub-question can be predicted more accurately, thereby improving the accuracy of the overall answer. Recursively process each sub-question, combine the features of the specific question and the features of the preset statement, so that the model can better adapt to different types of questions and can be generalized to new situations. Based on the fused features and the sub-response statement of the i-1th sub-question, the answer to the i-th sub-question is predicted to obtain the sub-response statement of the i-th sub-question, so that the prediction of the sub-response statement of the i-1th sub-question is based on the sub-response statement of the i-1th sub-question, so that the sub-response statements corresponding to different sub-questions are connected to each other and logically coherent, thereby effectively improving the quality of the answer. Combining the features of the preset statement for answer prediction can provide richer and deeper answers to questions, thereby improving the quality and depth of the answer.
[0135] In step 103, based on the sub-answer statements of the first N-1 sub-questions, an answer prediction is performed on the Nth sub-question to obtain an answer statement for the question to be answered.
[0136] Continuing with the above example, when N=4, the above sub-response statements include the sub-response statement for question 1, the sub-response statement for question 2, the sub-response statement for question 3, and the sub-response statement for question 4. The sub-response statement for question 2 is predicted based on the sub-response statement for question 1 (the sub-response statement for question 1), the sub-response statement for question 3 is predicted based on the sub-response statements for question 2 (the sub-response statement for question 1 and the sub-response statement for question 2), and the sub-response statement for question 4 is predicted based on the sub-response statements for question 3 (the sub-response statement for question 1, the sub-response statement for question 2, and the sub-response statement for question 3). Then the sub-response statement for question 4 is determined as the target sub-response statement.
[0137] For example, see Figure 7 , Figure 7 This is a schematic diagram of the principle of the response statement generation method provided in an embodiment of the present application. The above-mentioned sub-response statements include the sub-response statement (answer 1) of the first question (step 1 of the question), the sub-response statement (answer 2) of the second question (step 2 of the question)...the Nth question (step N of the question), the sub-response statement (answer 2) of the second question is predicted based on the sub-response statement of one sub-question (the sub-response statement (answer 1) of the first question), and the sub-response statement (answer N) of the Nth question is predicted based on the sub-response statements of N-1 sub-questions (the sub-response statement of the first question, the sub-response statement of the second question to the sub-response statement of the N-1 question). Then the sub-response statement (answer N) of the Nth question is determined as the target sub-response statement.
[0138] Following the above example, see Figure 7 , determine the target sub-response statement (answer N) as the response statement for the question to be answered.
[0139] In this way, by predicting the answers to the N sub-questions included in the question to be answered, the sub-answer statements of each sub-question are obtained, the target sub-answer statement is determined from the sub-answer statements, and the target sub-answer statement is determined as the answer statement for the question to be answered. Since the target sub-answer statement is predicted based on the sub-answer statements of N-1 sub-questions, the N-1 sub-questions are sub-questions other than the sub-questions corresponding to the target sub-answer statement, so that the prediction of the target sub-answer statement refers to the sub-answer statements of the N-1 sub-questions, so that the subsequent sub-questions that have not been completed in the prediction process can refer to more abundant knowledge, so that the subsequent sub-questions that have not been completed in the prediction can take over the sub-answer statements of the question to be answered, so that the answer statement of the question to be answered finally can more accurately answer the question to be answered, thereby effectively improving the accuracy of the answer statement.
[0140] See also Figure 5 , Figure 5 This is a flow chart of the training method of the problem decomposition model provided in the embodiment of the present application, which will be combined with Figure 5 Steps 201 to 204 are shown for illustration. The training method of the problem decomposition model provided in the embodiment of the present application can be implemented by the server or the terminal alone, or by the server and the terminal in collaboration. The following will be illustrated by taking the server alone as an example.
[0141] In step 201, a question training sample and M sub-question labels corresponding to the question training sample are obtained.
[0142] In some embodiments, M is a positive integer greater than or equal to 2, the question training sample includes M sub-question labels, the semantics of different sub-question labels are logically associated, and the fused semantics of the M sub-question labels are the same as the semantics of the question training sample.
[0143] In some embodiments, in the field of natural language processing and machine learning, a question training sample refers to a representative question selected from a data set for training or testing a model. It is a specific question instance, usually raised by a user, that requires the model to analyze and answer. The question training sample is one of the basic data for training the question decomposition model, used to help the model learn and understand the structure and semantics of the question. Sub-question labels refer to labels used to describe the semantic information of each sub-question in the question training sample. Each sub-question label corresponds to a specific sub-question in the question training sample. It is a brief and precise description of the content of the sub-question. The sub-question label can be a series of keywords or phrases used to indicate the topic and scope of the sub-question.
[0144] In step 202, a large language model is called to decompose the problem training sample into multiple sub-problem training samples.
[0145] In some embodiments, a large language model, also known as a large language model or "big model," refers to a deep learning model trained using large amounts of text data. It contains billions or even more parameters and can be used to generate and understand natural language text. Through training, the model learns the statistical patterns and semantic associations of language, building a vast language knowledge base that emulates human language comprehension and generation capabilities. Large language models have the following characteristics: Learning capability: Through training on massive amounts of text data, large language models can acquire a wealth of linguistic knowledge and expressions, including grammar, semantics, and common expression conventions. Pattern recognition: Large language models can identify common text patterns and semantic associations, such as co-occurrence relationships between words, the logical structure of sentences, and semantic roles. Contextual understanding: Large language models can capture contextual information in text, understand the impact of previous text on subsequent text, and generate appropriate responses based on that context. Large language models have a wide range of applications, including intelligent customer service, intelligent question-and-answer (Q&A), natural language generation, advertising recommendations, and gaming. They can improve the efficiency and accuracy of human-computer interaction and enhance the user experience.
[0146] In some embodiments, question decomposition is a process in the fields of natural language processing (NLP) and artificial intelligence (AI) that involves breaking down a complex question into multiple simpler, more specific sub-questions. This process aims to break down the original question into smaller parts that are more manageable and answerable, with each sub-question focusing on a specific aspect of the original question. The output of the question decomposition process is multiple sub-question training examples, each of which is a component of the original question and together they cover all the information of the original question. Each sub-question training example is more concise and clear, making it easier for the model to understand and answer.
[0147] In step 203, the overall similarity between the M sub-question labels and the plurality of sub-question training samples is determined.
[0148] In some embodiments, the above step 203 can be implemented as follows: if the sub-question label is described in the natural language, then determining the overall similarity between the M sub-question labels and the multiple sub-question training samples; if the sub-question label is not described in the natural language, then performing natural language conversion on the M sub-question labels to obtain M natural language labels; and determining the overall similarity between the M natural language labels and the multiple sub-question training samples as the overall similarity between the M sub-question labels and the multiple sub-question training samples.
[0149] In other embodiments, the above step 203 can also be implemented in the following way: for each of the sub-question labels, determine the similarity between the sub-question label and each of the sub-question training samples, and based on each of the similarities, determine the label similarity of the sub-question label; sum the label similarities of the sub-question labels to obtain the overall similarity.
[0150] As an example, the similarity between the above sub-question labels and the sub-question training samples can be expressed as:
[0151] Si=sim(ZB, ZYi) (4)
[0152] Among them, Si is used to indicate the similarity between the sub-problem label and the sub-problem training sample, ZB is used to indicate the sub-problem label, and ZYi is used to indicate the sub-problem training sample.
[0153] In some embodiments, the above-mentioned determination of the tag similarity of the sub-question tags based on the respective similarities may be achieved by summing up the respective similarities of the sub-question tags to obtain the tag similarity of the sub-question tags.
[0154] As an example, the expression of the above label similarity can be:
[0155]
[0156] Among them, S1 is used to indicate the label similarity of the sub-question label, Si is used to indicate the similarity between the sub-question label and the sub-question training sample, and T is used to indicate the number of sub-question training samples.
[0157] As an example, the expression of the above overall similarity can be:
[0158]
[0159] Among them, the above S is used to indicate the overall similarity, Sj is used to indicate the label similarity of each sub-question label, and Q is used to indicate the number of sub-question labels.
[0160] In step 204, based on the overall similarity, the model parameters of the large language model are fine-tuned to obtain the question decomposition model.
[0161] In some embodiments, the question decomposition model is used to decompose the question to be answered into N sub-questions.
[0162] In some embodiments, the above-mentioned fine-tuning of the model parameters of the large language model based on the overall similarity to obtain the problem decomposition model can be achieved as follows: the overall similarity is determined as the loss value of the large language model, and based on the loss value, the model parameters of the large language model are fine-tuned to obtain the problem decomposition model.
[0163] In some embodiments, the problem decomposition model and the large language model have the same model structure, the model parameters of the problem decomposition model are different from the model parameters of the large language model, the problem decomposition performance of the large language model is lower than the problem decomposition performance of the problem decomposition model, and the problem decomposition performance is used to indicate the accuracy of problem decomposition.
[0164] In this way, by decomposing the question to be answered into N sub-questions, the first N-1 sub-questions are predicted to respond to, and the sub-response statements of the first N-1 sub-questions are obtained. Based on the sub-response statements of the first N-1 sub-questions, the answer to the Nth sub-question is predicted to obtain the response statement of the question to be answered. Since the response statement of the question to be answered is predicted based on the sub-response statements of the first N-1 sub-questions, the prediction of the response statement refers to the sub-response statements of the N-1 sub-questions, so that the subsequent sub-questions that have not been fully predicted can refer to more abundant knowledge in the prediction process, so that the subsequent sub-questions that have not been fully predicted can inherit the sub-response statements of the previous question to be answered, so that the response statement of the question to be answered can more accurately answer the question to be answered, thereby effectively improving the accuracy of the response statement.
[0165] The following describes an exemplary application of the embodiment of the present application in an actual database query application scenario.
[0166] Since most of the knowledge in an enterprise exists in the form of a structured database, the advantage of this approach is that it can support the rapid execution of complex query operations on large amounts of data through indexing and optimization technologies. However, the disadvantage is that building and maintaining a structured database system usually requires a lot of cost. Especially as the enterprise data grows and becomes more complex, the management and maintenance of structured databases will become more complicated, requiring increasing time and manpower to optimize and maintain the database system.
[0167] A key application scenario for large models in enterprises is the efficient understanding and processing of internal knowledge and processes. The advantage of large models is their ability to directly understand unstructured data, such as Word documents and PowerPoint presentations, or semi-structured data, such as JSON files and spreadsheets, and to perform various query operations on the information contained in these documents, significantly reducing the time and labor required to convert them into structured databases. However, a drawback of this approach is that it is limited by the limited understanding capabilities of existing large language models. For some complex query problems, especially those requiring multi-step reasoning, large language models cannot produce accurate results like structured queries using SQL.
[0168] The embodiments of the present application provide a way to significantly enhance the ability of large models in reasoning about internal enterprise knowledge. Through the embodiments of the present application, large models can effectively perform complex queries on internal enterprise knowledge, further narrowing the gap in the ability of large models and databases to process complex queries. The embodiments of the present application not only improve the efficiency of internal enterprise knowledge management, but also provide more powerful support for enterprise decision-making. By reducing dependence on databases, enterprises can more flexibly use large models for in-depth data analysis and knowledge mining, thereby enhancing the competitiveness and innovation capabilities of their businesses.
[0169] In some cases, the RAG model may not be able to provide accurate and detailed answers to complex queries, because such queries require the large model in RAG to have more powerful knowledge integration, logical reasoning, and semantic understanding capabilities. In this case, it is necessary to combine other technologies or models to handle complex queries. Figure 7 First, the user asks a question. Then, the problem is decomposed based on the question to be answered, resulting in step 1, step 2, and step N. The answer to step 1 is recalled, with recall results 1, 2, and M. The large language model is used to generate the answer to step 1, obtaining answer 1. For step 2, the answer to step 2 is recalled, with recall results 1, 2, and M. The large language model is used to generate the answer to step 2, obtaining answer 2. For step N, the answer to step N is recalled, with recall results 1, 2, and M. The large language model is used to generate the answer to step N, obtaining answer N. Answer N is used as the output. The large language model is obtained by supervised fine-tuning of the basic large language model using fine-tuning data.
[0170] In some embodiments, see Figure 8 , Figure 8This is a schematic diagram of the principle of the training method of the problem decomposition model provided in an embodiment of the present application, a complex SQL statement and a description of the function and effect corresponding to the SQL statement, decomposing a complex SQL statement into sub-SQLs of multiple steps, step 1-sub-SQL, step 2-sub-SQL...step M-sub-SQL, generating step 1-sub-SQL, step 2-sub-SQL...step M-sub-SQL respectively corresponding to the description of step 1-sub-SQL through the large model, and the description of step 2-sub-SQL to the description of step M-sub-SQL, obtaining decomposition step 1, decomposition step 2 to decomposition step M, generating a fine-tuning training sample, and adding it to the fine-tuning data training set to fine-tune the decomposition ability of the large model for complex tasks.
[0171] In some embodiments, the large model + RAG architecture can be more efficient than traditional approaches based on intent recognition models and database queries, but it often fails to provide good answers to complex queries encountered in question answering. Examples of such complex queries include:
[0172] SELECT sum(t.amount)as total_loan_amt;
[0173] FROM customers c;
[0174] JOIN transactions t ON c.customer_id=t.customer_id;
[0175] WHERE t.transaction_date>='2095-04-01';
[0176] AND t.transaction_date<='2095-04-30';
[0177] AND c.customer_account_open_date>='2095-01-01';
[0178] AND t.transaction_type = 'loan'.
[0179] The above SQL statement will calculate the total amount of loans taken out in April by all new account holders who opened accounts this year. Therefore, the SQL statement corresponds to "calculate the total amount of loans taken out in April by all new account holders who opened accounts this year."
[0180] Then, the next step is to use some existing tools to decompose this complex SQL into a sequence of steps consisting of multiple simple SQLs. For example, for the above SQL, the decomposition result is as follows:
[0181] Step 1 - subSQL:
[0182] SELECT c.customer_id;
[0183] FROM customers c;
[0184] WHERE c.customer_account_open_date >= '1988 - 01 - 01';
[0185] Step 2 - subSQL:
[0186] SELECT t.transaction_id;
[0187] FROM transactions t;
[0188] WHERE t.transaction_date >= '1988 - 04 - 01' AND t.transaction_date <= '1988 - 04 - 30';
[0189] AND t.customer_id IN SUB_SQL1_RESULT;
[0190] Step 3 - subSQL:
[0191] SELECT t.transaction_id
[0192] FROM transactions t
[0193] WHERE t.transaction_type = 'Loan'
[0194] AND t.transaction_id IN SUB_SQL2_RESULT
[0195] Step 4 - subSQL:
[0196] SELECT sum(t.amount) as total_loan_amt
[0197] FROM transactions t
[0198] WHERE t.transaction_id IN SUB_SQL3_RSLT。
[0199] Next, the subSQL from each sub-step is fed into an LLM (Large Language Model) to generate a natural language description for the subSQL. For example, the following four descriptions will be generated for the above example:
[0200] Step 1 - subSQL: Find all users who opened new accounts in 1988 → X.
[0201] Step 2 - subSQL: Find all transaction records of user set X in April 1988 → Y.
[0202] Step 3-subSQL: Find all transactions of type loan in transaction set Y → Z.
[0203] Step 4 - subSQL: Calculate the sum of all transaction amounts in transaction set Z → ANSWER.
[0204] In this way, we get a pair of the original task and the decomposed subtask set:
[0205] Original task:
[0206] Calculate the total amount of loans in April for all new account opening users this year
[0207] Break down the subtasks:
[0208] Find all users who opened new accounts in 1988 →X.
[0209] Find all transaction records of user set X in April 1988 → Y.
[0210] Find all transactions of type borrowing in transaction set Y → Z.
[0211] Calculate the sum of all transaction amounts in transaction set Z → ANSWER.
[0212] The above can be used as an example of a training dataset for training a large model to follow instructions and perform complex task decomposition using SFT (Supervised Fine Tuning). More examples can be constructed in a similar manner and combined to form the final training dataset.
[0213] In this way, we leverage internal enterprise SQL to enhance the reasoning capabilities of large enterprise models based on domain knowledge. The reasoning capabilities of large-scale language models (LLMs) are relatively weak compared to other capabilities. The most fundamental solution to improving model reasoning capabilities is to build sufficient and high-quality datasets. However, high-quality reasoning datasets are extremely difficult to obtain, and manual annotation is virtually impossible. Therefore, when training general large models, we primarily rely on public math and programming problems to improve model reasoning capabilities. While these problems are significantly helpful in improving the overall reasoning capabilities of general large models, they are of limited help in improving the reasoning capabilities based on private domain knowledge and relevant, specific experience, which are essential for large models in an industry or domain to solve practical problems. This solution successfully addresses this challenge by decomposing SQL, significantly accelerating the reasoning capabilities of large models in an industry or domain for specialized problems.
[0214] The training data set generated above enables the fine-tuned (Supervised Fine-Tuning) large model to possess relatively strong in-domain knowledge reasoning capabilities. Specifically, the large model is able to decompose some complex in-domain tasks into multiple, more easily solved subtasks. The second innovation of this solution is to leverage this new capability of the model to enhance the effectiveness of the existing RAG (Retrieve Augmented Generation) retrieval enhancement solution. Specifically, on top of the original single RAG, a large model decomposition module is first added. It will solve each subtask in sequence through the RAG method, ultimately obtaining the answer to a complex question.
[0215] The embodiment of the present application can quickly build a high-quality data set that enhances the ability of large models to decompose complex tasks with much less manpower than building manually labeled training data sets. The large model trained based on this data set that has the ability to solve complex problems can be further added with a planning decomposition module on the basis of the existing RAG solution, so as to decompose a complex task into multiple easily solvable subtasks, and then use the RAG solution to solve them one by one to obtain the final answer. Compared with the existing large model-based solutions, the embodiment of the present application can greatly improve the accuracy of solving complex problems, and is particularly suitable for scenarios such as finance that have extremely high requirements for execution accuracy and precision, and require not only qualitative analysis of the data set, but also the execution of precise quantitative analysis tasks.
[0216] It is understandable that in the embodiments of the present application, when data related to questions to be answered is involved and is applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0217] The following continues to describe the exemplary structure of the response statement generating device 455 provided in the embodiment of the present application implemented as a software module. In some embodiments, such as Figure 2 As shown, the software modules in the response statement generation device 455 stored in the memory 450 may include: a question decomposition module, which decomposes the question to be answered to obtain N sub-questions; a response prediction module, which is used to predict responses to the first N-1 sub-questions to obtain sub-response statements for the first N-1 sub-questions; and a determination module, which is used to predict responses to the Nth sub-question based on the sub-response statements of the first N-1 sub-questions to obtain a response statement for the question to be answered.
[0218] In some embodiments, the above-mentioned answer prediction module is also used to obtain M sub-question labels of the question training sample; call the large language model to decompose the question training sample to obtain multiple sub-question training samples; determine the overall similarity between the M sub-question labels and the multiple sub-question training samples, and based on the overall similarity, fine-tune the model parameters of the large language model to obtain the question decomposition model.
[0219] In some embodiments, the sub-problem training samples are described in natural language, and the above-mentioned answer prediction module is also used to call the large language model to perform problem decomposition on the problem training samples to obtain the multiple sub-problem training samples if the problem training samples are described in natural language; if the problem training samples are not described in natural language, perform natural language conversion on the problem training samples to obtain the natural language sentences of the problem training samples; call the large language model to perform problem decomposition on the natural language sentences of the problem training samples to obtain the multiple sub-problem training samples.
[0220] In some embodiments, the sub-question training samples are described in natural language, and the above-mentioned answer prediction module is further used to determine the overall similarity between the M sub-question labels and the multiple sub-question training samples if the sub-question label is described in the natural language; if the sub-question label is not described in the natural language, perform natural language conversion on the M sub-question labels to obtain M natural language labels; and determine the overall similarity between the M natural language labels and the multiple sub-question training samples as the overall similarity between the M sub-question labels and the multiple sub-question training samples.
[0221] In some embodiments, the above-mentioned answer prediction module is also used to determine the similarity between each sub-question label and each sub-question training sample, and sum up the similarities to obtain the label similarity corresponding to the sub-question label; sum up the label similarities corresponding to each sub-question label to obtain the overall similarity.
[0222] In some embodiments, the sub-questions are described in natural language, and the above-mentioned response prediction module is also used to call the question decomposition model to decompose the question to be answered to obtain the N sub-questions if the question to be answered is described in the natural language; if the question to be answered is not described in the natural language, perform natural language conversion on the question to be answered to obtain a natural language sentence of the question to be answered; call the question decomposition model to decompose the natural language sentence to obtain the N sub-questions.
[0223] In some embodiments, the N sub-problems include the i-th sub-problem, where i is a positive integer not less than 2 and not greater than N; the above-mentioned response prediction module is also used to predict the response to the first sub-problem based on the first sub-problem, and obtain the sub-response statement of the first sub-problem; based on the sub-response statement of the i-1 sub-problem and the i-th sub-problem, predict the response to the i-th sub-problem, and obtain the sub-response statement of the i-th sub-problem; traverse the i-th sub-problem and perform the above processing until the sub-response statement of the N-1 sub-problem is obtained.
[0224] In some embodiments, the above-mentioned response prediction module is also used to extract features of the first sub-problem to obtain the first sentence feature of the first sub-problem; determine at least one first extended knowledge feature from the M preset sentence features whose feature similarity with the first sentence feature is greater than a similarity threshold, and the first extended knowledge feature is used as a reference when predicting the response to the first sub-problem; call the large language model to predict the response to the first sub-problem based on the first extended knowledge feature and the first sentence feature to obtain a sub-response sentence for the first sub-problem.
[0225] In some embodiments, the above-mentioned response prediction module is also used to obtain the response sentence label of the question training sample, and perform feature extraction on the question training sample to obtain sentence sample features; determine at least one sample extension feature from M preset sentence features whose feature similarity with the sentence sample feature is greater than a similarity threshold; call a preset large language model, and perform response prediction on the question training sample based on the sentence sample feature and the sample extension feature to obtain a predicted response sentence; based on the predicted response sentence and the response sentence label, fine-tune the model parameters of the preset large language model to obtain the large language model.
[0226] In some embodiments, the above-mentioned response prediction module is also used to extract features of the i-th sub-problem to obtain the first sentence feature of the i-th sub-problem; determine at least one i-th extended knowledge feature whose feature similarity with the i-th sentence feature is greater than a similarity threshold from M preset sentence features, and the i-th extended knowledge feature is used as a reference for predicting the response to the i-th sub-problem; fuse the i-th extended knowledge feature and the i-th sentence feature to obtain a fused feature, and call a large language model to predict the response to the i-th sub-problem based on the fused feature and the sub-response sentence of the i-1 sub-problem to obtain the sub-response sentence of the i-sub-problem.
[0227] In some embodiments, the above-mentioned response prediction module is also used to perform the following processing for each of the preset sentence features: determine the feature similarity between the preset sentence feature and the i-th sentence feature, and compare the feature similarity with the similarity threshold to obtain a comparison result; if the comparison result indicates that the feature similarity is greater than the similarity threshold, then the preset sentence feature is determined as the i-th extended knowledge feature corresponding to the i-th sentence feature.
[0228] The following continues to describe the exemplary structure of the problem decomposition model training device 555 provided in the embodiment of the present application implemented as a software module. In some embodiments, such as Figure 3 As shown, the software modules in the training device 555 of the question decomposition model stored in the memory 550 may include: an acquisition module, used to obtain question training samples, and M sub-question labels corresponding to the question training samples; a question decomposition module, used to call a large language model to decompose the question training samples to obtain multiple sub-question training samples; a training module, used to determine the overall similarity between the M sub-question labels and the multiple sub-question training samples, and based on the overall similarity, fine-tune the model parameters of the large language model to obtain the question decomposition model; wherein, the question decomposition model is used to decompose the question to be answered to obtain N sub-questions.
[0229] An embodiment of the present application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the method for generating a response statement described in the embodiment of the present application.
[0230] The embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute the method for generating a response statement provided in the embodiment of the present application, for example, Figure 4 A method for generating a response statement is shown.
[0231] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or various electronic devices including one or any combination of the above memories.
[0232] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0233] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as, for example, in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).
[0234] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.
[0235] In summary, the embodiments of the present application have the following beneficial effects:
[0236] (1) The question to be answered is decomposed into N sub-questions; the answers to the first N-1 sub-questions are predicted to obtain the sub-answer statements of the first N-1 sub-questions; based on the sub-answer statements of the first N-1 sub-questions, the answer to the Nth sub-question is predicted to obtain the answer statement of the question to be answered. Since the answer statement of the question to be answered is predicted based on the sub-answer statements of the first N-1 sub-questions, the prediction of the answer statement refers to the sub-answer statements of the N-1 sub-questions, so that the subsequent sub-questions that have not been fully predicted can refer to more abundant knowledge in the prediction process, so that the subsequent sub-questions that have not been fully predicted can inherit the sub-answer statements of the previous question to be answered, so that the answer statement of the question to be answered can more accurately answer the question to be answered, thereby effectively improving the accuracy of the answer statement.
[0237] (2) By determining the overall similarity between sub-question labels and sub-question training samples, the performance of the problem decomposition model can be more accurately evaluated to ensure that the model can correctly identify and decompose the problem. When the sub-question labels are described in natural language, the decision-making process of the model can be more easily understood and explained, improving the interpretability of the model. When the sub-question labels are not described in natural language, natural language labels are obtained through natural language conversion, allowing the model to adapt to different forms of label descriptions, improving the flexibility and applicability of the model. By accurately identifying and processing sub-question labels, we can better understand user needs and provide users with more personalized services.
[0238] (3) By determining the similarity between each sub-question label and the corresponding sub-question training sample, the degree of match between the label and the sample can be more accurately evaluated, thereby improving the accuracy of the overall similarity. The similarity-based calculation method can provide more information about the correlation between the label and the sample, making the model's decision-making process more transparent. By summing the similarities of each sub-question label, the overall similarity is obtained, which helps the model better understand and generalize the rules of problem decomposition, thereby improving the performance of the model. Accurately determining the similarity of sub-question labels can help the model better understand user needs and provide users with more personalized services.
[0239] (4) By distinguishing the description methods of the questions to be answered, this method can flexibly handle inputs of different formats, whether they are described in natural language or non-natural language, and can be effectively processed. After the questions described in non-natural language are converted into natural language statements through natural language, the problem decomposition model can continue to function, which enables the model to adapt to more types of questions. The problem decomposition model is specifically used to process natural language statements, so it can more accurately decompose complex questions into sub-questions and improve the quality of sub-questions. Through accurate problem decomposition, users can get targeted answers or services more quickly, thereby improving user experience. The precise decomposition ability of the problem decomposition model helps to better understand user needs and provide users with more personalized services. Through the automated problem decomposition process, manual analysis time can be saved and work efficiency can be improved.
[0240] (5) By predicting the answers to each sub-question one by one, the answer to each sub-question can be predicted more accurately, thereby improving the accuracy of the overall answer. By predicting the answers to each sub-question, the user's needs can be better understood, and more personalized services can be provided to the user. By predicting the answer to the i-th sub-question based on the sub-answer statement of the i-1 sub-question and the i-th sub-question, the sub-answer statement of the i-th sub-question is obtained. By iterative prediction, the prediction of subsequent sub-questions is based on the sub-answer statement of the sub-question that has been predicted, so that the subsequent sub-questions that have not been predicted can refer to more abundant knowledge in the prediction process, so that the subsequent sub-questions that have not been predicted can take over the sub-answer statement of the previous question to be answered, so that the answer statement of the question to be answered can more accurately answer the question to be answered, thereby effectively improving the accuracy of the answer statement.
[0241] (6) By combining the features of preset sentences for feature similarity comparison, the answer to the question can be predicted more accurately, thereby improving the accuracy of the overall answer. Combining extended knowledge for answer prediction enables the model to better adapt to different types of questions. By introducing preset sentence features, richer and more in-depth answers to questions can be provided, thereby improving the quality of answers. Questions raised by users can receive more accurate and comprehensive answers based on extended knowledge, thereby improving the user experience. By combining feature extraction of questions with preset sentence features, we can better understand user needs and provide users with more personalized services.
[0242] (7) By extracting the features of the sub-questions in each step and comparing and fusing them with the features of the relevant preset statements, the answer to each sub-question can be predicted more accurately, thereby improving the accuracy of the overall answer. Recursively process each sub-question, combine the features of the specific question and the features of the preset statement, so that the model can better adapt to different types of questions and can be generalized to new situations. Based on the fused features and the sub-answer statement of the i-1th sub-question, the answer to the i-th sub-question is predicted to obtain the sub-answer statement of the i-th sub-question, so that the prediction of the sub-answer statement of the i-th sub-question is based on the sub-answer statement of the i-1th sub-question, so that the sub-answer statements corresponding to different sub-questions are connected to each other and logically coherent, thereby effectively improving the quality of the answer. Combining the features of the preset statement for answer prediction can provide richer and deeper answers to questions, thereby improving the quality and depth of the answer.
[0243] (8) Use internal SQL to increase the reasoning ability of the enterprise's large model's domain knowledge. The reasoning ability of the LLM large-scale language model is relatively weak compared to other capabilities. The most fundamental solution to improve the model's reasoning ability is to build a sufficient number of high-quality data sets. However, high-quality reasoning data sets are very difficult to obtain, and it is basically impossible to achieve them through manual labeling. Therefore, when training general large models, we mainly rely on public math problems and programming problems to improve the model's reasoning ability. Although these problems are of great help in improving the overall reasoning ability of general large models, they are of limited help in the reasoning ability based on private domain knowledge and related specific experience that is needed and necessary for large models in an industry or field to solve practical problems. This solution successfully solves this problem by decomposing SQL, which can greatly accelerate the reasoning ability of large models in an industry or field on professional problems.
[0244] (9) The embodiment of the present application can quickly build a high-quality data set that enhances the ability of a large model to decompose complex tasks with much less manpower than building a manually labeled training data set. The large model with the ability to solve complex problems trained based on this data set can be further added with a planning decomposition module on the basis of the existing RAG solution, thereby decomposing a complex task into multiple easily solvable subtasks, and then solving them one by one using the classic RAG solution to obtain the final answer. Compared with the existing large model-based solutions, the embodiment of the present application can greatly improve the accuracy of solving complex problems, and is particularly suitable for scenarios such as finance that have extremely high requirements for execution accuracy and precision, and require not only qualitative analysis of the data set, but also the execution of precise quantitative analysis tasks.
[0245] (10) Use internal SQL to increase the reasoning ability of the enterprise's large model's domain knowledge. The reasoning ability of the LLM large-scale language model is relatively weak compared to other capabilities. The most fundamental solution to improve the model's reasoning ability is to build a sufficient number of high-quality data sets. However, high-quality reasoning data sets are very difficult to obtain, and it is basically impossible to achieve them through manual annotation. Therefore, when training general large models, we mainly rely on public math problems and programming problems to improve the model's reasoning ability. Although these problems are of great help in improving the overall reasoning ability of general large models, they are of limited help in the reasoning ability based on private domain knowledge and related specific experience that is needed and necessary for large models in an industry or field to solve practical problems. This solution successfully solves this problem by decomposing SQL, which can greatly accelerate the reasoning ability of large models in an industry or field on professional problems.
[0246] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.
Claims
1. A method for generating a response statement, characterized in that: The method comprises: Decompose the question to be answered into N sub-questions; Predicting responses to the first N-1 sub-questions to obtain sub-response statements for the first N-1 sub-questions; Based on the sub-answer statements of the first N-1 sub-questions, an answer prediction is made for the Nth sub-question to obtain an answer statement for the question to be answered.
2. The method according to claim 1, characterized in that Before decomposing the question to be answered into N sub-questions, the method further includes: Get M sub-question labels of the question training sample; Calling the large language model to decompose the problem training sample to obtain multiple sub-problem training samples; Determining the overall similarity between the M sub-question labels and the plurality of sub-question training samples; Based on the overall similarity, fine-tuning the model parameters of the large language model to obtain a question decomposition model; The question to be answered is decomposed into N sub-questions, including: The question decomposition model is called to decompose the question to be answered to obtain the N sub-questions.
3. The method according to claim 2, characterized in that The calling of the large language model to decompose the problem training sample to obtain multiple sub-problem training samples includes: If the problem training sample is described in natural language, calling the large language model to decompose the problem training sample to obtain the multiple sub-problem training samples; If the problem training sample is not described in natural language, converting the problem training sample into a natural language sentence of the problem training sample; The large language model is called to decompose the natural language sentence of the problem training sample to obtain the multiple sub-problem training samples.
4. The method according to claim 2, characterized in that The sub-problem training samples are described in natural language, and determining the overall similarity between the M sub-problem labels and the plurality of sub-problem training samples includes: If the sub-question labels are described in the natural language, determining the overall similarity between the M sub-question labels and the plurality of sub-question training samples; If the sub-question labels are not described in the natural language, performing natural language conversion on the M sub-question labels to obtain M natural language labels; The overall similarity between the M natural language labels and the multiple sub-question training samples is determined as the overall similarity between the M sub-question labels and the multiple sub-question training samples.
5. The method according to claim 2, characterized in that Determining the overall similarity between the M sub-question labels and the plurality of sub-question training samples includes: For each sub-question label, determine the similarity between the sub-question label and each sub-question training sample, and sum the similarities to obtain a label similarity corresponding to the sub-question label; The label similarities corresponding to the sub-question labels are summed to obtain the overall similarity.
6. The method according to claim 1, characterized in that The step of predicting responses to the first N-1 sub-questions to obtain sub-response statements for the first N-1 sub-questions includes: Based on the first sub-question, predict the answer to the first sub-question to obtain a sub-answer sentence for the first sub-question; Based on the sub-answer statement of the (i-1)th sub-question and the (i)th sub-question, predict the answer to the (i)th sub-question to obtain the sub-answer statement of the (i)th sub-question, where i is a positive integer not less than 2 and less than N; Traverse the i-th sub-problem and execute the above process until the sub-response statement of the N-1-th sub-problem is obtained.
7. The method according to claim 6, characterized in that The step of predicting an answer to the first sub-question based on the first sub-question to obtain a sub-answer statement to the first sub-question includes: Performing feature extraction on the first sub-question to obtain a first sentence feature of the first sub-question; Determining, from the M preset sentence features, at least one first extended knowledge feature having a feature similarity with the first sentence feature greater than a similarity threshold, the first extended knowledge feature being used as a reference for predicting an answer to the first sub-question; The large language model is called to predict the answer to the first sub-question based on the first extended knowledge feature and the first sentence feature, so as to obtain a sub-answer sentence of the first sub-question.
8. The method according to claim 7, characterized in that Before calling the large language model to predict an answer to the first sub-question based on the first extended knowledge feature and the first sentence feature to obtain a sub-answer sentence for the first sub-question, the method further includes: Obtaining answer sentence labels for question training samples, and performing feature extraction on the question training samples to obtain sentence sample features; Determine, from the M preset sentence features, at least one sample extension feature whose feature similarity with the sentence sample feature is greater than a similarity threshold; Calling a preset large language model, and predicting an answer to the question training sample based on the sentence sample features and the sample expansion features to obtain a predicted answer sentence; Based on the predicted response sentence and the response sentence label, the model parameters of the preset large language model are fine-tuned to obtain the large language model.
9. The method according to claim 6, characterized in that The method of predicting an answer to the i-th sub-question based on the sub-answer statement of the i-1th sub-question and the i-th sub-question to obtain the sub-answer statement of the i-th sub-question includes: Perform feature extraction on the i-th sub-problem to obtain the first sentence feature of the i-th sub-problem; Determining, from the M preset sentence features, at least one i-th extended knowledge feature having a feature similarity with the i-th sentence feature greater than a similarity threshold, the i-th extended knowledge feature being used as a reference for predicting an answer to the i-th sub-question; The i-th extended knowledge feature and the i-th sentence feature are fused to obtain a fused feature, and the large language model is called to predict the answer to the i-th sub-question based on the fused feature and the sub-answer sentence of the i-1-th sub-question to obtain the sub-answer sentence of the i-th sub-question.
10. The method according to claim 9, characterized in that The step of determining, from the M preset sentence features, at least one i-th extended knowledge feature having a feature similarity with the i-th sentence feature greater than a similarity threshold, includes: The following processing is performed for each of the preset sentence features: Determining a feature similarity between the preset sentence feature and the i-th sentence feature, and comparing the feature similarity with the similarity threshold to obtain a comparison result; If the comparison result indicates that the feature similarity is greater than the similarity threshold, the preset sentence feature is determined as the i-th extended knowledge feature corresponding to the i-th sentence feature.
11. A device for generating a response statement, characterized in that: The device comprises: The question decomposition module decomposes the question to be answered into N sub-questions; An answer prediction module is used to predict answers to the first N-1 sub-questions and obtain sub-answer statements for the first N-1 sub-questions; The determination module is used to predict the answer to the Nth sub-question based on the sub-answer statements of the first N-1 sub-questions to obtain the answer statement of the question to be answered.
12. An electronic device, characterized in that: The electronic device comprises: a memory for storing computer-executable instructions or computer programs; A processor, configured to implement the method according to any one of claims 1 to 10 when executing computer-executable instructions or computer programs stored in the memory.
13. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer-executable instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.
14. A computer program product comprising a computer program or computer executable instructions, characterized in that When the computer program or computer executable instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Multi-hop question answering method based on multi-hop reasoning joint optimization
CN114780707A
Complex problem processing method and device, equipment and medium
CN116737912A
Open domain natural language reasoning question-answering system and method driven by large language model
CN116932708A
Response statement generation method and device, equipment, storage medium and program product
CN116975217A