Complex scene dialogue method and system based on large language model
Through keyword extraction and word vector matching techniques, the scene classification number of the large language model is determined, and the corresponding fine-tuning model is called for dialogue output, which solves the problem of large language model losing scene recording in complex dialogue scenarios, and realizes efficient and accurate dialogue processing.
Patent Information
- Application Number
- CN202411051807.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2044-08-01
AI Technical Summary
Large language models are prone to lose some scene records after multiple rounds of dialogue in complex dialogue scenarios, resulting in insufficient accurate dialogue content and poor matching.
By obtaining the single-round dialogue content, extracting keywords and their context conjunctions, generating a word vector set, and correlating it with the set with the highest matching degree of scene template vector set in the template library, determining the scene classification number of the dialogue text, and calling the large language model after fine-tuning of the corresponding classification corpus set for dialogue output.
It realizes efficient large language model dialogue in complex scenarios, quickly and accurately classifies dialogue scenarios, and provides targeted large language model dialogue output, solving the problem that large language model loses scene recording after multiple rounds of dialogue.
Smart Images

Figure CN119088912B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and specifically relates to a complex scenario dialogue method and system based on a large language model. Background Art
[0002] Large Language Model (LLM) refers to a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of language text. Large language models can handle a variety of natural language tasks, such as text classification, question-answering, and conversation, and are an important path to artificial intelligence. Large language models use a Transformer architecture and pre-training goals similar to small models. The difference from small models is the increase in model size, training data, and computing resources. At present, large language models generally have the problem of losing some scene records after multiple rounds of conversations in complex conversation scenarios, resulting in the possibility that the conversation content may not be accurate and matched in some conversation scenarios. Summary of the invention
[0003] The purpose of the present invention is to provide a complex scene dialogue method and system based on a large language model to solve the above-mentioned problems existing in the prior art.
[0004] In order to achieve the above object, the present invention adopts the following technical solutions:
[0005] First, we provide a complex scenario dialogue method based on a large language model, including:
[0006] Obtaining a single-round conversation content for interacting with a large language model, and determining a corresponding conversation text according to the single-round conversation content;
[0007] Perform keyword extraction on the conversation text to obtain a number of keywords, and extract context-related words of each keyword from the conversation text;
[0008] Based on each keyword and its context-related words, generate the word vector corresponding to each keyword, and use the word vector corresponding to each keyword to form a word vector set;
[0009] Determine the matching degree between the word vector set and each scene template vector set in the template library, wherein the template library contains a plurality of scene template vector sets, and each scene template vector set is associated with a corresponding scene classification number;
[0010] Selecting the scene template vector set with the highest matching degree with the word vector set as the target scene template vector set, and using the scene classification number associated with the target scene template vector set as the scene classification number of the dialogue text;
[0011] Determine a corresponding classified corpus set in a corpus according to the scene classification number of the dialogue text, and call a large language model fine-tuned by the classified corpus set as a target large language model;
[0012] The dialogue text is input into the target large language model so that the target large language model outputs dialogue under the corresponding scene classification number according to the dialogue text.
[0013] In a possible design, the single-round conversation content includes single-round conversation voice information, and determining the corresponding conversation text according to the single-round conversation content includes:
[0014] Perform wavelet transform denoising on the single-round conversation speech information to obtain denoised conversation speech information;
[0015] Perform speech recognition on the noise reduction conversation voice information to obtain the corresponding conversation text.
[0016] In a possible design, the conversation text is subjected to keyword extraction to obtain several keywords, including:
[0017] The Textrank4zh keyword extraction tool is used to extract keywords from the conversation text and obtain several keywords.
[0018] In a possible design, generating a word vector corresponding to each keyword based on each keyword and its context-related words includes:
[0019] The keywords and their context-related words are input into the Word2Vec model to generate word vectors and obtain the word vectors corresponding to each keyword.
[0020] In a possible design, determining the matching degree between the word vector set and each scene template vector set in the template library includes:
[0021] The set distance calculation model is used to traverse and calculate the reference distance between each word vector in the word vector set and each template vector in the corresponding scene template vector set. The distance calculation model is
[0022]
[0023] Where D is the reference distance, i is the vector dimension number, n is the maximum vector dimension, x i Represents the component of the word vector in the i vector dimension, y i represents the component of the template vector in the i vector dimension, m is the set index, α is the set first weight coefficient, β is the set second weight coefficient, ‖·‖2 represents the two-norm operator;
[0024] Substituting the reference distance between each word vector in the word vector set and each template vector in the corresponding scene template vector set into a preset similarity formula for calculation, the similarity between each word vector in the word vector set and each template vector in the corresponding scene template vector set is obtained, and the similarity formula is S=(C / D)×100%, where S represents the similarity and C is a set constant;
[0025] According to the similarity between each word vector in the word vector set and each template vector in the corresponding scene template vector set, the matching degree between the word vector set and the corresponding scene template vector set is determined.
[0026] In a possible design, determining the matching degree between the word vector set and the corresponding scene template vector set according to the similarity between each word vector in the word vector set and each template vector in the corresponding scene template vector set includes:
[0027] The word vectors and template vectors whose similarity reaches the set similarity threshold condition are taken as matching vector pairs, and the number of matching vector pairs between the word vector set and the corresponding scene template vector set is determined;
[0028] Substitute the number of matching vector pairs between the word vector set and the corresponding scene template vector set, the similarity of each matching vector pair, and the number of word vectors in the word vector set into the preset matching degree formula for calculation to obtain the matching degree between the word vector set and the corresponding scene template vector set. The matching degree formula is:
[0029]
[0030] Among them, P represents the matching degree, G1 is the number of word vectors in the word vector set, G2 is the number of matching vector pairs between the word vector set and the corresponding scene template vector set, ω is the setting coefficient, j is the sequence number of the matching vector pair between the word vector set and the corresponding scene template vector set, S j is the similarity of the corresponding matching vector pairs.
[0031] In one possible design, the method further includes:
[0032] According to the scene classification number of the dialogue text, the corresponding keywords are updated and added to the corresponding classification corpus set in the corpus.
[0033] In the second aspect, a complex scene dialogue system based on a large language model is provided, including a content acquisition unit, a word extraction unit, a vector generation unit, an association matching unit, a scene classification unit, a model calling unit and a dialogue output unit, wherein:
[0034] A content acquisition unit, used to acquire single-round dialogue content for interacting with the large language model, and determine a corresponding dialogue text according to the single-round dialogue content;
[0035] A word and sentence extraction unit is used to extract keywords from the dialogue text to obtain a number of keywords, and to extract context-related words of each keyword from the dialogue text;
[0036] A vector generating unit, used to generate a word vector corresponding to each keyword based on each keyword and its context-related words, and to form a word vector set using the word vectors corresponding to each keyword;
[0037] An association matching unit, used to determine the matching degree between the word vector set and each scene template vector set in the template library, wherein the template library contains a plurality of scene template vector sets, and each scene template vector set is associated with a corresponding scene classification number;
[0038] A scene classification unit, used to select the scene template vector set with the highest matching degree with the word vector set as the target scene template vector set, and use the scene classification number associated with the target scene template vector set as the scene classification number of the dialogue text;
[0039] A model calling unit, used to determine a corresponding classified corpus set in a corpus according to a scene classification number of a dialogue text, and call a large language model fine-tuned by the classified corpus set as a target large language model;
[0040] The dialogue output unit is used to input the dialogue text into the target large language model so that the target large language model can output the dialogue under the corresponding scene classification number according to the dialogue text.
[0041] Third, we provide a complex scenario dialogue system based on a large language model, including:
[0042] A memory for storing instructions;
[0043] A processor is used to read the instructions stored in the memory and execute any one of the methods described in the first aspect according to the instructions.
[0044] In a fourth aspect, a complex scenario dialogue system based on a large language model is provided, wherein the system is installed with a computer program product, and when the computer program product runs on the system, the system executes any one of the methods described in the first aspect.
[0045] Beneficial effects: The present invention extracts keywords and generates word vectors for the user's conversation text to obtain a corresponding word vector set, then selects a target scene template vector set based on the matching similarity between the word vector set and each scene template vector set, and determines the corresponding scene classification number, and then calls a large language model that has been fine-tuned by the corresponding classification corpus set based on the scene classification number to input the conversation text for conversation output under the corresponding scene classification number, so as to achieve efficient large language model conversations in complex scenes. The present invention can quickly and accurately classify conversation scenes according to the user's conversation content, and provide targeted large language model conversation outputs under the corresponding conversation scene classification, so as to solve the problem that the large language model loses some scene records after multiple rounds of conversations, thereby achieving more accurate conversation processing in complex scenes. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 This is a schematic diagram of the steps of the method in Example 1 of the present invention;
[0048] Figure 2 This is a schematic diagram of the structure of the system in Example 2 of the present invention;
[0049] Figure 3 Schematic diagram of the system structure in Example 3 of the present invention. DETAILED DESCRIPTION
[0050] It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention. The specific structures and functional details disclosed herein are only used to describe the exemplary embodiments of the present invention. However, the present invention can be embodied in many alternative forms, and it should not be understood that the present invention is limited to the embodiments set forth herein.
[0051] It should be understood that, unless otherwise clearly specified and limited, the term "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the embodiments can be understood according to specific circumstances.
[0052] In the following description, certain details are provided to facilitate a complete understanding of the example embodiments. However, it will be appreciated by those of ordinary skill in the art that the example embodiments may be implemented without these certain details. For example, the system may be shown in a block diagram to avoid obscuring the example with unnecessary details. In other embodiments, well-known processes, structures, and techniques may not be shown in unnecessary detail to avoid obscuring the embodiments.
[0053] Embodiment 1:
[0054] This embodiment provides a complex scenario dialogue method based on a large language model, which can be applied to a corresponding large language model server, such as Figure 1 As shown, the method comprises the following steps:
[0055] S1. Obtain a single-round dialogue content for interacting with a large language model, and determine a corresponding dialogue text based on the single-round dialogue content.
[0056] During specific implementation, the server obtains the content of a single-round conversation in which the user needs to interact with the large language model; the single-round conversation content can be single-round conversation voice information or single-round conversation text information; if it is single-round conversation text information, it can be directly used for subsequent processing steps; if it is single-round conversation voice information, it is necessary to first perform wavelet transform denoising on the single-round conversation voice information to obtain noise-reduced conversation voice information, and then perform speech recognition on the noise-reduced conversation voice information, such as extracting audio features, using the corresponding model to perform speech recognition on the audio features, and obtain the corresponding conversation text.
[0057] S2. Perform keyword extraction on the dialogue text to obtain a number of keywords, and extract context-related words of each keyword from the dialogue text.
[0058] In specific implementation, the server uses the Textrank4zh keyword extraction tool to extract keywords from the conversation text to obtain a number of keywords, and then extracts context-related words of each keyword from the conversation text.
[0059] S3. Based on each keyword and its context-related words, generate a word vector corresponding to each keyword, and use the word vector corresponding to each keyword to form a word vector set.
[0060] In specific implementation, the server can input each keyword and its corresponding context-related words into the Word2Vec model to generate word vectors, and obtain word vectors corresponding to each keyword. Word vectors are real number vectors mapped from words or phrases in natural language. The dimension of word vectors can be set according to specific application requirements and computing resources. Common dimensions include 30, 50, 60, 100, etc.
[0061] S4. Determine the matching degree between the word vector set and each scene template vector set in the template library, wherein the template library contains several scene template vector sets, and each scene template vector set is associated with a corresponding scene classification number.
[0062] In specific implementation, the server uses a set distance calculation model to traverse and calculate the reference distance between each word vector in the word vector set and each template vector in the corresponding scene template vector set. The distance calculation model is
[0063]
[0064] Where D is the reference distance, i is the vector dimension number, n is the maximum vector dimension, x i Represents the component of the word vector in the i vector dimension, y i represents the component of the template vector in the i vector dimension, m is the set index, α is the set first weight coefficient, β is the set second weight coefficient, ‖·‖2 represents the two-norm operator;
[0065] The reference distance between each word vector in the word vector set and each template vector in the corresponding scene template vector set is substituted into the preset similarity formula for calculation to obtain the similarity between each word vector in the word vector set and each template vector in the corresponding scene template vector set. The similarity formula is S = (C / D) × 100%, where S represents the similarity and C is a set constant.
[0066] According to the similarity between each word vector in the word vector set and each template vector in the corresponding scene template vector set, the matching degree between the word vector set and the corresponding scene template vector set is determined; the process includes:
[0067] The word vectors and template vectors whose similarity reaches the set similarity threshold condition are taken as matching vector pairs, and the number of matching vector pairs between the word vector set and the corresponding scene template vector set is determined;
[0068] Substitute the number of matching vector pairs between the word vector set and the corresponding scene template vector set, the similarity of each matching vector pair, and the number of word vectors in the word vector set into the preset matching degree formula for calculation to obtain the matching degree between the word vector set and the corresponding scene template vector set. The matching degree formula is:
[0069]
[0070] Among them, P represents the matching degree, G1 is the number of word vectors in the word vector set, G2 is the number of matching vector pairs between the word vector set and the corresponding scene template vector set, ω is the setting coefficient, j is the sequence number of the matching vector pair between the word vector set and the corresponding scene template vector set, S j is the similarity of the corresponding matching vector pairs.
[0071] S5. Select the scene template vector set with the highest matching degree with the word vector set as the target scene template vector set, and use the scene classification number associated with the target scene template vector set as the scene classification number of the dialogue text.
[0072] In specific implementation, the server selects a scene template vector set with the highest matching degree with the word vector set from all scene template vector sets as the target scene template vector set according to the matching degree between the word vector set and each scene template vector set. Then, the scene classification number associated with the target scene template vector set is determined, and the scene classification number associated with the target scene template vector set is used as the scene classification number of the dialogue text.
[0073] S6. Determine the corresponding classified corpus set in the corpus according to the scene classification number of the dialogue text, and call the large language model fine-tuned by the classified corpus set as the target large language model.
[0074] During specific implementation, the server determines the classification corpus set corresponding to the scene classification number in the corpus according to the scene classification number of the conversation text, and then calls the large language model that has been fine-tuned by the classification corpus set as the target large language model. The classification corpus set contains several corpus words and sentences corresponding to the scene classification, and each classification corpus set can be used to fine-tune the basic large language model for the corresponding scene classification. Large language model fine-tuning refers to further classification training based on the trained large language model using a specific small classification data set to adapt the large language model to specific classification scenarios. The purpose of fine-tuning is to transform the general large language model into a dedicated model for a specific classification scenario, bridging the gap between the general pre-trained model and specific application requirements, and ensuring the accuracy of the large language model in processing specific scenarios.
[0075] S7. Input the dialogue text into the target large language model so that the target large language model outputs dialogue under the corresponding scene classification number according to the dialogue text.
[0076] In specific implementation, the dialogue text can be input into the target large language model so that the target large language model can output dialogues under the corresponding scene classification number according to the dialogue text, thus realizing efficient large language model dialogues under complex scenes. At the same time, the keywords that are not in the corresponding classification corpus set in the corpus can be updated and supplemented to the classification corpus set according to the scene classification number of the dialogue text to improve its subsequent applicability.
[0077] The method of this embodiment can quickly and accurately classify conversation scenarios according to the content of a single round of conversations of the user, and provide targeted large language model conversation output under the corresponding conversation scenario classification, so as to solve the problem that the large language model loses some scene records after multiple rounds of conversations, thereby achieving more accurate conversation processing in complex scenarios.
[0078] Embodiment 2:
[0079] This embodiment provides a complex scenario dialogue system based on a large language model, such as Figure 2 As shown, it includes a content acquisition unit, a word extraction unit, a vector generation unit, an association matching unit, a scene classification unit, a model calling unit and a dialogue output unit, wherein:
[0080] A content acquisition unit, used to acquire single-round dialogue content for interacting with the large language model, and determine a corresponding dialogue text according to the single-round dialogue content;
[0081] A word and sentence extraction unit is used to extract keywords from the dialogue text to obtain a number of keywords, and to extract context-related words of each keyword from the dialogue text;
[0082] A vector generating unit, used to generate a word vector corresponding to each keyword based on each keyword and its context-related words, and to form a word vector set using the word vectors corresponding to each keyword;
[0083] An association matching unit, used to determine the matching degree between the word vector set and each scene template vector set in the template library, wherein the template library contains a plurality of scene template vector sets, and each scene template vector set is associated with a corresponding scene classification number;
[0084] A scene classification unit, used to select the scene template vector set with the highest matching degree with the word vector set as the target scene template vector set, and use the scene classification number associated with the target scene template vector set as the scene classification number of the dialogue text;
[0085] A model calling unit, used to determine a corresponding classified corpus set in a corpus according to a scene classification number of a dialogue text, and call a large language model fine-tuned by the classified corpus set as a target large language model;
[0086] The dialogue output unit is used to input the dialogue text into the target large language model so that the target large language model can output the dialogue under the corresponding scene classification number according to the dialogue text.
[0087] Embodiment 3:
[0088] This embodiment provides a complex scenario dialogue system based on a large language model, such as Figure 3 As shown, at the hardware level, it includes:
[0089] Data interface, used to establish data connection between the processor and the external data terminal;
[0090] A memory for storing instructions;
[0091] A processor is used to read the instructions stored in the memory and execute the complex scene dialogue method based on the large language model in Example 1 according to the instructions.
[0092] Optionally, the device further comprises an internal bus. The processor and the memory and the data interface may be interconnected via the internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0093] The memory may include, but is not limited to, random access memory (RAM), read only memory (ROM), flash memory, first input first output (FIFO) and / or first in last out (FILO) memory, etc. The processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0094] Embodiment 4:
[0095] This embodiment provides a computer-readable storage medium, on which instructions are stored. When the instructions are executed on a computer, the computer executes the complex scene dialogue method based on a large language model in Embodiment 1. The computer-readable storage medium refers to a carrier for storing data, which may include but is not limited to a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive, and / or a memory stick, etc. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable systems.
[0096] This embodiment also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the complex scene dialogue method based on a large language model in Embodiment 1. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable systems.
[0097] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A complex scene dialogue method based on a large language model, characterized by: include: Obtaining a single-round conversation content for interacting with a large language model, and determining a corresponding conversation text according to the single-round conversation content; Perform keyword extraction on the conversation text to obtain a number of keywords, and extract context-related words of each keyword from the conversation text; Based on each keyword and its context-related words, generate the word vector corresponding to each keyword, and use the word vector corresponding to each keyword to form a word vector set; Determine the matching degree between the word vector set and each scene template vector set in the template library, wherein the template library contains a plurality of scene template vector sets, and each scene template vector set is associated with a corresponding scene classification number; Selecting the scene template vector set with the highest matching degree with the word vector set as the target scene template vector set, and using the scene classification number associated with the target scene template vector set as the scene classification number of the dialogue text; Determine a corresponding classified corpus set in a corpus according to the scene classification number of the dialogue text, and call a large language model fine-tuned by the classified corpus set as a target large language model; Inputting the dialogue text into the target large language model so that the target large language model outputs dialogues under corresponding scene classification numbers according to the dialogue text; The determining of the matching degree between the word vector set and each scene template vector set in the template library includes: The set distance calculation model is used to traverse and calculate the reference distance between each word vector in the word vector set and each template vector in the corresponding scene template vector set. The distance calculation model is Where D is the reference distance, i is the vector dimension number, n is the maximum vector dimension, x i Represents the component of the word vector in the i vector dimension, y i Characterizes the component of the template vector in the i vector dimension, m is the set index, α is the set first weight coefficient, β is the set second weight coefficient, Characterize the two-norm operator; Substitute the reference distance between each word vector in the word vector set and each template vector in the corresponding scene template vector set into the preset similarity formula for calculation to obtain the similarity between each word vector in the word vector set and each template vector in the corresponding scene template vector set. The similarity formula is: 00%, where S represents the similarity and C is a set constant; Determine the matching degree between the word vector set and the corresponding scene template vector set according to the similarity between each word vector in the word vector set and each template vector in the corresponding scene template vector set; The determining the matching degree between the word vector set and the corresponding scene template vector set according to the similarity between each word vector in the word vector set and each template vector in the corresponding scene template vector set includes: The word vectors and template vectors whose similarity reaches the set similarity threshold condition are taken as matching vector pairs, and the number of matching vector pairs between the word vector set and the corresponding scene template vector set is determined; Substitute the number of matching vector pairs between the word vector set and the corresponding scene template vector set, the similarity of each matching vector pair, and the number of word vectors in the word vector set into the preset matching degree formula for calculation to obtain the matching degree between the word vector set and the corresponding scene template vector set. The matching degree formula is: Among them, P represents the matching degree, G1 is the number of word vectors in the word vector set, G2 is the number of matching vector pairs between the word vector set and the corresponding scene template vector set, ω is the setting coefficient, j is the sequence number of the matching vector pair between the word vector set and the corresponding scene template vector set, S j is the similarity of the corresponding matching vector pairs.
2. The complex scene dialogue method based on a large language model according to claim 1, characterized in that: The single-round conversation content includes single-round conversation voice information, and determining the corresponding conversation text according to the single-round conversation content includes: Perform wavelet transform denoising on the single-round conversation speech information to obtain denoised conversation speech information; Perform speech recognition on the noise reduction conversation voice information to obtain the corresponding conversation text.
3. The complex scene dialogue method based on a large language model according to claim 1, characterized in that: The keyword extraction of the dialogue text obtains several keywords, including: The Textrank4zh keyword extraction tool is used to extract keywords from the conversation text and obtain several keywords.
4. The complex scene dialogue method based on a large language model according to claim 1, characterized in that: The generating of word vectors corresponding to the keywords based on the keywords and their context-related words includes: The keywords and their context-related words are input into the Word2Vec model to generate word vectors and obtain the word vectors corresponding to each keyword.
5. The complex scene dialogue method based on a large language model according to claim 1, characterized in that: The method further comprises: According to the scene classification number of the dialogue text, the corresponding keywords are updated and added to the corresponding classification corpus set in the corpus.
6. Complex scenario dialogue system based on large language model, characterized by: It includes a content acquisition unit, a word extraction unit, a vector generation unit, an association matching unit, a scene classification unit, a model calling unit and a dialogue output unit, wherein: A content acquisition unit, used to acquire single-round dialogue content for interacting with the large language model, and determine a corresponding dialogue text according to the single-round dialogue content; A word and sentence extraction unit is used to extract keywords from the dialogue text to obtain a number of keywords, and to extract context-related words of each keyword from the dialogue text; A vector generating unit, used to generate a word vector corresponding to each keyword based on each keyword and its context-related words, and to form a word vector set using the word vectors corresponding to each keyword; An association matching unit, used to determine the matching degree between the word vector set and each scene template vector set in the template library, wherein the template library contains a plurality of scene template vector sets, and each scene template vector set is associated with a corresponding scene classification number; A scene classification unit, used to select the scene template vector set with the highest matching degree with the word vector set as the target scene template vector set, and use the scene classification number associated with the target scene template vector set as the scene classification number of the dialogue text; A model calling unit, used to determine a corresponding classified corpus set in a corpus according to a scene classification number of a dialogue text, and call a large language model fine-tuned by the classified corpus set as a target large language model; A dialogue output unit, used to input the dialogue text into the target large language model, so that the target large language model performs dialogue output under the corresponding scene classification number according to the dialogue text; The determining of the matching degree between the word vector set and each scene template vector set in the template library includes: The set distance calculation model is used to traverse and calculate the reference distance between each word vector in the word vector set and each template vector in the corresponding scene template vector set. The distance calculation model is Where D is the reference distance, i is the vector dimension number, n is the maximum vector dimension, x i Represents the component of the word vector in the i vector dimension, y i Characterizes the component of the template vector in the i vector dimension, m is the set index, α is the set first weight coefficient, β is the set second weight coefficient, Characterize the two-norm operator; Substitute the reference distance between each word vector in the word vector set and each template vector in the corresponding scene template vector set into the preset similarity formula for calculation to obtain the similarity between each word vector in the word vector set and each template vector in the corresponding scene template vector set. The similarity formula is: 00%, where S represents the similarity and C is a set constant; Determine the matching degree between the word vector set and the corresponding scene template vector set according to the similarity between each word vector in the word vector set and each template vector in the corresponding scene template vector set; The determining the matching degree between the word vector set and the corresponding scene template vector set according to the similarity between each word vector in the word vector set and each template vector in the corresponding scene template vector set includes: The word vectors and template vectors whose similarity reaches the set similarity threshold condition are taken as matching vector pairs, and the number of matching vector pairs between the word vector set and the corresponding scene template vector set is determined; Substitute the number of matching vector pairs between the word vector set and the corresponding scene template vector set, the similarity of each matching vector pair, and the number of word vectors in the word vector set into the preset matching degree formula for calculation to obtain the matching degree between the word vector set and the corresponding scene template vector set. The matching degree formula is: Among them, P represents the matching degree, G1 is the number of word vectors in the word vector set, G2 is the number of matching vector pairs between the word vector set and the corresponding scene template vector set, ω is the setting coefficient, j is the sequence number of the matching vector pair between the word vector set and the corresponding scene template vector set, S j is the similarity of the corresponding matching vector pairs.
7. Complex scenario dialogue system based on large language model, characterized by: include: A memory for storing instructions; A processor is used to read the instructions stored in the memory and execute the complex scene dialogue method based on a large language model according to any one of claims 1 to 5.
8. Complex scenario dialogue system based on large language model, characterized by: The system is installed with a computer program product, and when the computer program product runs on the system, the system executes the complex scene dialogue method based on a large language model as described in any one of claims 1-5.
Citation Information
Patent Citations
Dialogue generation method, apparatus and device, and computer readable medium
CN117972043A
Writing method, system and equipment based on generative text large model and medium
CN118246426A