Generative dialog system and method
By optimizing database search and knowledge storage methods in a generative dialogue system, combined with multiple search technologies, the problems of insufficient knowledge coverage and inaccurate response in the existing dialogue system are solved, and dialogue generation with high accuracy and context relevance are achieved .
Patent Information
- Application Number
- CN202411024710.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-11-15
AI Technical Summary
The existing dialogue system based on search enhancement generation has problems such as insufficient knowledge coverage, inaccurate responses and intimate context, resulting in high uncertainty in responses.
A generative dialogue system is designed to obtain the search results of user inquiries by performing search operations in a database related to the current topic scenario, and input the results as context information into a large language model to generate reply text, combining multiple searches Technologies such as entity extraction, fuzzy search and vector semantic search optimize the storage and search methods of knowledge data, and improve response accuracy and contextual relevance.
It significantly improves the response accuracy and context relevance of the generative dialogue system, ensures the breadth and depth of knowledge coverage, and improves the cognitive boundaries and prompt word comprehension capabilities of the large language model.
Smart Images

Figure CN118964564A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to retrieval enhancement generation technology, and in particular to a generative dialogue system and method based on retrieval enhancement generation, as well as a computer-readable storage medium and a computer program product for implementing the method. Background Art
[0002] Current generative dialogue systems mainly rely on manually configured FAQ libraries and third-party interfaces when answering user inquiries, which results in high uncertainty in responses and frequent under-answering.
[0003] Retrieval Augmented Generation (RAG) is a content generation technology that combines search technology and large language model (LLM). It uses the information retrieved from the data source as the basis for LLM to generate answers, thereby enhancing the accuracy and relevance of the generated content. However, existing dialogue generation systems based on RAG search technology often have problems such as insufficient knowledge coverage, inaccurate answers, and loose context association. Summary of the invention
[0004] One object of the present application is to provide a generative dialogue system, method, computer-readable storage medium and computer program product for implementing the method, which have high response accuracy and context relevance.
[0005] According to one aspect of the present application, a generative dialogue system is provided, comprising:
[0006] A plurality of first databases, each of which stores first knowledge data related to one of a plurality of topic scenarios;
[0007] A plurality of second databases, each second database storing second knowledge data related to at least one preset type of key entity;
[0008] A processing unit, which is configured as follows:
[0009] A. obtaining a first search result about a user query by performing a search operation within a to-be-searched scope related to a current topic scenario, wherein the current topic scenario is determined based on the user query, and the to-be-searched scope is a subset of a set consisting of the first database and the second database;
[0010] B. when it is determined that the to-be-searched scope does not exist or the first search result is unavailable, obtaining a second search result regarding the user query by performing a search operation in a second database corresponding to a key entity of a preset type involved in the user query; and
[0011] C. Input the first retrieval result or the second retrieval result as context information into a large language model to generate a reply text.
[0012] Optionally, in the above-mentioned generative dialogue system, the first database and the second database store the first knowledge data and the second knowledge data in the form of question-answer pairs or text blocks, and the first retrieval results and the second retrieval results are represented in at least one of the following forms: question-answer pairs, text blocks and real-time query information.
[0013] Optionally, in the above-mentioned generative dialogue system, the processing unit is further configured to determine the current topic scenario based on the user query before operation A.
[0014] Optionally, in the above-mentioned generative dialogue system, the processing unit is further configured to perform pre-processing on the user query before operation A, and the pre-processing includes at least one of the following operations: rewriting the user query, checking the accuracy of the car model or version mentioned in the user query, and extracting key entities related to the current topic scenario from the user query.
[0015] Optionally, in the above generative dialogue system, when the current topic scenario is a comparative query scenario, operation A includes:
[0016] When it is determined that the user query contains comparable key entities, determining the to-be-searched scope based on the comparable key entities, wherein the comparable key entities include at least one of the following: vehicle model, company name, and product;
[0017] The knowledge related to the key entity is retrieved within the to-be-retrieved scope as the first retrieval result.
[0018] Optionally, in the above generative dialogue system, when the current topic scenario is a car purchase evaluation scenario, operation A includes:
[0019] When it is determined that the user query contains a price range or a car model as a key entity, determining the to-be-searched range based on the price range or the car model; and
[0020] The knowledge related to the price range or vehicle model is retrieved within the to-be-searched range as the first search result.
[0021] Optionally, in the above generative dialogue system, when the current topic scenario is an encyclopedia query scenario, operation A includes:
[0022] Determine the scope to be searched based on key entities contained in the user query, wherein the key entities include at least one of the following: vehicle model, company name, and brand name;
[0023] The knowledge related to the key entity is retrieved within the to-be-retrieved scope as the first retrieval result.
[0024] Optionally, in the above generative dialogue system, when the vector dot product similarity of the first search result is less than a threshold, it is determined that the first search result is unavailable.
[0025] Optionally, in the above-mentioned generative dialogue system, the operation of retrieving knowledge related to the key entity within the to-be-searched scope and the operation of performing a search in a second database corresponding to the key entity of a preset type involved in the user query are performed in parallel.
[0026] Optionally, in the above generative dialogue system, operation B includes:
[0027] Generating a query vector from the user query;
[0028] One or more result vectors are obtained as the second search result by searching a second database corresponding to key entities of a preset type involved in the user query, each of the result vectors corresponding to a question-answer pair.
[0029] Optionally, in the generative dialogue system, the context information is represented in at least one of the following forms: question-answer pairs, text blocks, and real-time query information, and operation C includes:
[0030] Determining corresponding prompt words based on the type of the representation form of the context information, the prompt words including pre-set system prompt words and inquiry prompt words related to the content of the user inquiry; and
[0031] The prompt word is output to the large language model to generate the reply text.
[0032] Optionally, in the generative dialogue system, the context information is represented in at least one of the following forms: question-answer pairs, text blocks, and real-time query information, and operation C includes:
[0033] sorting the result vectors based on similarity to the query vector;
[0034] Determine the best matching result vector based on the keywords included in the user query by using a sliding candidate strategy, and use the best matching result vector as the second search result;
[0035] Determining corresponding prompt words based on the type of the representation form of the context information, the prompt words including pre-set system prompt words and inquiry prompt words related to the content of the user inquiry; and
[0036] The prompt word is output to the large language model to generate the reply text.
[0037] Optionally, in the above-mentioned generative dialogue system, supervised fine-tuning technology is used to fine-tune the large language model based on positive and negative example data.
[0038] According to another aspect of the present application, a generative dialogue method based on retrieval enhancement generation technology is provided, comprising:
[0039] A. obtaining a first search result about a user query by performing a search operation within a to-be-searched scope related to a current topic scenario, wherein the current topic scenario is determined based on the user query, the to-be-searched scope is a subset of a set consisting of the first database and the second database, each of the first databases stores first knowledge data related to one of a plurality of topic scenarios, and each of the second databases stores second knowledge data related to at least one key entity of a preset type;
[0040] B. when it is determined that the to-be-searched scope does not exist or the first search result is unavailable, obtaining a second search result regarding the user query by performing a search operation in a second database corresponding to a key entity of a preset type involved in the user query; and
[0041] C. Input the first retrieval result or the second retrieval result as context information into a large language model to generate a reply text.
[0042] Optionally, in the above-mentioned generative dialogue method, the first database and the second database store the first knowledge data and the second knowledge data in the form of question-answer pairs or text blocks, and the context information is represented in at least one of the following forms: question-answer pairs, text blocks and real-time query information.
[0043] Optionally, in the above generative dialogue method, before step A, a step of determining the current topic scenario based on the user query is also included.
[0044] Optionally, in the above-mentioned generative dialogue method, before step A, it also includes a step of performing pre-processing on the user query, and the pre-processing includes at least one of the following operations: rewriting the user query, checking the accuracy of the car model or version mentioned in the user query, and extracting key entities related to the current topic scenario from the user query.
[0045] Optionally, in the above-mentioned generative dialogue method, when the current topic scenario is a comparative query scenario, step A includes:
[0046] When it is determined that the user query contains comparable key entities, determining the to-be-searched scope based on the comparable key entities, wherein the comparable key entities include at least one of the following: vehicle model, company name, and product;
[0047] The knowledge related to the key entity is retrieved within the to-be-retrieved scope as the first retrieval result.
[0048] Optionally, in the above-mentioned generative dialogue method, when the current topic scenario is a car purchase evaluation scenario, step A includes:
[0049] When it is determined that the user query contains a price range or a car model as a key entity, determining the to-be-searched range based on the price range or the car model; and
[0050] The knowledge related to the price range or vehicle model is retrieved within the to-be-searched range as the first search result.
[0051] Optionally, in the above-mentioned generative dialogue method, when the current topic scenario is an encyclopedia query scenario, step A includes:
[0052] Determine the scope to be searched based on key entities contained in the user query, wherein the key entities include at least one of the following: vehicle model, company name, and brand name;
[0053] The knowledge related to the key entity is retrieved within the to-be-retrieved scope as the first retrieval result.
[0054] Optionally, in the above-mentioned generative dialogue method, when the vector dot product similarity of the first search result is less than a threshold value, it is determined that the first search result is unavailable.
[0055] Optionally, in the above-mentioned generative dialogue method, the operation of retrieving knowledge related to the key entity within the scope to be searched and the operation of performing a search in a second database corresponding to the key entity of a preset type involved in the user query are performed in parallel.
[0056] Optionally, in the above generative dialogue method, step B includes:
[0057] Generating a query vector from the user query;
[0058] One or more result vectors are obtained as the second search result by searching a second database corresponding to key entities of a preset type involved in the user query, each of the result vectors corresponding to a question-answer pair.
[0059] Optionally, in the above generative dialogue method, the context information is represented in at least one of the following forms: question-answer pairs, text blocks, and real-time query information, and step C includes:
[0060] Determining corresponding prompt words based on the type of the representation form of the context information, the prompt words including pre-set system prompt words and inquiry prompt words related to the content of the user inquiry; and
[0061] The prompt word is output to the large language model to generate the reply text.
[0062] Optionally, in the above generative dialogue method, the context information is represented in at least one of the following forms: question-answer pairs, text blocks, and real-time query information, and step C includes:
[0063] sorting the result vectors based on similarity to the query vector;
[0064] Determine the best matching result vector based on the keywords included in the user query by using a sliding candidate strategy, and use the best matching result vector as the second search result;
[0065] Determining corresponding prompt words based on the type of the representation form of the context information, the prompt words including pre-set system prompt words and inquiry prompt words related to the content of the user inquiry; and
[0066] The prompt word is output to the large language model to generate the reply text.
[0067] Optionally, in the above-mentioned generative dialogue method, supervised fine-tuning technology is used to fine-tune the large language model based on positive and negative example data.
[0068] According to another aspect of the present application, a non-transitory computer-readable storage medium is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the method described above are implemented.
[0069] According to another aspect of the present application, a computer program product is provided, comprising a computer program / instruction, which implements the steps of the method described above when the computer program / instruction is executed by a processor.
[0070] In some embodiments of the present application, a variety of retrieval technologies such as entity extraction matching, fuzzy retrieval, and vector semantic retrieval are used, and different methods or retrieval ranges are preferentially selected to recall knowledge according to different topic scenarios, thereby ensuring the breadth and depth of knowledge coverage. In other embodiments, the utilization rate and accuracy of knowledge data are further improved by adopting a variety of knowledge representation forms such as question-answer pairs, chapter blocks, and real-time query information. In some other embodiments, by comprehensively considering factors such as vehicle model and intent, the retrieval range is dynamically adjusted, which significantly improves the response quality of the generative dialogue system in various high-frequency scenarios. In addition, by using supervised fine-tuning technology, the large language model is fine-tuned based on positive and negative example data, thereby improving the cognitive boundaries and prompt word comprehension capabilities of the large language model. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] The above and / or other aspects and advantages of the present application will become clearer and easier to understand through the following description of various aspects in conjunction with the accompanying drawings, in which the same or similar units are represented by the same reference numerals. The accompanying drawings include:
[0072] Figure 1 This is an overall architecture diagram of a RAG-based dialogue generation function according to an embodiment of the present application.
[0073] Figure 2 It is a schematic diagram of the training process of a large language model according to another embodiment of the present application.
[0074] Figure 3 A schematic block diagram of a generative dialogue system according to another embodiment of the present application.
[0075] Figure 4 The present invention is a flowchart of a generative dialogue method according to another embodiment of the present application.
[0076] Figure 5 The present invention is a flowchart of a context information generation process according to another embodiment of the present application.
[0077] Figure 6 The present invention is a flowchart of a context information generation process according to another embodiment of the present application.
[0078] Figure 7 The present invention is a flowchart of a context information generation process according to another embodiment of the present application.
[0079] Figure 8 The present invention is a flowchart of a context information generation process according to another embodiment of the present application.
[0080] Fig. 9 The present invention is a flowchart of a context information generation process according to another embodiment of the present application. DETAILED DESCRIPTION
[0081] The present application is described more fully below with reference to the accompanying drawings in which illustrative embodiments of the present application are illustrated. However, the present application may be implemented in different forms and should not be interpreted as being limited to the embodiments given herein. The above embodiments are given to make the disclosure herein comprehensive and complete, so as to more fully convey the scope of protection of the present application to those skilled in the art.
[0082] In this specification, terms such as "comprise" and "include" indicate that in addition to the units and steps directly and explicitly stated in the specification and claims, the technical solution of the present application does not exclude the situation where there are other units and steps that are not directly or explicitly stated.
[0083] Unless otherwise specified, terms such as "first" and "second" do not indicate the order of the units in terms of time, space, size, etc., but are merely used to distinguish the units.
[0084] Figure 1 This is an overall architecture diagram of a RAG-based dialogue generation function according to an embodiment of the present application.
[0085] exist Figure 1 In the illustrated architecture 10, the topic scene recognition module 112, the pre-processing module 113, the retrieval processing module 114, the data storage unit 115, the prompt word management module 117, the sorting module 118 and the matching module 120 are used to implement the function of retrieving context information from the data source (hereinafter the above units are collectively referred to as the context information generation system), and the large language model 121 is used to generate a reply text according to the context information.
[0086] It should be noted that Figure 1 The functions of the various modules and units shown in the figure can be implemented by computer programs or software modules running on a general-purpose computer, or by hardware devices (such as processing circuits and firmware) dedicated to implementing specific functions. It should also be noted that Figure 1 The dialogue generation function shown can be implemented by a single computer system (such as an intelligent cockpit system) or with the help of a distributed system (such as a cloud computing platform).
[0087] like Figure 1As shown, at the topic scene identification module 112, the intention of the user query 111 is determined, and the topic scene involved in the user query 111 is thereby determined. Exemplarily, the existing user queries can be annotated, and the annotated data can be used as a training data set to train the classifier or distribution model. At the topic scene identification module 112, the topic scene involved can be determined based on the intention of the user query 111 with the help of the trained classifier. In some examples, topic scenes include, for example, comparison query scenes, car purchase evaluation scenes, and encyclopedia query scenes, etc.; further, the above scenes can be further subdivided, for example, the comparison query scenes include company comparison scenes, product comparison document scenes, and product (such as AI assistant) comparison scenes, etc., and the encyclopedia query scenes may include company introduction scenes, character introduction scenes, product introduction scenes, etc. It should be noted that the division of topic scenes or the division of intentions can be determined according to actual applications, and the above examples are merely exemplary.
[0088] At the pre-processing module 113, various pre-processing is performed on the user query 111. Pre-processing includes, for example, rewriting the user query. Since homophones in the user query may be misidentified (for example, "ET9" may be recognized as "1T wine" during voice recognition), the text quality of the user query can be improved by correcting the recognition errors of high-frequency keywords such as car models and characters by using string replacement. The pre-processing may also include checking the accuracy of the car models or versions mentioned in the user query 111, which helps to improve the accuracy of the generated dialogue. At the pre-processing module 113, key entities related to the current topic scene can also be extracted from the user query. The key entities described here generally refer to entities with important semantic information and contextual meaning in the user query, which are essential for understanding the query content, performing tasks or answering questions. In this embodiment, the types of key entities may be different for different topic scenes. For example, when the topic scene is a comparative query scene, the key entity is a comparable key entity, which includes but is not limited to car models, company names, and vehicle functional units. For example, when the topic scenario is a car purchase evaluation scenario, the types of key entities include price range or car model. For another example, when the topic scenario is an encyclopedia query scenario, the key entities include but are not limited to car model, company name, and brand name.
[0089] At the retrieval processing module 114, retrieval is performed in different databases in the data storage unit 115 according to different topic scenario types. The existing RAG technology retrieves context information from the database storing chapter data or chapter blocks through a retrieval algorithm, and inputs the context information into the LLM to generate a reply text. In this embodiment, the database of the data storage unit 115 is divided into two categories, namely, a first database storing knowledge data related to multiple topic scenarios and a second database storing knowledge data related to at least one preset type of key entity (preset types include, for example, vehicle models and product models, etc.). By classifying the retrieval data resources into scenarios and vehicle models for storage, retrieval can be performed for specific scenarios and vehicle models, which narrows the scope of the retrieval and also improves the relevance between the generated reply text and the user's inquiry.
[0090] In addition, unlike the existing RAG technology, knowledge data can be stored in the form of question-answer pairs in addition to being stored in the form of chapter blocks. The database that stores knowledge data in the form of chapter blocks will be referred to as a chapter block database, and the database that stores knowledge data in the form of question-answer pairs will be referred to as a question-answer pair database. For example, for a certain topic scenario, it may provide a first database A1 that stores knowledge data in the form of chapter blocks and a first database A2 that stores knowledge data in the form of question-answer pairs; for another example, for a certain preset type of key entity (such as a vehicle model), it may provide a second database B1 that stores knowledge data in the form of chapter blocks and a second database B2 that stores knowledge data in the form of question-answer pairs. In addition, optionally, in the second database, a shared resource database for all vehicle models may also be provided, which may also be divided into a chapter block database and a question-answer pair database.
[0091] In the existing RAG technology, since only knowledge related to the user's query is retrieved from a single category of resources (article blocks), problems such as loss of contextual information and insufficient topic semantic coherence often occur. Optionally, a large language model can be used to summarize and generalize the article knowledge to convert it into question-answer pair knowledge. In this embodiment, by utilizing both article data and question-answer pair knowledge, the advantages of the large language model in summarizing the article knowledge and the advantages of the large language model in retelling and summarizing the question-answer pair knowledge can be fully exploited, thereby improving searchability and usage efficiency.
[0092] Exemplarily, the data sources of the first and second databases may include question-answer pair resources of the operating unit and various private and shared knowledge bases. For example, data cleaning and generalization operations may be performed on the data resources. For example, the data cleaning operation includes removing duplicate question-answer pairs, and the generalization operation includes generalizing the question-answer pairs using the large language model capability to enhance diversity, and summarizing and generalizing the passage data using the large language model capability to obtain new question-answer pairs.
[0093] The retrieval operation performed by the retrieval processing module 114 can be performed on a combination of various databases in the data storage unit 115. In this embodiment, in the retrieval processing module 114, the scope to be searched can be determined according to the user query 111 and the retrieval operation can be performed within the retrieval scope. In particular, when determining the scope to be searched, the first and second databases related to the current topic scenario are preferentially selected (hereinafter such databases are referred to as the scope to be searched related to the current topic scenario or the preferred scope to be searched). For example, if the current topic scenario is a comparative query scenario and the user query contains comparable key entities a and b (a and b are of the same type, which can be, for example, car models, company names, and products), the first database A(a), A(b) and the second database B(a), B(b) storing relevant knowledge of the key entities a and b can be determined as the preferred scope to be searched; for another example, if the current topic scenario is an encyclopedia query scenario and the user query contains a comparable key entity c, the first database A(c) and the second database B(c) storing relevant knowledge of the key entity c can be determined as the preferred scope to be searched. See. Figure 1 By performing a search within the to-be-searched range related to the current topic scenario, a first search result 116A in the form of a chapter block can be obtained, which may, for example, include the results R retrieved from multiple databases within the preferred to-be-searched range. 11 ~R 1m .like Figure 1 As shown, the search result 116A is provided to the prompt word management module 117 as context information.
[0094] On the other hand, when the scope to be searched related to the current topic scenario does not exist (for example, in a comparative query scenario, the user query does not contain comparable key entities) or the first search result 116A is not available (for example, in an encyclopedia query scenario, the vector dot product similarity of the first search result 116A is less than a threshold), the search processing module 114 uses a second database corresponding to a preset type of key entity involved in the user query (the preset type includes, for example, vehicle models and product models, etc.) as the scope to be searched (hereinafter, such databases are referred to as secondary selected scopes to be searched). In some examples, the second database as the secondary selected scope to be searched may include a dedicated resource database for a specific vehicle model and a shared resource database for all vehicle models. Exemplarily, the knowledge data stored in the second database is represented in the form of vectors (for example, by dividing the text into blocks and then embedding these blocks into vectors using an encoding model) and indexes are generated for these vectors. Before performing the search operation, the user query is also vectorized to obtain a query vector, and then a search for the query vector is performed for the index and the first k vectors found are used as the search result 116B, that is, the result vector or V1~V k .
[0095] Continue to see Figure 1 , the sorting module 118 is based on the result vectors V1 to V k The similarity with the query vector V0 (generated based on the user query 111) is calculated for the result vectors V1-V k Sorting is performed to obtain sorted search results 119, namely result vectors V'1 to V' k Then, the matching module 120 uses various matching algorithms (such as sliding candidate strategy) to select the result vectors V'1 to V' based on the keywords included in the user query. k The best matching result vector is determined as the second search result 116B'. Figure 1 As shown, the second search result 116B′ is provided to the prompt word management module 117 as context information.
[0096] In addition, when the search processing module 114 performs a search operation based on the preferred or secondary search range, it may also obtain a third search result 116C in the form of real-time query information, which may be numerical data, such as car sales, selling price, total sales, and number of hot posts. Figure 1 As shown, the third search result 116C is also provided to the prompt word management module 117 as context information.
[0097] In the prompt word management module 117, the corresponding prompt word is determined according to the type of the representation form of the context information. In this embodiment, the prompt word may include a pre-set system prompt word and an inquiry prompt word related to the content of the user's inquiry.
[0098] like Figure 1 As shown, the prompt words generated by the prompt word management module 117 are output to the large language model 121, which generates the reply text 122.
[0099] Figure 2 This is a schematic diagram of the training process of a large language model according to another embodiment of the present application. In this embodiment, by constructing positive and negative example data to train the large language model based on supervised fine-tuning (SFT) technology, the response accuracy of the large language model is effectively improved, and the bottom-line capability is enhanced.
[0100] like Figure 2 As shown, user question-answer pairs 201 of multiple topic scenarios covered by the online mined knowledge base and user question-answer pairs 202 of multiple topic scenarios not covered by the online mined knowledge base are input into the context information generation system 203 (e.g. Figure 1 The question-answer pairs generated by the context information generation system are output to the large language model 204 (e.g. Figure 1The large language model 121 in the example is used to generate a reply text. According to the reply text, it can be determined which of the question-answer pairs 201 and 202 can be used as positive training data 205 and which can be used as negative training data 206, thereby obtaining a training data set.
[0101] Figure 3 This is a schematic block diagram of a generative dialogue system according to another embodiment of the present application. The generative dialogue system shown can be implemented Figure 1 The generative dialogue functionality shown.
[0102] Figure 3 The generative dialogue system 30 shown includes a data storage unit 310 and a processing unit 320. Optionally but not necessarily, the generative dialogue system 30 also includes a large language model 330. In a variation of this embodiment, the large language model 330 may be provided as an external unit of the system 30 by a third party.
[0103] See also Figure 3 The data storage unit 310 includes a plurality of first databases 311-1 to 311-m and a plurality of second databases 312-1 to 312-n, which constitute a set Ω of knowledge resources, and various combinations of the first databases 311-1 to 311-m and the second databases 312-1 to 312-n constitute a subset ω of the knowledge resource or set Ω. i , the subset may include only a portion of the database selected from the first database, or only a portion of the database selected from the second database, or a portion of the database selected from the first database and the second database. In this embodiment, each first database stores knowledge data related to one of a plurality of topic scenarios, and each second database stores knowledge data related to at least one preset type of key entity (e.g., vehicle model). As described above, each database may be a chapter block type database or a question-answer pair type database.
[0104] The processing unit 320 includes one or more memories 321 (e.g., non-volatile memories such as flash memory, ROM, hard disk drive, magnetic disk, optical disk, etc.), one or more processors 322, and computer programs / instructions 323 stored in the memories 321. The computer programs / instructions 323 may be executed by one processor 322, or by multiple processors 322 (which may be located at the same physical location or at different physical locations) to execute in coordination to implement the various functions of the processing unit 320 to be described below.
[0105] Optionally, the processing unit 320 can be implemented in the form of a cloud computing unit or cloud unit, in which computing, network and storage services are provided in the form of a resource pool, wherein most of the computing resources are hosted on the Internet and allocated to users on demand. Alternatively, the processing unit 320 can also be implemented in the form of a stand-alone system (such as a smart cockpit system), in which computing resources are basically limited to a single local system.
[0106] In general, the processing unit 320 performs a search operation within a search range determined based on the user query to obtain context information and generates corresponding prompt words from the context information.
[0107] The processing unit 320 will determine the current topic scenario involved according to the user query, and thereby execute the corresponding processing logic to obtain context information. These processing logics include the determination of the scope to be searched, the execution of the search operation, and the processing of the search results. In the present embodiment, the processing unit 320 preferentially selects the first and second databases related to the current topic scenario as the scope to be searched. On the other hand, when the scope to be searched related to the current topic scenario does not exist, the processing unit 320 will select the second database corresponding to the key entity of the preset type involved in the user query as the scope to be searched.
[0108] When the current topic scenario is a comparative query scenario, the processing unit 320 will determine whether there are comparable key entities in the user query. If so, the preferred scope to be searched is determined based on the comparable key entities. Otherwise, the secondary scope to be searched is determined as the scope to be searched. Taking the user query "Please compare the advantages and disadvantages of car models a and b" as an example, since car models a and b as comparable key entities are included, the processing unit 320 uses the combination of the first database and the second database (for example, the first database 311-2 and the second database 312-1) storing the relevant knowledge of car models a and b as the scope to be searched ω(a,b), and retrieves the knowledge related to the key entities a and b within the scope to be searched ω(a,b) as the first search result. On the other hand, if the user query is "What are the advantages and disadvantages of car model a compared with other car models", since no comparable key entities are included, the processing unit 320 uses the second database storing the relevant knowledge of car model a as the scope to be searched ω'(a), and retrieves the knowledge related to the key entity a within the scope to be searched ω'(a).
[0109] When the current topic scenario is a car purchase evaluation scenario, the processing unit 320 will determine whether the user query contains a price range or a car model as a key entity. If so, the preferred range to be searched is determined based on the key entity. Otherwise, the secondary range to be searched is determined as the range to be searched. Taking the user query "Please provide the characteristics of the car model with a price range of X to Y" as an example, since it contains the price range as a key entity, the processing unit 320 uses the combination of the first database storing the relevant knowledge of the car model in the range of X to Y and the second database as the range to be searched ω(X to Y), and searches for the knowledge related to the key entity "car model in the range of X to Y" in the range to be searched ω(X to Y) as the first search result. On the other hand, if the user query is "What is the approximate price of car model a", since it does not contain the price range, the processing unit 320 uses the second database storing the relevant knowledge of car model a as the range to be searched ω'(a), and searches for the knowledge related to the key entity a in the range to be searched ω'(a).
[0110] In the example of the above topic scenario, when there is a preferred range to be searched, the obtained first search result is provided as context information to the prompt word management module for generating prompt words as input of the large language model 330. On the other hand, as described above, the result vectors retrieved within the range to be searched ω'(a) are sorted based on similarity, and the most matching result vector is determined from the sorted result vectors using a matching algorithm as the second search result for generating prompt words.
[0111] When the current topic scenario is an encyclopedia query scenario, the processing unit 320 will determine the preferred scope to be searched based on the key entities in the user query and perform the search operation within the preferred scope to be searched, and on the other hand, use the second database of the key entities of the preset type involved in the user query as the secondary scope to be searched and perform the search operation within the secondary scope to be searched in parallel. Taking the user query "When was car model a launched" as an example, the processing unit 320 can use the combination of the first database and the second database storing the relevant knowledge of car model a as the scope to be searched ω(a), and retrieve the knowledge related to car model a within the scope to be searched ω(a) as the first search result. On the other hand, the processing unit 320 uses the second database storing the relevant knowledge of car model a as the scope to be searched ω'(a), retrieves the knowledge related to car model a within the scope to be searched ω'(a) to obtain the result vector, and selects the most matching result vector from the result vector as the second search result. After obtaining the first search result, the processing unit 320 will determine whether it is suitable as context information. If not, the second search result will be used as context information. Exemplarily, if the vector dot product similarity of the first search result is less than a threshold, it is determined that it is not suitable for use as context information. Similarly, the processing unit 320 generates a prompt word as an input of the large language model 330 based on the context information.
[0112] exist Figure 3 In the illustrated embodiment, the large language model 330 generates corresponding reply text according to the context information output by the processing unit 320 .
[0113] Figure 4 The present invention is a flowchart of a generative dialogue method according to another embodiment of the present application. Figure 4 Each step of the method shown is executed by a data processing device (eg Figure 3 It should be noted that the data processing device described here generally refers to various computer systems including hardware entities and software components, in which various computing tasks and information processing tasks are performed through the collaborative work of hardware entities and software components.
[0114] like Figure 4 As shown, in step 410, the data processing device determines the current topic scene based on the user query. As described above, the topic scene can be classified based on the intention of the user query. In one example, it includes a company comparison scene, a product comparison document scene, a product comparison scene, a company introduction scene, a character introduction scene, a product introduction scene, and a car purchase scene.
[0115] Then, the process proceeds to step 420, where the data processing device performs pre-processing on the user query. As described above, the pre-processing may include at least one of the following operations: rewriting the user query, checking the accuracy of the car model or version mentioned in the user query, and extracting key entities related to the current topic scenario from the user query.
[0116] After step 420, Figure 4 The process shown enters step 430. In this step, the data processing device executes corresponding processing logic according to the determined current topic scenario to generate corresponding context information.
[0117] See also Figure 4 , step 440 is performed after step 430. In this step, the data processing device generates corresponding prompt words based on the context information generated in step 430 and outputs the prompt words to the large language model.
[0118] Then, in step 450, the large language model outputs a corresponding reply text according to the input prompt word.
[0119] The following further describes the processing logic of various topic scenarios with the help of the accompanying drawings.
[0120] Figure 5 The flowchart is a context information generation process according to another embodiment of the present application, wherein the process is used to generate context information when the current topic scenario is a comparison query scenario.
[0121] like Figure 5 As shown, in step 510, the data processing device determines whether the user query contains a comparable key entity. If it contains a comparable key entity, it proceeds to step 520, otherwise it proceeds to step 530. Figure 6 The processing flow shown.
[0122] In step 520, the data processing device determines a preferred scope to be searched based on the comparable key entities. The method for determining the scope to be searched has been described above and will not be repeated here.
[0123] Subsequently, in step 530 , the data processing device retrieves knowledge related to the key entity within the preferred scope to be retrieved to obtain a first retrieval result, and the first retrieval result is used as context information.
[0124] Figure 6 The flowchart is a process for generating context information according to another embodiment of the present application, wherein the process is used to generate context information when a preferred to-be-searched scope does not exist or a first search result is unavailable.
[0125] like Figure 6As shown, in step 610, the data processing device uses the second database corresponding to the key entity of the preset type involved in the user query (the preset type includes, for example, vehicle model and product model, etc.) as the secondary search range. The method for determining the search range has been described above and will not be repeated here.
[0126] Then, the process proceeds to step 620, where the data processing device performs a search operation in the second selected range to be searched. For example, by performing a search in the second selected range to be searched, a search result in the form of a question-answer pair may be obtained, which may include, for example, k result vectors V1 to V2 retrieved from the database in the second selected range to be searched. k .
[0127] Next, in step 630, the data processing device sorts the result vectors based on the similarity between the result vectors and the query vector to obtain sorted result vectors V'1 to V' k .
[0128] After executing step 630, Figure 6 The process shown in FIG. 6 enters step 640. In this step, the data processing device uses, for example, a sliding candidate strategy to select the candidate from the result vectors V'1 to V' based on the keywords included in the user query. k The best matching result vector is determined in , and the best matching result vector is used as the second retrieval result or context information.
[0129] Figure 7 The flowchart is a context information generation process according to another embodiment of the present application, wherein the process is used to generate context information when the current topic scenario is a car purchase evaluation scenario.
[0130] like Figure 7 As shown, in step 710, the data processing device determines whether the user query contains a price range or a car model as a key entity. If it contains at least one of the price range and the car model, it proceeds to step 720, otherwise it proceeds to step 730. Figure 6 The processing flow shown.
[0131] In step 720, the data processing device determines a preferred range to be searched based on the price range or the vehicle model. The method for determining the range to be searched has been described above and will not be repeated here.
[0132] Subsequently, in step 730 , the data processing device retrieves knowledge related to the key entity within the preferred scope to be retrieved to obtain a first retrieval result, and the first retrieval result is used as context information.
[0133] Figure 8The flowchart is a context information generation process according to another embodiment of the present application, wherein the process is used to generate context information when the current topic scenario is an encyclopedia query scenario.
[0134] Figure 8 The process shown in the figure includes two sub-processes executed in parallel, wherein the first sub-process includes steps 810 to 830, and the second sub-process includes Figure 6 By executing in parallel, the speed of dialogue generation can be accelerated, thereby improving the user experience.
[0135] like Figure 8 As shown, in step 810, the data processing device determines the preferred scope to be searched based on the key entities contained in the user query. The method for determining the scope to be searched has been described above and will not be repeated here.
[0136] Then, in step 820, the data processing device searches for knowledge related to the key entity within the preferred scope to be searched to obtain a first search result.
[0137] Then, the data processing device enters step 830 to determine whether the first search result is suitable as context information. If so, the data processing device enters step 840 to determine the first search result as context information. Otherwise, the data processing device enters step 850 to determine the first search result as context information. Figure 6 The second search result obtained by the process shown is used as context information.
[0138] In step 830, illustratively, if the vector dot product similarity of the first search result is less than a preset threshold, it is determined that the first search result is not suitable for use as context information; otherwise, it is determined that the first search result is suitable for use as context information.
[0139] Fig. 9 The flowchart is a context information generation process according to another embodiment of the present application, wherein the process is used to generate context information when the current topic scenario is an encyclopedia query scenario.
[0140] In this embodiment, Figure 8 The two parallel sub-processes shown are executed sequentially and conditionally. Specifically, Fig. 9 Steps 910 to 940 in correspond to Figure 8 The difference between steps 810 to 840 is that Fig. 9 As shown, when it is determined that the first search result is not suitable for use as context information, the process shown will go to Figure 6 The process shown.
[0141] Those skilled in the art will appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described herein may be implemented as electronic hardware, computer software, or a combination of both.
[0142] In order to show the interchangeability between hardware and software, various schematic components, blocks, modules, circuits and steps are generally described above according to their functionality. Such functionality is implemented in hardware form or software form depending on the specific application and the design restrictions imposed on the overall system. Those skilled in the art can implement the described functionality in a variable manner for specific specific applications, but such implementation decisions should not be understood as causing deviations from the scope of the present application.
[0143] Although only some of the specific embodiments of the present application are described, it should be understood by those skilled in the art that the present application can be implemented in many other forms without departing from its subject matter and scope. Therefore, the examples and embodiments shown are considered to be illustrative rather than restrictive, and the present application may include various modifications and substitutions without departing from the spirit and scope of the present application as defined in the appended claims.
[0144] The embodiments and examples set forth herein are provided to best illustrate embodiments according to the present technology and its specific applications, and thereby enable those skilled in the art to implement and use the present application. However, those skilled in the art will appreciate that the above description and examples are provided only for ease of illustration and example. The description set forth is not intended to cover all aspects of the present application or to limit the present application to the precise form disclosed.
[0145] The relevant user personal information that may be involved in the various embodiments of this application is strictly in accordance with the requirements of laws and regulations, following the principles of legality, legitimacy and necessity, based on the reasonable purposes of business scenarios, to process the personal information that users actively provide during the use of products / services or generated due to the use of products / services, as well as the personal information obtained with the user's authorization.
[0146] The user personal information processed by the applicant will vary depending on the specific product / service scenario, and shall be based on the specific scenario in which the user uses the product / service, which may involve the user's account information, device information, driving information, vehicle information or other related information. The applicant will treat the user's personal information and its processing with a high degree of diligence.
[0147] The Applicant attaches great importance to the security of user personal information and has adopted reasonable and feasible security protection measures that comply with industry standards to protect user information and prevent personal information from being accessed, disclosed, used, modified, damaged or lost without authorization.
Claims
1. A generative dialogue system, characterized in that: include: A plurality of first databases, each of which stores first knowledge data related to one of a plurality of topic scenarios; A plurality of second databases, each second database storing second knowledge data related to at least one preset type of key entity; A processing unit, which is configured as follows: A. obtaining a first search result about a user query by performing a search operation within a to-be-searched scope related to a current topic scenario, wherein the current topic scenario is determined based on the user query, and the to-be-searched scope is a subset of a set consisting of the first database and the second database; B. when it is determined that the to-be-searched scope does not exist or the first search result is unavailable, obtaining a second search result regarding the user query by performing a search operation in a second database corresponding to a key entity of a preset type involved in the user query; and C. Input the first retrieval result or the second retrieval result as context information into a large language model to generate a reply text.
2. The generative dialogue system according to claim 1, wherein: The multiple topic scenarios are classified based on the intention of the user's query.
3. The generative dialogue system according to claim 1, wherein: The first database and the second database store the first knowledge data and the second knowledge data in the form of question-answer pairs or chapter blocks, and the first search result and the second search result are represented in at least one of the following forms: question-answer pairs, chapter blocks and real-time query information.
4. The generative dialogue system according to claim 1, wherein: The processing unit is also configured to, before operation A, determine the current topic scenario based on the user query.
5. The generative dialogue system according to claim 1, wherein: The processing unit is also configured to perform pre-processing on the user query before operation A, and the pre-processing includes at least one of the following operations: rewriting the user query, checking the accuracy of the car model or version mentioned in the user query, and extracting key entities related to the current topic scenario from the user query.
6. The generative dialogue system according to claim 1, wherein: Operation A includes: When it is determined that the user query contains a key entity, determining the to-be-searched scope based on the key entity; The knowledge related to the key entity is retrieved within the to-be-retrieved scope as the first retrieval result.
7. The generative dialogue system according to claim 6, wherein: When the vector dot product similarity of the first search result is less than a threshold, it is determined that the first search result is unavailable.
8. The generative dialogue system according to claim 7, wherein: The operation of retrieving knowledge related to the key entity within the to-be-searched scope and the operation of performing a search in a second database corresponding to the key entity of a preset type involved in the user query are performed in parallel.
9. The generative dialogue system of claim 1, wherein: Operation B includes: Generating a query vector from the user query; One or more result vectors are obtained as the second search result by searching a second database corresponding to key entities of a preset type involved in the user query, each of the result vectors corresponding to a question-answer pair.
10. The generative dialogue system according to any one of claims 6 to 8, wherein: The context information is represented in at least one of the following forms: question-answer pairs, chapter blocks, and real-time query information. Operation C includes: Determining corresponding prompt words based on the type of the representation form of the context information, the prompt words including pre-set system prompt words and inquiry prompt words related to the content of the user inquiry; and The prompt word is output to the large language model to generate the reply text.
11. The generative dialogue system according to claim 9, wherein: The context information is represented in at least one of the following forms: question-answer pairs, chapter blocks, and real-time query information. Operation C includes: sorting the result vectors based on similarity to the query vector; Determine the best matching result vector based on the keywords included in the user query by using a sliding candidate strategy, and use the best matching result vector as the second search result; Determining corresponding prompt words based on the type of the representation form of the context information, the prompt words including pre-set system prompt words and inquiry prompt words related to the content of the user inquiry; and The prompt word is output to the large language model to generate the reply text.
12. The generative dialogue system of claim 1, wherein: The large language model is fine-tuned based on positive and negative example data using supervised fine-tuning technology.
13. A generative dialogue method based on retrieval-enhanced generation technology, characterized in that: Include: A. obtaining a first search result about a user query by performing a search operation within a to-be-searched scope related to a current topic scenario, wherein the current topic scenario is determined based on the user query, the to-be-searched scope is a subset of a set consisting of the first database and the second database, each of the first databases stores first knowledge data related to one of a plurality of topic scenarios, and each of the second databases stores second knowledge data related to at least one key entity of a preset type; B. when it is determined that the to-be-searched scope does not exist or the first search result is unavailable, obtaining a second search result regarding the user query by performing a search operation in a second database corresponding to a key entity of a preset type involved in the user query; and The first search result or the second search result is input into a large language model as context information to generate a reply text.
14. A non-transitory computer-readable storage medium having a computer program / instructions stored thereon, characterized in that: The computer program / instructions, when executed by a processor, implement the steps of the method as claimed in claim 13.
15. A computer program product comprising a computer program / instructions, characterized in that The computer program / instructions, when executed by a processor, implement the steps of the method as claimed in claim 13.
Citation Information
Cited By
Automobile intelligent question-answering system and method based on large model and retrieval enhancement
CN119202206A
Intelligent agent dialogue generation method and storage medium
CN120448511A
Information query method, terminal equipment and computer readable storage medium
CN121009106A
