Large model dialogue target guiding method and system
By introducing preset dialogue goals and user intention recognition methods in large-scale dialogue, the problem of insufficient target guidance in multiple rounds of dialogue is solved, and the consistency and targeted improvement of dialogue is achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202411961856.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-25
AI Technical Summary
In the multi-round dialogue scenarios of large-scale language models, the lack of an effective dialogue goal guidance mechanism leads to a deviation from the goal of the dialogue generation process and it is difficult to maintain the continuity of specific dialogue goals.
A big model dialogue target guidance method is proposed. By obtaining the relevant corpus that generates preset dialogue targets, using a pre-trained embedded model for encoding, combining the user's historical question-and-answer pairs and current dialogue data, the intent recognition model is used for intent recognition, calculating the gap between the preset dialogue target and the user's current dialogue intention, generating a target guidance prompt word, and dynamically adjusting the direction of subsequent dialogues.
It significantly improves the consistency, pertinence and user experience of the conversation, allowing the big model to flexibly respond to users' immediate needs and effectively guide in the predetermined target direction.
Smart Images

Figure CN119884316A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence technology, and in particular relates to a large-model dialogue target guidance method and system. Background Art
[0002] Large-scale language models are the mainstream technical solution in the field of intelligent dialogue systems. However, in multi-round dialogue scenarios, the lack of an effective dialogue goal guidance mechanism can easily cause the dialogue generation process to deviate from the goal and make it difficult to maintain continuity towards specific dialogue goals.
[0003] Existing technologies mainly rely on manually designed rules or limited guidance mechanisms, such as predefined dialogue states, decision trees, or template generation mechanisms to control the direction of the dialogue and help large models maintain the goal of the dialogue. However, this method relies on a lot of manual adjustments, has high development costs, and is complex to maintain.
[0004] In recent years, researchers have tried to introduce reinforcement learning, pre-trained model fine-tuning and other technologies to reduce reliance on manual rules and improve the purposefulness and coherence of conversations. However, they are still unable to fully utilize the potential advantages of large models and have failed to fully tap the full potential of large models. They have certain limitations when faced with complex conversation goals. Summary of the invention
[0005] The purpose of the present invention is to solve the technical problem of lack of target guidance mechanism in existing large-model multi-round dialogues, so as to make the dialogues of large models more purposeful.
[0006] To achieve the above object, the present invention proposes a large model dialogue target guidance method, comprising the following steps:
[0007] S110, obtaining and generating a preset dialogue target v T The relevant corpus Text is encoded using the pre-trained embedding model to generate the preset dialogue target v of the large model dialogue T ;
[0008] S120, based on the user's question, combined with the user's historical question-answer pairs and current conversation data, use the intention recognition large model to perform intention recognition to obtain the user's current conversation intention;
[0009] S130, introduce the loss function and calculate the preset dialogue target v T The gap between the user's current conversation intention and the preset conversation goal v is obtained to obtain the target guidance text and measure the user's current conversation intention and the preset conversation goal v T The degree of matching;
[0010] S140, according to the target guidance text obtained in S130, the intention recognition model dynamically adjusts the direction of the subsequent dialogue, and according to the preset dialogue target vT The gap between the user's current conversation intention and the target guidance prompt words are generated;
[0011] S150, the large model obtains the user's dialogue history and the preset dialogue target v according to the text information in the target guidance prompt word generated in S140 T The knowledge of the relevant corpus Text changes the data distribution of the large model in the current dialogue and generates a more consistent dialogue target v T After the answer is completed, the system adds this round of conversation to the conversation database.
[0012] Furthermore, in S110, the preset dialogue target v of the large model dialogue T for:
[0013] v T =Pooling(Encoder({E(w1),E(w2),…,E(w n )}))
[0014] Among them, Pooling is the pooling operation, Encoder is the encoder used, and E is the pre-trained embedding model for a single Chinese character w n Perform embedding operations, where n is the number of conversation rounds;
[0015] The encoding using the pre-trained embedding model includes:
[0016] Inputting dialogue target related corpus, wherein the corpus includes the dialogue target and information related to the target, and question-answer pairs;
[0017] Perform vectorized embedding of target-related corpus and store it in the vector database.
[0018] Furthermore, S120 includes:
[0019] Step S121: Obtain the input text UserText of the user's nth round of dialogue n Dialogue with history text Combine question and answer pairs to obtain the nth round of user dialogue history text FullUserText n ;
[0020] Step S122: The nth round of user dialogue history text FullUserText n Input the intention recognition model to perform intent recognition and extraction: Input the intention recognition prompt word into the intention recognition model to obtain the user conversation intent UserIntention in this round of conversation n .
[0021] Furthermore, S130 includes:
[0022] Step S131: The user conversation intention UserIntention obtained in S122 is n Through the pre-trained embedding model, encoding is performed to obtain the vectorized user conversation intention v U :
[0023] v U =Pooling(Transformer({E(w1),E(w2),…,E(w n )}))
[0024] Among them, v U is the final embedding result of the input text, Pooling is the pooling operation, Transformer is the encoder used, and E is the pre-trained embedding model for a single Chinese character w n To perform embedded operations, Chinese characters w n UserIntention n Characters;
[0025] Step S132: Calculate the dialogue deviation degree L(v U ,v T ), the formula is:
[0026]
[0027] Among them, v T ·v U is the dot product of two vectors, ||v T || is the norm of the vector;
[0028] Step S133: vectorize the user conversation intention v U Compare with the pre-learned non-target dialogue intent to provide direction for the large model to guide the target and obtain the target guidance text GuideText n for:
[0029] GuideText n =L(v U ,v T )·LLM(v U ,Text)
[0030] The operation represents the guiding strength that affects the large model, LLM represents the step of inputting Text into the intention recognition large model for output, and Text is the text that corresponds to the preset dialogue target v T Related corpus.
[0031] Furthermore, S140 includes:
[0032] The dialogue deviation degree L(v U ,v T ), the target guide text GuideText obtained in step S133 n , and the preset dialogue target v T The relevant corpus Text is input into the intention recognition model according to the rule combination, and the target guiding prompt word of the user's n-th round of dialogue is obtained as follows:
[0033] FinalGuideText n =LLM({L(v U ,v T ),GuideText n ,Text})
[0034] Among them, {L(v U ,v T ),GuideText n ,Text} is the text content of the input intention recognition model.
[0035] The present invention also proposes a large-model dialogue target guidance system, including a target setting module, a vector embedding module, a dialogue history module, an intention recognition module and a question-answering module, wherein:
[0036] The target setting module is used to obtain preset information, perform word embedding, and preset the initial distribution of the large model dialogue;
[0037] The vector embedding module is used to encode text input according to the pre-trained embedding model and output it;
[0038] The dialogue history module is used to save the question-answer pairs between the user and the large model and input them into the intent recognition module;
[0039] The intention recognition module is used to analyze the user's intention based on the user's historical question-answer pairs and current question, combined with the preset dialogue goals and related corpus, using the intention recognition large model to give the target guidance prompt words;
[0040] The question-answering module is used to obtain user input, combine the user input with the target guidance prompt word, output it to the large model to generate a dialogue answer, and present the dialogue answer to the user.
[0041] Furthermore, the question-answering module includes:
[0042] The big model backend server is used to receive the user dialogue and the target guidance prompt words generated by the system, combine the user dialogue and the target guidance prompt words into the request format of the big model, pass it to the big model and get the answer, and return it to the graphical interactive interface submodule;
[0043] The load balancing and scheduling submodule is used to schedule user requests and select idle servers for request forwarding according to the load of the large model backend server;
[0044] The graphical interactive interface submodule is used for user interaction, including a text input box and a window for displaying the conversation content.
[0045] Furthermore, the vector embedding module includes:
[0046] The text vectorization encoding submodule is used to vectorize the user input using the pre-trained Transformer architecture natural language processing model;
[0047] The information preprocessing submodule is used to perform normalization processing on user input, and the normalization processing includes error correction, noise removal and text cleaning.
[0048] Furthermore, the conversation history module includes:
[0049] Vector database, used to store high-dimensional vector information and support related add, delete, modify and query operations;
[0050] The vector database reading and writing submodule is used to store various required text information in the form of high-dimensional vectors into the vector database, and is used for the interaction between other modules and the vector database;
[0051] Relational database, used to store relational text information and support related add, delete, modify and query operations;
[0052] The relational database reading and writing submodule is used to store various required text information in the relational database in the form of text, and is used for the interaction between other modules and the relational database.
[0053] Furthermore, the target setting module includes:
[0054] The preset information acquisition submodule is used to capture the network, manually input or generate preset information with the assistance of artificial intelligence, and organize it into a suitable format;
[0055] Fine-tune the optimization submodule to optimize the conversation based on the preset dialogue target v T Fine-tune and optimize large models;
[0056] The target setting submodule is used to store various vectorized preset information in the vector database, and the preset information is used for subsequent target intention recognition and dialogue direction guidance.
[0057] Furthermore, the intention recognition module includes:
[0058] The intent extraction submodule uses the pre-trained embedding model to obtain the user's current intent based on the conversation history and current question, and performs vectorized encoding.
[0059] The intent analysis submodule is used to find the closest matching preset target intents in the vector database according to the vectorized user's current intent, and calculate the similarity based on the cosine similarity;
[0060] The target setting submodule is used to obtain target guidance prompt words through the intention recognition model according to the user's current intention, preset target intention and similarity.
[0061] Compared with the prior art, the advantages and positive effects of the present invention are:
[0062] 1. The present invention provides a large-model dialogue goal guidance method. By setting dialogue task goals, the subsequent dialogue is adjusted in real time according to the gap between the user's current dialogue and the preset goal, so that the large model can not only flexibly respond to the user's immediate needs, but also effectively guide it in the predetermined direction, significantly improving the continuity, pertinence and user experience of the dialogue.
[0063] 2. The present invention efficiently realizes the recognition of the user's historical intention in dialogue through the method of comparing the embedding distance between historical dialogue and target guiding sentence. Based on the calculation method of additional target loss, it can gradually narrow the gap between user intention and target in multiple rounds of dialogue, thereby improving the completion rate and effectiveness of dialogue tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 is a flow chart of the method of the present invention;
[0065] Figure 2 It is a system structure diagram of the present invention. DETAILED DESCRIPTION
[0066] In order to better understand the purpose, technical solution and function of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings, but the present invention can be implemented in a variety of different ways as defined and covered by the claims. The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention, and the exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention.
[0067] In a specific embodiment of the present invention, a process of a large model dialogue target guidance method is as follows: Figure 1 As shown, the specific steps include:
[0068] S110, setting the goal of the large model dialogue, encoding using the pre-trained embedding model, and generating an embedding vector that can be used for subsequent dialogue matching;
[0069] S120: Based on the user's question, the user's historical question and answer records and current conversation data are combined to use a large model to perform intent recognition, understand the user's current needs, and obtain the current user intent;
[0070] S130: This step will introduce additional computational losses to calculate the preset dialogue target v T The gap between the user's current conversation intention and the preset goal is obtained to obtain the target guidance text of the input intention recognition model, which measures the matching degree between the user's current conversation intention and the preset goal;
[0071] S140, according to the target guidance text obtained in S130, the intention recognition model will dynamically adjust the direction of the subsequent dialogue, and according to the gap between the user dialogue and the preset goal, that is, the degree of deviation and the direction of deviation, finally generate appropriate target guidance prompt words to guide the large model to generate a response that is more in line with the goal;
[0072] S150. Based on the target guidance prompt words obtained in S140, the large model will adjust the strategy of this round of dialogue in combination with the user's historical question-answer pairs, and generate a suitable response to the user's latest input. After the answer is completed, the system adds this round of dialogue to the dialogue database. According to the actual needs of the user, you can choose to loop the dialogue process or end the dialogue.
[0073] In a specific embodiment of the present invention, taking an e-commerce scenario as an example, users' shopping decisions on e-commerce platforms are often completed through multiple rounds of interaction. Users will ask a series of questions during the browsing process to gradually narrow down the range of choices. The large model can maintain a deep understanding of user intentions in such multiple rounds of dialogue, and can guide users throughout the dialogue process to provide more targeted suggestions and product screening.
[0074] When introducing products and guiding purchases in e-commerce scenarios, step S110 includes obtaining input dialogue target-related corpus, which includes the basic dialogue target and historical question-answer pairs with users. First, set the target v of the large model dialogue. T , for different items i , with different description texts i , the description text Text i It can be the product's parameters, attributes, functions, and other descriptive texts.
[0075] Specifically, in step S110, the formula of the pre-trained embedding model used is:
[0076] v T =Pooling(Encoder({E(w1),E(w2),…,E(w n )}))
[0077] Among them, v T is the final embedding result of the input text, that is, the preset target intention for vectorization, Pooling is the pooling operation, Encoder is the encoder used, and E is the pre-trained embedding model for a single Chinese character w n Perform the embed operation.
[0078] Specifically, the pre-trained embedding model is a Transformer-type embedding model, which can convert text into a high-dimensional vector and capture its semantic information. In this embodiment, all-MiniLM-L12-v2 is used. This model is based on the Transformer architecture and can convert a sentence into a 384-dimensional embedding vector.
[0079] Specifically, in step S110, the target-related corpus is vectorized and embedded and stored in a vector database, and the dimension of the pre-trained embedding model used reaches more than 384 dimensions. The vector database can be implemented using open source such as Chroma and FAISS.
[0080] In step S120, the big model is used for intent recognition. The text extraction and summarization capabilities of the big model are required to obtain the user intent in a specified format, such as the conversation intent of "asking about the price / performance ratio of the product". In this part, the corpus input into the big model includes the corpus using plain text and the corpus obtained by the slot filling method.
[0081] Step S121, first obtain the input text UserText of the user's nth round of dialogue n Dialogue with history text Combine question and answer pairs to get FullUserText n .
[0082] Step S122: FullUserText n Through the intention recognition model, the intention recognition and extraction are performed. This process will convert the user's total conversation data of n rounds into FullUserText n In summary, the large model for intent recognition can be a fine-tuned Qwen2_7B model to ensure a balance between effect and cost.
[0083] First, input the intent recognition prompt word into the intent recognition big model. For example, in this embodiment, it can be "system: Use extremely simple language to analyze the user's conversation intention in the e-commerce shopping conversation scenario and give a 20-word summary." Through the summary of the big model, the refined and brief user conversation intention UserIntention in this conversation is obtained. n .
[0084] In step S130, the steps of using the target loss function for evaluation are as follows:
[0085] Step S131: The user conversation intention UserIntention obtained in S122 is n Through the pre-trained embedding model, encoding is performed to obtain the vectorized dialogue intent v U The steps can be summarized as the following formula:
[0086] v U =Pooling(Transformer({E(w1),E(w2),…,E(w n )}))
[0087] Among them, v U is the final embedding result of the input text, that is, the vectorized conversation intention, Pooling is the pooling operation, Transformer is the encoder used, and E is the pre-trained embedding model for a single Chinese character w n Perform the embedding operation, in which the Chinese character w n UserIntention n Characters.
[0088] Step S132: To ensure the effectiveness and consistency of the conversation, the system calculates the gap between the preset goal and the user's current intention and introduces additional computational loss. This includes vectorizing the conversation intention v U and vectorized preset target intention v T The difference between them is calculated, and the dialogue deviation degree L(v U ,v T ), in this application example, cosine similarity is used to measure the similarity of high-dimensional vectors, and its formula is as follows:
[0089]
[0090] Among them, v T ·v U is the dot product of two vectors, ||v T || is the norm of the vector, L(v U ,v T ) value, the greater the gap between the user's current intention and the preset goal. This parameter affects the intensity of the subsequent goal guidance of the large model. U ,v T ) is small, then there is no excessive intervention in the current conversation; otherwise, a clear purchase screening is performed, such as guiding the big model to ask the user about the specific product features they need.
[0091] Step S133: according to the user's conversation intention v U, compared with the pre-learned non-target dialogue intent, its expression is:
[0092] GuideText n =L(v U ,v T )·LLM(v U ,Text)
[0093] This step provides the direction GuideText for the large model to guide the target n , such as guiding users to pay more attention to the product highlights of a certain brand rather than discussing the meaning of the brand name. Operation represents the guidance strength that affects the big model, LLM represents the step of inputting text information into the intention recognition big model for output, and Text represents the dialogue with the preset target v T Related corpus.
[0094] Specifically, in step S140, the big model is required to analyze the difference between the preset target intention and the user's conversation intention, and based on the features of other dimensions, such as user emotion, context relevance, etc., a multi-dimensional measurement analysis is performed, and a target guidance prompt word input into the big model is given;
[0095] The steps of dynamically adjusting the target guidance of the big model are: adjusting the guidance intensity according to the difference between the current user conversation intention and the preset target intention, and then determining the guidance direction according to the result obtained by analyzing the difference between the preset target intention and the user conversation intention based on the big model, and combining the preset conversation goal v T The relevant corpus Text generates the target guiding prompt words to guide the current dialogue. The specific expression is as follows:
[0096] According to the dialogue deviation degree L(v U ,v T ) and the target guide text GuideText obtained in step S133 n , and the preset dialogue target v T The relevant corpus Text is input into the intention recognition model according to the rule combination to obtain the target guiding prompt words for the user's nth round of chat, for example:
[0097] FinalGuideText n =LLM({L(v U ,v T ),GuideText n ,Text})
[0098] Among them, FinalGuideText nThe target guidance prompt words input to the large model in the subsequent dialogue step are used to guide the user to chat in the nth round. LLM represents the step of inputting text information into the intention recognition large model for output. {L(v U ,v T ),GuideText n ,Text} is the text content that is input into the intent recognition model after combination.
[0099] In a specific embodiment of the present invention, the final target guidance prompt word format can be compiled as follows:
[0100] Prompt n ={"history":[FullUserText n ],"system":[FinalGuideText n ]}.
[0101] In step S150, the steps of causing the large model to generate a response according to the target guidance are as follows:
[0102] The large model will generate the target guidance prompt word Prompt in combination with step S140 n , answer the user's current question UserText n During this process, Prompt n The "history" field in the __conversation_data provides the big model with historical information about the conversation. This information helps the big model obtain context in multiple rounds of conversations and better understand the meaning of the user's conversation. The "system" field contains the target guide prompt word FinalGuideText generated by the intent recognition big model. n , to correct and guide the direction and content of this round of dialogue.
[0103] For example, the user's question in this round is "I see this dress is made of synthetic fiber, is it bad for the baby?" The system gets the target guidance prompt word FinalGuideText n The content is "{User intention:{The user misunderstood the product attributes and needs to be corrected based on the provided product attributes.}, Product attributes:{Product brand: a certain brand; Material: pure cotton; Washing method:...}"}.
[0104] If there is no guidance, the large model will answer based on its general knowledge, such as "Hello user, chemical fiber materials do have an impact on the skin of some children, because chemical fiber is produced during production..." This deviates from the current scene and dialogue goals, and produces a bad effect.
[0105] After the guidance, the big model will modify the conversation direction according to the prompt words, and make reasonable use of the existing knowledge and goals, such as generating the answer "Hello user, the clothing of a certain brand you are looking at is made of pure cotton, which is more suitable for children. A certain brand insists on using cotton from a certain origin..." In this way, the big model will use the knowledge in the prompt words to generate answers that are more in line with the preset goals.
[0106] In this step, the large model will automatically adjust the data distribution of this round of dialogue according to the input prompt words, adjust the direction of the dialogue, and prevent hallucination problems based on the provided text content, give answers that meet the preset goals, and store the latest question and answer pairs in the dialogue history database.
[0107] After the big model answers, the conversation is considered over, and the user may perform two operations:
[0108] If the user continues to ask questions, the system will further provide relevant product information to help the user make a purchase decision, and then return to step S120 to loop this process.
[0109] Otherwise, if the user is satisfied with the introduction and makes a purchase, favorites, or adds the product to cart, or actively ends the interaction, the process ends.
[0110] The present invention provides a large-model dialogue goal guidance method, which sets dialogue task goals and adjusts subsequent dialogues in real time according to the gap between the user's current dialogue and the preset goals, so that the large model can not only flexibly respond to the user's immediate needs, but also effectively guide it in the predetermined direction, significantly improving the continuity, pertinence and user experience of the dialogue.
[0111] The present invention also provides a large model dialogue goal guidance system. In a specific embodiment, the system includes a goal setting module, a vector embedding module, a dialogue history module, an intention recognition module and a question-answering module. Figure 2 As shown, where:
[0112] The goal setting module is used to obtain preset information, perform word embedding, and preset the initial distribution of the model dialogue. This module includes the acquisition of manually preset information, vectorization processing of information, fine-tuning and optimization, and conversion into a learnable goal for the model.
[0113] This module obtains relevant preset information from the system, which may include the initial goal of the conversation, task background or user preferences, such as product information, user portrait, etc. By processing this information, the module converts natural language information into word embeddings related to the generation target to establish the initial state distribution of the model conversation.
[0114] The goal setting module sets a clear goal for the dialogue by determining an initial distribution in the high-dimensional space of the big model, ensuring that the dialogue generated by the big model is relevant to the goal.
[0115] The vector embedding module is used to encode and output text input according to the embedding model; this module includes preprocessing of input information and a natural language model for text vectorization encoding. Through the embedding model, the user's text input is encoded into a high-dimensional vector representation for easy processing and calculation within the system. The embedded vector contains the semantic information of the input text, providing a basis for subsequent intent recognition and answer generation.
[0116] The dialogue history module is used to save the question-answer pairs between the user and the model and input them to the intent recognition module. This module includes a submodule for accepting question-answer pairs, a submodule for reading and writing databases, and a vector database such as Chroma. This module is used to store historical interaction information between the user and the model. Each user input and the model's response will be saved in the form of a question-answer pair, and a complete dialogue history record will be maintained.
[0117] The intent recognition module is used to analyze the user's intent based on the user's historical question-and-answer pairs and current question, combined with preset dialogue goals and related corpus, using the intent recognition large model to give target-guiding prompt words.
[0118] This module needs to collaborate with the dialogue history module and the vector embedding module. This module obtains the embedding vector representation of all historical question-answer pairs of the user and compares and analyzes these vectors with the current input. Then, the module matches this information with the dialogue goals preset in the goal setting module to identify the user's current intention and obtain the goal-guiding prompt words.
[0119] The question-answering module is used to obtain user input, combine the user input with the target guidance prompt word, output it to the big model to generate a dialogue answer, and present the dialogue answer to the user. This module includes a user-friendly interactive interface and a big model in the background.
[0120] The user's input will first be combined with the target guidance prompt words and background information obtained in the intention recognition module of the system to form a more complete question description including target guidance. Then, this question description will be input into the big model to generate a suitable answer. Ensure that each generated answer is reasonable, meets the actual needs of the user, and meets the preset dialogue goal. T .
[0121] In a specific embodiment, the question-answering module, the conversation history module and the vector embedding module are the common basic parts of the system.
[0122] The question-and-answer module includes a pre-trained large model and a user-friendly interface. The pre-trained large model can learn product features for product recommendations in e-commerce scenarios.
[0123] The vector embedding module is the basis of system data processing. This module mainly encodes the user's text input into a high-dimensional vector representation for internal processing and calculation in the system.
[0124] The dialogue history module is used for data reading, writing, storage and processing. It includes a dialogue history database and a vector database as well as auxiliary functions. The dialogue history database is used to store the user's historical question and answer pairs; the vector database is used to store vectorized product information and various dialogue intentions. In the entire system, this module can interact with the goal setting module, the intention recognition module and the vector embedding module.
[0125] The goal setting module and the intention recognition module are specific implementation parts of different tasks in different scenarios. In this embodiment, first in the goal setting module, the dialogue goal is set to guide the user to buy a product, and the content includes various attributes of the product, existing product promotion dialogue records, etc.
[0126] During the conversation, the intent recognition module uses the vector embedding module to encode product information, encode user conversations, and extract user conversation intentions. In each round of user conversation, the conversation is guided and corrected based on the conversation history and preset goals to obtain target guidance prompts.
[0127] Specifically, the question-and-answer module includes:
[0128] The big model backend server receives the target guidance prompt words generated by the user dialogue and the intention recognition module in the form of http requests, combines these contents into the request format of the big model, passes them to the big model and gets answers in the form of http replies, and returns them to the graphical interactive interface submodule;
[0129] The load balancing and scheduling submodule is used to schedule user http requests. According to the load situation of the large model backend server, a relatively idle server is selected to forward the request to avoid overloading of a single server, achieve load balancing, and ensure efficient operation of the system.
[0130] The graphical interactive interface submodule includes a text input box, a window for displaying conversation content, etc., providing users with a friendly interactive experience.
[0131] Specifically, the vector embedding module includes:
[0132] The text vectorization encoding submodule uses a pre-trained natural language processing model based on the Transformer architecture to vectorize the user input.
[0133] The information preprocessing submodule performs normalization processing on user input, including error correction, denoising, text cleaning, etc., to ensure the standardization of input information.
[0134] Specifically, the conversation history module includes:
[0135] Vector database, used to store high-dimensional vector information and support related add, delete, modify and query operations;
[0136] The vector database reading and writing submodule is used to store various required text information in the form of high-dimensional vectors into the vector database, and is responsible for the interaction between other modules and the database;
[0137] Relational database, used to store relational text information and support related add, delete, modify and query operations;
[0138] The relational database reading and writing submodule stores various required text information in the form of text into the vector database, and is responsible for the interaction between other modules and the database.
[0139] Specifically, the goal setting module includes:
[0140] The preset information acquisition submodule includes preset information generated by network crawling, manual entry or artificial intelligence assistance, and organizes it into a suitable format.
[0141] The fine-tuning and optimization submodule fine-tunes and optimizes the embedding model based on preset goals to ensure that the system can more accurately understand and generate content related to the goal when processing actual conversations.
[0142] The target setting submodule stores various vectorized preset information in the vector database for subsequent target intention recognition and dialogue direction guidance.
[0143] Specifically, the intent recognition module includes:
[0144] The intent extraction submodule includes a pre-trained intent recognition model. Using the intent recognition model, the user's current intent is obtained based on the conversation history and current questions, and then vectorized encoding is performed.
[0145] The intent analysis submodule finds the closest matching preset target intentions in the vector database based on the vectorized user's current intention, and calculates the degree of similarity based on the cosine similarity.
[0146] The goal setting submodule summarizes and guides the user based on the current intention and the preset goal intention as well as their similarity through the big model, obtains the goal guidance prompt words, guides the big model on the direction of the current question and answer, and obtains more appropriate results.
[0147] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A large model dialogue target guidance method, characterized in that: The following steps are involved: S110, obtaining and generating a preset dialogue target v T The relevant corpus Text is encoded using the pre-trained embedding model to generate the preset dialogue target v of the large model dialogue T ; S120, based on the user's question, combined with the user's historical question-answer pairs and current conversation data, use the intention recognition large model to perform intention recognition to obtain the user's current conversation intention; S130, introduce the loss function and calculate the preset dialogue target v T The gap between the user's current conversation intention and the preset conversation goal v is obtained to obtain the target guidance text and measure the user's current conversation intention and the preset conversation goal v T The degree of matching; S140, according to the target guidance text obtained in S130, the intention recognition model dynamically adjusts the direction of the subsequent dialogue, and according to the preset dialogue target v T The gap between the user's current conversation intention and the target guidance prompt words are generated; S150, the large model obtains the user's dialogue history and the preset dialogue target v according to the text information in the target guidance prompt word generated in S140 T The knowledge of the relevant corpus Text changes the data distribution of the large model in the current dialogue and generates a more consistent dialogue target v T After the answer is completed, the system adds this round of conversation to the conversation database.
2. A large model dialogue target guidance method according to claim 1, characterized in that: In S110, the preset dialogue target v of the large model dialogue T for: v T =Pooling(Encoder({E(w1),E(w2),…,E(w n )})) Among them, Pooling is the pooling operation, Encoder is the encoder used, and E is the pre-trained embedding model for a single Chinese character w n Perform embedding operations, where n is the number of conversation rounds; The encoding using the pre-trained embedding model includes: Inputting dialogue target related corpus, wherein the corpus includes the dialogue target and information related to the target, and question-answer pairs; Perform vectorized embedding of target-related corpus and store it in the vector database.
3. A large model dialogue target guidance method according to claim 2, characterized in that: S120 includes: Step S121: Obtain the input text UserText of the user's nth round of dialogue n Dialogue with history text Combine question and answer pairs to obtain the nth round of user dialogue history text FullUserText n ; Step S122: The nth round of user dialogue history text FullUserText n Input the intention recognition model to perform intent recognition and extraction: Input the intention recognition prompt word into the intention recognition model to obtain the user conversation intent UserIntention in this round of conversation n .
4. A large model dialogue target guidance method according to claim 3, characterized in that: S130 includes: Step S131: The user conversation intention UserIntention obtained in S122 is n Through the pre-trained embedding model, encoding is performed to obtain the vectorized user conversation intention v U : v U =Pooling(Transformer({E(w1),E(w2),…,E(w n )})) Among them, v U is the final embedding result of the input text, Pooling is the pooling operation, Transformer is the encoder used, and E is the pre-trained embedding model for a single Chinese character w n To perform embedded operations, Chinese characters w n UserIntention n Characters; Step S132: Calculate the dialogue deviation degree L(v U ,v T ), the formula is: Among them, v T ·v U is the dot product of two vectors, ||v T || is the norm of the vector; Step S133: vectorize the user conversation intention v U Compare with the pre-learned non-target dialogue intent to provide direction for the large model to guide the target and obtain the target guidance text GuideText n for: GuideText n =L(in U ,in T )·LLM(in U (Text) The operation represents the guiding strength that affects the large model, LLM represents the step of inputting Text into the intention recognition large model for output, and Text is the text that corresponds to the preset dialogue target v T Related corpus.
5. A large model dialogue target guidance method according to claim 4, characterized in that: S140 includes: The dialogue deviation degree L(v U ,v T ), the target guide text GuideText obtained in step S133 n , and the preset dialogue target v T The relevant corpus Text is input into the intention recognition model according to the rule combination, and the target guiding prompt word of the user's n-th round of dialogue is obtained as follows: FinalGuideText n =LLM({L(v U ,in T ),GuideText n ,Text}) Among them, {L(v U ,v T ),GuideText n ,Text} is the text content of the input intention recognition model.
6. A large model dialogue target guidance system, characterized in that: It includes a goal setting module, a vector embedding module, a conversation history module, an intent recognition module, and a question-answering module, among which: The target setting module is used to obtain preset information, perform word embedding, and preset the initial distribution of the large model dialogue; The vector embedding module is used to encode text input according to the pre-trained embedding model and output it; The dialogue history module is used to save the question-answer pairs between the user and the large model and input them into the intent recognition module; The intention recognition module is used to analyze the user's intention based on the user's historical question-answer pairs and current question, combined with the preset dialogue goals and related corpus, using the intention recognition large model to give the target guidance prompt words; The question-answering module is used to obtain user input, combine the user input with the target guidance prompt word, output it to the large model to generate a dialogue answer, and present the dialogue answer to the user.
7. A large model dialogue target guidance system according to claim 6, characterized in that: The question-answering module includes: The big model backend server is used to receive the user dialogue and the target guidance prompt words generated by the system, combine the user dialogue and the target guidance prompt words into the request format of the big model, pass it to the big model and get the answer, and return it to the graphical interactive interface submodule; The load balancing and scheduling submodule is used to schedule user requests and select idle servers for request forwarding according to the load of the large model backend server; The graphical interactive interface submodule is used for user interaction, including a text input box and a window for displaying the conversation content.
8. A large model dialogue target guidance system according to claim 6, characterized in that: The vector embedding module comprises: The text vectorization encoding submodule is used to vectorize the user input using the pre-trained Transformer architecture natural language processing model; The information preprocessing submodule is used to perform normalization processing on user input, and the normalization processing includes error correction, noise removal and text cleaning.
9. A large model dialogue target guidance system according to claim 6, characterized in that: The conversation history module includes: Vector database, used to store high-dimensional vector information and support related add, delete, modify and query operations; The vector database reading and writing submodule is used to store various required text information in the form of high-dimensional vectors into the vector database, and is used for the interaction between other modules and the vector database; Relational database, used to store relational text information and support related add, delete, modify and query operations; The relational database reading and writing submodule is used to store various required text information in the relational database in the form of text, and is used for the interaction between other modules and the relational database.
10. A large model dialogue target guidance system according to claim 6, characterized in that: The target setting module includes: The preset information acquisition submodule is used to capture the network, manually input or generate preset information with the assistance of artificial intelligence, and organize it into a suitable format; Fine-tune the optimization submodule to optimize the conversation based on the preset dialogue target v T Fine-tune and optimize large models; The target setting submodule is used to store various vectorized preset information in the vector database, and the preset information is used for subsequent target intention recognition and dialogue direction guidance.
11. A large model dialogue target guidance system according to claim 6, characterized in that: The intention recognition module includes: The intent extraction submodule uses the pre-trained embedding model to obtain the user's current intent based on the conversation history and current question, and performs vectorized encoding. The intent analysis submodule is used to find the closest matching preset target intents in the vector database according to the vectorized current user intent, and calculate the similarity based on the cosine similarity; The target setting submodule is used to obtain target guidance prompt words through the intention recognition model according to the user's current intention, preset target intention and similarity.
Citation Information
Cited By
Intelligent marketing verbal skill self-adaptive generation method based on multi-round interaction feedback
CN120277274A