Dynamic generation method and device of dialogue undertaking text, equipment and storage medium
By extracting user intent and emotion tags through a tag recognition model and combining them with a dialogue continuation text generation model for intelligent agents, dialogue continuation texts that fit the scene are dynamically generated. This solves the problem of waiting gaps when intelligent agents are handling complex tasks and improves the user interaction experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-30
- Publication Date
- 2026-03-27
AI Technical Summary
Existing intelligent agent dialogue systems exhibit significant waiting gaps when handling complex tasks, causing user anxiety, and fixed or preset concluding words cannot be dynamically adjusted, reducing the user interaction experience.
User intent and emotion tags are extracted by a tag recognition model, and conditional triples are generated by combining user input. The continuation text generation model dynamically outputs dialogue continuation text that fits the scene, and a response threshold is set to trigger continuation word generation in a timely manner.
It enables users to alleviate anxiety, enhance conversation fluency, and improve user interaction experience by dynamically generating transition words while they are waiting.
Smart Images

Figure CN121743435A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of intelligent agent interaction, and in particular to a method, apparatus, device and storage medium for dynamically generating dialogue receiving text. Background Technology
[0002] In the field of intelligent agent interaction technology, intelligent agents, as the core carrier of human-computer interaction, rely extensively on LLM (Large Language Model) in their dialogue systems to achieve end-to-end processing from understanding user intent and executing tools to generating final responses. With the rapid development of LLM technology, intelligent agents have been applied to various scenarios, undertaking functions such as information retrieval, task execution, and emotional support. Connectives, as transitional responses in the interaction process, play a crucial role in alleviating user anxiety during waiting and maintaining the fluency of the dialogue.
[0003] Currently, the operational mechanism of intelligent agents is mainly handled by LLM (Limited Language Management) to uniformly parse user input intent, invoke external tools, process complex tasks, and generate the final dialogue response. In the conjugate word generation stage, static conjugate words are typically generated using fixed sentence structures or through simple matching or random selection from a preset text list to fill the processing gaps in the LLM.
[0004] However, LLMs inevitably require a certain response time when performing complex tasks, resulting in obvious user waiting gaps in real-time dialogues. Static conjunctive words are mechanical and rigid, failing to alleviate user waiting anxiety and reinforcing the sense of alienation in human-computer dialogue. This may directly reduce users' willingness to interact and their user experience, especially in companion-type intelligent agent scenarios. Summary of the Invention
[0005] To overcome the shortcomings of the prior art, this application provides a method, apparatus, device, and storage medium for dynamically generating dialogue continuation text. By dynamically outputting continuation words based on the user's current interaction purpose and emotional state, it forms a natural expression that fits the scene, enhances the fluency of the dialogue, and achieves the beneficial effect of improving the user's interactive experience.
[0006] The technical solution adopted by this application to solve its technical problem is: Firstly, this application provides a method for dynamically generating dialogue succession text, the method comprising: Get user input; The user input statement is input into a preset tag recognition model, and the user intent tag and user emotion tag are extracted by the tag recognition model; The user intent tag, the user emotion tag, and the user input statement are integrated into a condition triple, and the condition triple is input into a preset follow-up text generation model. The follow-up text generation model generates dialogue follow-up text based on the user intent tag and the user emotion tag. The target function is determined based on the user intent tag, a response threshold is set based on the target function, the execution time of the target function is monitored, and the dialogue acceptance text is output when the execution time reaches the response threshold.
[0007] Optionally, the label recognition model includes an intent recognition model and an emotion recognition model; both the intent recognition model and the emotion recognition model include an encoder, a classification network, and a decoder. In the step of extracting user intent tags and user emotion tags through the tag recognition model, the intent recognition model and the emotion recognition model respectively perform the following processing steps: The user input statement is encoded into an integer symbol sequence, the integer symbol sequence is mapped into a word vector, and positional encoding is superimposed to form an input vector matrix; The input vector matrix is input into the encoder, and the encoder performs contextual semantic feature extraction to generate a semantic feature matrix. The semantic feature matrix is pooled to obtain the text semantic representation; The semantic representation of the text is input into the classification network, the label probability distribution is calculated by the classification network, and the label category with the highest probability is mapped to the corresponding user intent label or user emotion label by the decoder.
[0008] Optionally, before the step of inputting the condition triples into a preset receiving text generation model, the method further includes: Construct a basic dataset and a preference dataset, and determine the target training model; the basic dataset includes preset task instructions and multiple sets of training samples, each set of training samples contains training input text and its corresponding standard successor text; the preference dataset contains multiple sets of preference sample sets, each set of preference sample sets includes example input text and its corresponding preferred successor text and unpreferred successor text; The training input text is concatenated with the preset task instruction and then input into the target training model to obtain the model-generated text. The target adjustment parameters in the target training model are adjusted according to the difference between the model-generated text and the standard receiving text to obtain the basic generation model. Based on the preference sample group, the preference parameters of the basic generative model are adjusted to obtain a preference-adjusted generative model; The preference adjustment generation model is quantified to obtain the receiving text generation model.
[0009] Optionally, the step of adjusting the target adjustment parameters in the target training model based on the difference between the model-generated text and the standard inheriting text to obtain the base generative model includes: Identify the target linear transformation layer of the target training model, and introduce a low-rank adapter into the target linear transformation layer; the low-rank adapter constitutes a low-rank parameter increment through the product of a pair of low-rank matrices; Freeze the model parameters except for the low-rank matrix, and adjust the low-rank matrix according to the difference between the model-generated text and the standard receiving text in order to train the low-rank adapter; The trained low-rank adapter is integrated with the target training model to form the basic generative model.
[0010] Optionally, before the step of quantizing the preference adjustment generation model, the method further includes: The successor text generated by the preference adjustment generation model is evaluated based on the preset multidimensional evaluation criteria to determine whether the preference adjustment generation model meets the preset multidimensional alignment conditions. If the preference adjustment generation model does not meet the multidimensional alignment condition, then return to the step of concatenating the training input text with the preset task instruction and inputting it into the target training model, so as to iteratively obtain a new preference adjustment generation model; The preference adjustment generation model that meets the multidimensional alignment conditions is quantized to obtain the receiving text generation model.
[0011] Optionally, before the step of determining whether the preference adjustment generation model satisfies the preset multidimensional alignment condition, the method further includes: A new input text is obtained, and the new input text is processed by the preference-adjusted generation model to generate candidate successor text pairs; the candidate successor text pairs contain newly added successor texts with different styles; Based on the multidimensional evaluation criteria, newly selected superior samples that meet the evaluation criteria and newly selected inferior samples that do not meet the criteria are selected from the candidate acceptance text pairs and combined into self-distilled sample pairs. The preference adjustment generation model is adjusted by self-distillation based on the self-distillation sample, and the preference adjustment generation model that has completed the self-distillation adjustment is used as the evaluation target.
[0012] Optionally, the step of quantizing the preference adjustment generation model includes: The activation values of the preference adjustment generation model are preprocessed to obtain a smooth activation distribution, and the weight information of each network layer in the preference adjustment generation model is determined based on the smooth activation distribution. All the weight information is quantized, and the quantization parameters corresponding to each weight information are optimized by approximate second order to obtain the initial quantization model. The quantization error of all network layers in the initial quantization model is evaluated, and the network layers that are sensitive to quantization error are selected based on the quantization error evaluation results. The parameters of all the network layers to be corrected are fine-tuned to correct the quantization error, thereby obtaining the text generation model.
[0013] Secondly, this application provides a dynamic generation device for dialogue succession text, comprising: The input statement acquisition module is used to acquire user input statements; The statement tag extraction module is used to input the user input statement into a preset tag recognition model, and extract the user intent tag and user emotion tag through the tag recognition model; The continuation text generation module is used to integrate the user intent tag, the user emotion tag, and the user input statement into a condition triple, and input the condition triple into a preset continuation text generation model, and generate dialogue continuation text based on the user intent tag and the user emotion tag through the continuation text generation model; The receiving text output module is used to determine the target function to be invoked based on the user intent tag, set a response threshold based on the target function to be invoked, monitor the execution time of the target function to be invoked, and output the dialogue receiving text when the execution time reaches the response threshold.
[0014] Thirdly, this application provides an electronic device, comprising: One or more processors; One or more memory units; And one or more computer programs, wherein the one or more computer programs are stored in the one or more memories, and the one or more computer programs include instructions that, when executed by the one or more processors, cause the electronic device to perform the methods described above.
[0015] Fourthly, this application provides a computer-readable storage medium storing a program or instructions that, when executed, implement the above-described method.
[0016] The working principle of this application is as follows: First, after acquiring the user's input statement, the user's intent label and user emotion label are extracted through a preset label recognition model. These two labels are then integrated with the original user input statement to form a conditional triple containing the user's intent, emotion, and input content. This triple is then input into a preset continuation text generation model, which dynamically generates dialogue continuation text based on intent and emotion features. Simultaneously, the method sets a response threshold based on the target function call corresponding to the user's intent and monitors the function execution time. When the execution time reaches the threshold, the continuation text is output; if the processing speed is faster, the output is skipped, thus achieving adaptive interaction between continuation text generation and the user's waiting process. Based on the above working principle, the beneficial effects of this application are as follows: Compared with fixed or preset continuation words that cannot capture the personalized characteristics of user input, this application, through the extraction of intent and emotion tags, enables the continuation text generation process to deeply integrate the user's current interaction purpose (such as querying, seeking help, etc.) and emotional state (such as urgency, doubt, etc.), avoiding the mechanical feeling of indiscriminate response; at the same time, the setting of response thresholds ensures that continuation words are only triggered when the user actually needs to wait, which not only avoids unnecessary interruptions, but also allows the user to perceive the intelligent agent's understanding of the input content through dynamically generated text content, thereby alleviating waiting anxiety.
[0017] In other words, this application uses user intent, emotions, and input content as the basis for generation. This method transforms the continuation words from simple "waiting prompts" into "semantic connections" with interactive meaning. It not only fills the waiting gap but also enhances the fluency of the dialogue through natural expressions that fit the scene, ultimately achieving the beneficial effect of improving the user's interactive experience. Attached Figure Description
[0018] Figure 1 This is a flowchart illustrating the method for dynamically generating dialogue reception text provided in an embodiment of this application; Figure 2 This is a schematic diagram of the tag recognition model in the dynamic generation method of dialogue continuation text provided in the embodiments of this application; Figure 3 This is a flowchart illustrating the tag recognition method in the dynamic generation method of dialogue continuation text provided in the embodiments of this application; Figure 4 This is a schematic diagram of the encoder and decoder structure in the tag recognition model of the dynamic generation method for dialogue continuation text provided in the embodiments of this application; Figure 5 This is a schematic diagram of the virtual structure of the dynamic generation device for dialogue receiving text provided in this application; Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0019] The present application will be further described below with reference to the accompanying drawings and embodiments.
[0020] The following will clearly and completely describe the concept, specific structure, and resulting technical effects of this application in conjunction with embodiments and accompanying drawings, so as to fully understand the purpose, features, and effects of this application. Obviously, the described embodiments are only a part of the embodiments of this application, not all of them. Other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are all within the scope of protection of this application. Furthermore, all connections / linkages involved in the patent do not simply refer to direct contact between components, but rather to the ability to form a better connection structure by adding or reducing connecting accessories according to specific implementation conditions. The various technical features in this application can be combined interactively without contradicting each other.
[0021] In AI dialogue systems, an Agent is an intelligent entity capable of interacting with users using natural language. Its core functions include understanding user input, generating dialogue responses, and performing specific tasks (such as information retrieval and tool invocation). Current mainstream Agent systems typically use a Large Language Model (LLM) as their core driving force. The LLM is not only responsible for parsing user intent and generating dialogue content, but also for collaboratively completing tasks such as function calls (e.g., weather queries, news retrieval), complex function execution, and long text output (e.g., story generation), forming the core logical framework of human-computer interaction.
[0022] In Agent technology, to alleviate user discomfort during waiting, transitional phrases are typically generated for interactive transitions. The transitional phases of the current dialogue flow primarily rely on fixed templates or preset list matching mechanisms to generate transitional phrases. For example, when a user triggers a tool call (such as "check the weather") or a long text generation task, the system selects a fixed phrase from a preset list (such as "[searching in progress]", "please wait", "processing for you immediately]") as a transitional response. The design logic of this approach is to quickly provide feedback on the system status through standardized text, thereby filling the time gaps during LLM processing, tool calls, or function execution.
[0023] However, current dialogue transition processing has significant shortcomings: on the one hand, fixed transition words lack flexibility and relevance, failing to dynamically adjust based on the specific content, intent, or emotion of the user's input, resulting in a stiff and artificial interaction. On the other hand, because the transition words have a weak connection to the user's dialogue context, they are ineffective in soothing the user's emotions and smoothing the interaction flow. Especially in companionship or conversational AI agent scenarios, this stiff transition may even negatively impact the user experience. Furthermore, when the AI agent's processing time is long, simply repeating transition words fails to truly alleviate the user's waiting anxiety, further reducing overall interaction satisfaction.
[0024] In this application context, refer to Figure 1 , Figure 1 This is a flowchart illustrating the dynamic generation method of dialogue succession text provided in an embodiment of this application. The flowchart shows several key steps of the dialogue succession text generation method provided by this application to solve the above-mentioned technical defects. Each key step will be described in detail below: In step S1, the user input statement is obtained.
[0025] Specifically, obtaining user input statements as the starting point of the intelligent agent's dialogue interaction process means that the intelligent agent receives the dialogue content (i.e., natural language text) input by the user through natural language, such as text information such as questions, instructions, or statements raised by the user.
[0026] In step S2, the user input statement is input into a preset tag recognition model, and the user intent tag and user emotion tag are extracted through the tag recognition model.
[0027] Among them, the label recognition model refers to a dedicated model that has been pre-trained and integrated into the system. It includes an intent recognition model and an emotion recognition model. The two share a basic coding architecture but are optimized for different task objectives. They can process user input synchronously or step by step to extract the corresponding labels.
[0028] Among them, "user intent tags" are the results obtained by structured classification of user input text through an intent recognition model, used to clarify the core purpose of the user's dialogue, such as specific functional requests like "weather query," "news query," and "stock query." "User emotion tags" are the results of user emotional state judgment extracted by an emotion recognition model, such as "neutral," "eager," and "positive." (See reference...) Figure 2 , Figure 2 This is a schematic diagram of the tag recognition model in the dynamic generation method of dialogue continuation text provided in the embodiments of this application. It can be seen that the intent recognition model, the emotion recognition model, and the user input statement together constitute the basis for the generation of dynamic continuation words of the intelligent agent.
[0029] Specifically, the integer symbol sequence mapped from the user input statement is fed into the intent recognition model and the sentiment recognition model, respectively. The classification networks in the intent recognition model and the sentiment recognition model then output the corresponding user intent label and user sentiment label for the current user input statement. In one specific embodiment, assuming the input is "What is the current price of Tencent Holdings 0700.HK? I'm waiting to trade!", the intent recognition model can extract the user intent label "stock query" and the user sentiment label "eager".
[0030] More specifically, refer to Figure 3 , Figure 3 This is a flowchart illustrating the tag recognition method in the dynamic generation method for dialogue continuation text provided in this application embodiment, combined with... Figure 3 As can be seen, both the label recognition model (i.e., the intent recognition model and the emotion recognition model) include an encoder, a classification network, and a decoder. The encoder is a deep neural network module that captures the semantic context of the text; the classification network is a multi-class discrimination model that maps semantic features to preset label categories; and the decoder is a translation module that converts the abstract category numbers output by the model into interpretable text labels. Based on this, the embodiments of this application further propose that, in the step of extracting user intent labels and user emotion labels through the label recognition model, the intent recognition model and the emotion recognition model respectively perform the following processing steps: The user input statement is encoded into an integer symbol sequence, the integer symbol sequence is mapped into a word vector, and positional encoding is superimposed to form an input vector matrix.
[0031] Specifically, by using a pre-defined character-symbol or word-symbol mapping table, characters or words in natural language text are converted into sequences of integer symbols, thereby converting human-understandable natural language into a digital form that the model can process. This ensures that user input can be accurately converted into a format that the system can parse, preparing for subsequent semantic analysis and feature extraction.
[0032] The character-symbol mapping table or word-symbol mapping table is a pre-established correspondence table before model training. It is used to convert characters or words in natural language text into fixed integer symbol sequences, which remain unchanged throughout the model training and application phases. In one specific embodiment, assuming a user inputs "What is the current price of Tencent Holdings 0700.HK? I'm waiting to trade!", the mapping table will convert each word in the sentence (such as "Tencent Holdings", "0700.HK", "now", etc.) into a corresponding integer symbol sequence. In another specific embodiment, if the user inputs each word in the sentence ("query", "Shenzhen", "weather"), its corresponding integer symbol sequence can be [12, 45, 78, 103].
[0033] Subsequently, the integer symbols are mapped to word vectors through a pre-trained word embedding matrix (usually with a dimension of d_model, such as 768 dimensions). Each symbol corresponds to a dense vector, initially capturing the lexical semantics. In addition, to address the problem that the model is insensitive to the order of words, position vectors are generated through a preset sine-cosine function or learnable parameters, and added to the word vectors bit by bit for position encoding, thereby forming an input vector matrix containing "lexical semantics + position information" (with a dimension of [text length × d_model]).
[0034] Furthermore, the input vector matrix is input into the encoder, and the encoder extracts context semantic features to generate a semantic feature matrix; Among them, the encoder is a multi-layer neural network based on the Transformer architecture, which extracts context semantic features through the multi-head self-attention mechanism and the feed-forward network. The encoder usually contains 6 - 12 stacked encoding units, and each layer consists of a "multi-head self-attention sub-layer" and a "feed-forward sub-layer", with residual connections and layer normalization (Add&Norm) interspersed in the middle.
[0035] Specifically, after the input vector matrix is fed into the encoder, based on the multi-head self-attention sub-layer of the encoder, through multiple parallel attention heads, the dependence weights of each word in the input vector matrix with all other words are calculated (such as the correlation degree between "query" and "weather"), generating an attention weight matrix. Then, through the feed-forward sub-layer of the encoder, non-linear transformation is performed on the vector at each position (such as through the ReLU activation function) to enhance the feature expression ability. After multiple layers of processing, the encoder outputs a semantic feature matrix. It should be noted that the dimension of the semantic feature matrix is the same as that of the input vector matrix, such as both being [text length × 768], and each vector in it contains the context semantic information of the corresponding word, such as the specific meaning of "query" in the context of "weather query".
[0036] More specifically, refer to Figure 4 , Figure 4 is a schematic structural diagram of the encoder and decoder in the label recognition model for the dynamic generation method of dialogue承接文本 provided in the embodiments of this application. Figure 4 What is shown is the Transformer model structure adopted in a specific embodiment of this application, mainly consisting of two major parts: the encoder on the left and the decoder on the right. From the overall structure, the input of the model first enters the encoder part. The input will first pass through the input embedding layer, which converts discrete text symbols (such as words or sub-words) into continuous low-dimensional vector representations, enabling the computer to understand and process text information. Immediately afterwards, through the position encoder plus position encoding, the model can perceive the positional relationship of each element in the input text, thereby understanding the temporal characteristics of the language.
[0037] The encoder part consists of N stacked encoder layers (labeled "N×" in the diagram). Each encoder layer contains two main sub-layers. The first sub-layer is "multi-head attention," a mechanism that allows the model to simultaneously focus on different positions in the input sequence across different representation subspaces. This enables a more comprehensive capture of various dependencies in the input text, such as semantic associations and referential relationships between words. The output of the multi-head attention layer undergoes an "addition and normalization" operation. "Addition" refers to residual connections, where the input of the multi-head attention sub-layer is added to its output, thus mitigating the vanishing gradient problem during deep neural network training. Normalization typically employs layer normalization to stabilize network training and accelerate convergence.
[0038] After the first addition and normalization operation, the data enters the second sub-layer of the encoder layer, namely the feedforward sub-layer. It consists of two linear transformations, usually using activation functions such as ReLU. It can perform further non-linear transformations and feature extraction on the features processed by the attention mechanism, enhancing the expressive power of the model. Its output will also undergo another "addition and normalization" operation before being passed to the next encoder layer, or after the last encoder layer has finished processing, the result will be passed to the decoder.
[0039] Looking at the decoder section on the right, its input comes from the output embedding of the relevant sequence and the same positional encoding. The decoder section also contains N stacked decoder layers (also labeled "N×" in the diagram). Notably, each decoder layer has one more sub-layer than the encoder layer, for a total of three sub-layers. The first sub-layer is masked multi-head attention. It's similar to the multi-head attention mechanism in the encoder, but adds a mask operation. The purpose of this mask is to prevent the model from seeing information about subsequent positions in advance when predicting the output at the current position during decoding, ensuring that the prediction is based on the previously generated sequence and conforms to the natural generation order. The output of masked multi-head attention undergoes an addition and normalization operation.
[0040] The second sub-layer of the decoder also uses multi-head attention, but the attention mechanism differs from that in the encoder. In this sub-layer, the decoder focuses on all positional information in the encoder's output. That is, it treats the encoder's understanding of the input sequence (i.e., the encoder's output) as "keys" and "values," and the decoder's current hidden state as a "query." This allows the decoder to generate the corresponding output sequence based on the information in the input sequence, establishing a connection between the input and output. The output of this sub-layer also undergoes addition and normalization operations.
[0041] The third sub-layer of the decoder is similar to the feedforward sub-layer of the encoder, performing non-linear transformations and feature extraction. The output of the feedforward neural network undergoes a final addition and normalization operation before being passed to the next decoder layer. After the data has been processed by all N decoder layers, it enters the linear layer. The linear layer maps the hidden state vector output by the decoder to a larger dimensional space, typically equal to the size of the target vocabulary, for subsequent probability calculations. The output of the linear layer then passes through a softmax layer. The softmax function converts the scores from the linear layer output into a probability distribution over the target vocabulary. The word with the highest probability (i.e., the identified label) is selected as the predicted output (Output Probabilities) for the current position, thus completing the entire sequence transformation process from input to output, such as in machine translation and text generation tasks.
[0042] Furthermore, the semantic feature matrix is subjected to pooling processing to obtain the text semantic representation.
[0043] Pooling is an operation that reduces the dimensionality of the semantic feature matrix generated by the encoder into a fixed-length vector, which is used to extract the overall semantics at the sentence level.
[0044] Specifically, pooling is performed on the semantic feature matrix to compress it into a fixed-length text semantic representation, eliminating the impact of sequence length differences on subsequent classification. Pooling can be performed using two methods: [CLS] vector extraction and average pooling. If [CLS] vector extraction is used, a special symbol "[CLS]" is added to the beginning of the input sequence, and the corresponding output vector, after training, can serve as a semantic summary of the entire sentence, thus obtaining the text semantic representation. If average pooling is used, the average of all word vectors in the semantic feature matrix is taken to obtain the overall text semantic representation.
[0045] Furthermore, the semantic representation of the text is input into the classification network, and the label probability distribution is calculated through the classification network.
[0046] Specifically, the text semantic representation is input into the classification network of the corresponding label recognition model. The classification network consists of 1-2 fully connected layers and a softmax layer. The fully connected layer maps the high-dimensional vector of the text semantic representation to a preset label category space through a linear transformation. For example, intent recognition includes 10 categories such as "casual chat" and "weather query," and outputs unnormalized logits (log odds). The softmax layer then converts the logits into a label probability distribution, where each category corresponds to a probability value between 0 and 1, with a sum of 1.
[0047] In one specific embodiment, the text semantic representation of "check Shenzhen weather" is processed by the classification network of the intent recognition model and may output a distribution with a probability of 0.92 for "weather query" and a probability of 0.05 for "casual chat", which intuitively reflects the model's confidence in judging the user's intent.
[0048] Subsequently, the label category with the highest probability is mapped to the corresponding user intent label or user emotion label via the decoder.
[0049] Specifically, the category number with the highest output probability from the classification network is fed into the decoder. For example, "weather query" corresponds to number 1. The decoder is essentially a mapping module. If the correspondence between category number and text label is pre-stored, such as number 1 → "weather query", the output is directly obtained by looking up the table. If dynamic adjustment is required, a small linear network can be used to map the number to the label text.
[0050] In one specific embodiment, after being mapped by the decoder of the intent recognition model, number 1 will ultimately output the user intent label "weather query", or the user emotion label "neutral" will be output by the corresponding decoder in the emotion recognition model.
[0051] More specifically, in a concrete embodiment of the complete execution of the step "extracting user intent tags and user sentiment tags through the tag recognition model", when a user inputs "What is the current price of Tencent Holdings 0700.HK? I'm waiting to trade!", the tag recognition model initiates parallel processing, wherein: Intent recognition model: User input is converted into an integer sequence through character-symbol mapping, and then positional encoding is superimposed to form an input vector matrix. The encoder captures the semantic associations of keywords such as "Tencent Holdings" and "transaction" through a self-attention mechanism to generate a semantic feature matrix; after pooling, the text semantic representation is obtained, and the classification network calculates the probability distribution of intent categories such as "stock query" (probability 0.91) and "casual chat" (0.03). The decoder finally outputs "user intent tag: stock query".
[0052] Emotion recognition model: Under the same process, the encoder focuses on capturing tone features such as "waiting" and "hey!", the classification network determines the emotion category such as "eager" (probability 0.87) and "neutral" (0.12), and the decoder outputs "user emotion label: eager".
[0053] It's worth noting that these two tags together serve as the basis for generating dynamic conjugates, enabling the subsequent LLM to generate responses that are both relevant to the intent ("checking stock prices") and soothing ("Please don't be impatient"). Without an emotion recognition model, the system might only output "Checking," failing to alleviate user anxiety; if the encoder fails to capture the semantic connection between "trading" and "stocks," the intent tag might be misinterpreted as "casual conversation," causing the conjugate to deviate from the user's needs. Therefore, the tag recognition model, through accurate semantic parsing, provides core technical support for the "naturalness" and "effectiveness" of dynamic conjugates.
[0054] In step S3, the user intent tag, the user emotion tag, and the user input statement are integrated into a condition triple, and the condition triple is input into a preset follow-up text generation model. The follow-up text generation model generates dialogue follow-up text based on the user intent tag and the user emotion tag.
[0055] In this context, a conditional triple refers to a structured combination of core user input information, consisting of a user intent label, a user sentiment label, and the user input statement. The format is typically "[User Intent: {Intent}][User Sentiment: {Sentence}]{User Input}". This structured design aggregates scattered semantic information into input conditions that the model can directly parse, such as "[User Intent: Internet Search] [User Sentiment: Doubt] What's the difference between a violin and a viola?".
[0056] The continuation text generation model is a dedicated generation module built upon a fine-tuned large language model. Its function is to dynamically generate natural language continuation words that align with the user's intent and emotion based on conditional triples. In this embodiment, the model is trained using SFT (Supervised Fine-Tuning) and DPO (Direct Preference Optimization), enabling it to understand structured input, capture intent-emotional associations, and generate humanized responses. Its output must meet the constraints of being "brief and natural, without substantial information, and emotionally appropriate."
[0057] Specifically, firstly, the intent recognition and emotion recognition models have respectively output user intent labels and emotion labels. These two labels are then integrated with the original user input statement into a conditional triplet according to a preset format. In one specific embodiment, assuming the user intent label is "stock query" and the emotion label is "urgent," and the original user input statement is "What is the current price of Tencent Holdings 0700.HK? I'm waiting to trade!", based on the preset format, the conditional triplet "[user intent: stock query][user emotion: urgent] What is the current price of Tencent Holdings 0700.HK? I'm waiting to trade!" can be obtained.
[0058] After constructing the conditional triples, input them into the pre-defined continuation text generation model. During the training phase, the continuation text generation model has learned the mapping rules of "intent-emotion-continuation word" through SFT, such as "urgent emotions require a reassuring tone" and "query intent needs to reflect actionability". It also optimizes the output style through DPO, such as prioritizing "okay, I understand your needs" instead of "processing".
[0059] During inference, the model first parses the structured labels in the triples to locate the user's core needs ("checking stock prices") and emotional state ("eagerness"). Then, it combines the contextual details of the original input ("waiting for the transaction") to generate transition words that both match the intent and soothe the emotions, such as "Okay, we understand your needs. We are checking the stock market information as quickly as possible. Please don't be impatient." It can be seen that the dual-dimensional constraints of intent and emotion enable the generated continuation words to possess both scenario adaptability and emotional soothing properties. When a user is emotionally agitated, the model generates expressions of apology or reassurance; for example, if the user is "angry," it generates a continuation word such as "Sorry to keep you waiting, I will handle it immediately." Or, when the intent is clearly "complex task," it emphasizes the professionalism of the processing; for example, when it is "data analysis," it generates a continuation word such as "This requirement needs a little time to organize, I will give you the result as soon as possible." This dynamic adaptability makes the continuation words truly serve as transitional text, maintaining user patience and satisfaction during the waiting process.
[0060] More specifically, before inputting the conditional triples into the preset text generation model, the text generated by the text generation model needs to be trained through the following series of key steps. The training process specifically includes the following methods: Build the base dataset and preference dataset, and determine the target training model.
[0061] The basic dataset is a structured data set used for the initial training of the model. It contains preset task instructions and multiple sets of training samples. Each set of samples consists of training input text and standard receiving text (human-annotated target output), which is used to guide the model to learn the "input-output" mapping rules.
[0062] In one specific embodiment, the preset task instruction could be: "You are an AI assistant and need to generate connection phrases according to the following rules:\n1. The [intent] and [emotion] tags before and after the user input are the sole basis for your response.\n2. Your response must fit the user intent and emotional state described by the tags.\n3. The response should be concise, natural, and human-like, and should not contain any substantive answers or information.\n4. It is strictly forbidden to repeat, explain, or mention any tag content in the response." The training input text is "[User intent: Stock inquiry] [User emotion: Urgent] What is the current price of Tencent Holdings 0700.HK?", and the corresponding standard connection phrase is "I am urgently checking stock market information, please don't be impatient."
[0063] The preference dataset is a set of comparative data used to optimize the output style of the model. It contains multiple preference sample groups. Each group consists of example input text with the same format as the training input text, preferred follow-up text (high-quality output annotated by humans, such as "Let me help you check the latest progress") and inferior follow-up text (low-quality reference output, such as "Processing, please wait"), which improves the model's preference for high-quality output through comparative learning.
[0064] Among them, the target training model refers to the pre-trained language model, which serves as the starting point for fine-tuning and has basic language understanding and generation capabilities. It needs to be adapted to the word generation task through parameter optimization. The target adjustment parameters specifically refer to the parameters that need to be updated during model fine-tuning.
[0065] Specifically, the first step is to construct a base dataset and a preference dataset. The base dataset adopts the Alpaca paradigm, and each sample contains task instructions, labeled training input text, and standard continuation text to ensure that the model learns the basic generation rules. The preference dataset provides preferred and unpredictable continuation text pairs for the same input text, which are used for subsequent comparison and optimization.
[0066] Next, the target training model is determined from at least one pre-prepared base model. It is worth noting that, depending on the deployment scenario and operation needs, base models with different parameter amounts can be selected as target training models. That is, multiple base models with different parameter amounts can be trained at the same time (for example, the Qwen3 model with 0.6B and 1.7B parameter amounts. The base model refers to the basic large language model that has general language understanding and generation capabilities). The model is dynamically selected and used according to the specific scenario to form a "lightweight version" (0.6B) and a "standard version" (1.7B) to support the text generation model.
[0067] Specifically, when the system detects that the operating environment is a resource-constrained scenario (such as a mobile app or embedded device) or the interaction scenario has extremely high requirements for response speed (such as real-time voice dialogue), it automatically calls the 0.6B lightweight model, which uses its small number of parameters to achieve millisecond-level response. When the operating environment is a server or PC and the user's emotions are intense (such as "anger" or "urgency") and higher-quality soothing follow-up words are needed, it switches to the 1.7B standard model, which uses its stronger semantic understanding capabilities to generate more delicate and context-appropriate responses.
[0068] Furthermore, the training input text is concatenated with the preset task instruction and input into the target training model to obtain the model-generated text. The target adjustment parameters in the target training model are adjusted according to the difference between the model-generated text and the standard receiving text to obtain the basic generation model.
[0069] Among them, the basic generative model is a preliminary model obtained after training on the basic dataset. It has the ability to generate successive words that meet the task requirements based on the input, but the style and preferences have not yet been optimized.
[0070] Specifically, the training input text from the base dataset is concatenated with a pre-defined task instruction, in the format "{instruction}\n{input}". The concatenated result is then input into the target training model to generate initial concatenation words. These generated initial concatenation words serve as the model's generated text. The target adjustment parameters are adjusted using SFT, and the difference between the model-generated text and the standard concatenation text is minimized using cross-entropy loss calculation, resulting in the base generation model. At this point, the model can generate concatenation words that conform to grammar and task requirements, but the style may be somewhat awkward.
[0071] More specifically, in this embodiment of the application, a method of adjusting LoRA (Low-Rank Adaptation) is proposed to obtain a basic generative model. Based on this concept, this embodiment of the application further proposes the step of adjusting the target adjustment parameters in the target training model according to the difference between the text generated by the model and the standard receiving text to obtain the basic generative model, including: Identify the target linear transformation layer of the target training model to introduce a low-rank adapter in the target linear transformation layer.
[0072] The target linear transformation layer refers to the component in the target training model responsible for linear feature mapping. It mainly includes multi-head attention layers (such as QKV projection layers) and feedforward network layers (such as the linear transformation module of FFN) in the Transformer architecture. Its function is to map input features from a low-dimensional space to a high-dimensional space or vice versa through matrix multiplication. In the word generation task, these layers directly affect the capture of semantic features and the control of output style, and are key targets of low-rank adaptation.
[0073] The low-rank adapter is a parameter-efficient fine-tuning technology component that inserts a pair of low-rank matrices (denoted as ) into the target linear transformation layer. and This achieves model adaptation. The principle is to adapt the original weight matrix... The update quantity is represented in low-rank decomposition form. This allows for task adaptation with minimal parameters. The low-rank parameter increment is constructed by multiplying a pair of low-rank matrices.
[0074] Here, the low-rank parameter increment refers to the amount of parameter change introduced by the low-rank adapter, i.e. ,in and This is a randomly initialized, trainable low-rank matrix. During the model's forward propagation, the input features... The transformation from Become +WX+ Through fine-tuning and This allows the model to learn new task patterns while avoiding modification of the original weights.
[0075] Specifically, the first step is to identify the target linear transformation layer. This involves identifying the semantically sensitive linear layers in the target training model, specifically the last two multi-head attention QKV projection layers and the feedforward network output layer of the Transformer encoder, given the need to capture the semantic association between intent and emotion in the word generation task. Then, a low-rank adapter is inserted into the selected target linear transformation layer, i.e., a pair of low-rank matrices is initialized. (dimension is) )and (dimension is) ), where rank Set the value to be much smaller than the original layer dimension, for example, if the original layer dimension is 768, the rank... It can be set to 8. The product of the two... The parameter increments are used to adjust the output characteristics of the target linear transform layer.
[0076] Furthermore, the model parameters other than the low-rank matrix are frozen, and the low-rank matrix is adjusted according to the difference between the model-generated text and the standard receiving text in order to train the low-rank adapter.
[0077] Specifically, freezing refers to fixing all original parameters except for the low-rank matrix during model training, and only fixing the low-rank matrix. and Set these as trainable parameters. On the base dataset, the model generates successor words through forward propagation, calculates the cross-entropy loss between the generated text and the standard text, and then updates the parameters through backpropagation. and Increment the parameter Gradually learn the mapping pattern of "intention - emotion - conjunctive words".
[0078] Furthermore, the trained low-rank adapter is integrated with the target training model to form the basic generative model.
[0079] Specifically, after the low-rank adapter is trained, the parameters of the low-rank adapter are incremented. Weights of the linear transformation layer of the original target Merging, or dynamically adding parameter increments during inference. The model then outputs the original data. At this point, the model retains its pre-trained language understanding capabilities while incorporating task knowledge related to word generation, forming a basic generative model that can be directly used for generation.
[0080] More specifically, by combining low-rank parameter increments with selective fine-tuning, the number of training parameters is significantly reduced because the rank r of the low-rank matrix is much smaller than the billions of parameters in the original model, while the number of adapter parameters is only in the millions. This results in a smaller optimization space, more efficient gradient propagation, and faster convergence of the model on small datasets. At the same time, freezing the original parameters avoids compromising the model's general language capabilities during fine-tuning, thus preventing overfitting and catastrophic forgetting.
[0081] Furthermore, after obtaining the basic generative model, the preference parameters of the basic generative model are adjusted based on the preference sample group to obtain the preference-adjusted generative model.
[0082] Among them, the preference adjustment generation model is a version of the basic model optimized by preferences, which can prioritize the generation of natural and emotionally appropriate continuation words that reflect human preferences.
[0083] Specifically, the model's DPO (Discretionary Point of Interest) is tuned based on a preference dataset. First, example input text is fed into the model, generating multiple candidate outputs. By comparing the probability differences between preferred and unpreferred texts, the model parameters are adjusted so that the probability of generating preferred text is significantly higher than that of unpreferred text, resulting in a preference-tuned generative model. For example, the probability of "Let me find it for you" is made more than 50% higher than "Searching." This process teaches the model to distinguish between "natural and fluent" and "mechanical and stiff" expression styles, prioritizing the output of transition words that conform to human conversational habits.
[0084] Furthermore, the preference adjustment generation model is quantified to obtain the receiving text generation model.
[0085] Quantization is a process of reducing computational resource consumption by compressing the precision of model parameters. In the context of word generation, quantization needs to balance compression ratio and generation quality, with the core objective of achieving lightweight model deployment with minimal performance loss.
[0086] In this embodiment, a combination of SmoothQuant and GPTQ quantization is used for quantization processing. SmoothQuant is an activation value preprocessing technique that dynamically adjusts the scaling factor of weights and activation values to transfer extreme values in the activation value distribution to the weight matrix, reducing accuracy loss due to excessively large numerical ranges during quantization. GPTQ is an efficient weight quantization algorithm that uses an approximate second-order optimization strategy to compress weights while maintaining model performance. It quantizes the weight matrix column-wise, dynamically selects the optimal rounding threshold for each quantization group, minimizes reconstruction error, and supports rapid quantization and deployment of large-scale language models. Based on this concept, this embodiment further proposes that the steps for quantizing the preference adjustment generation model include: The activation values of the preference adjustment generation model are preprocessed to obtain a smooth activation distribution, and the weight information of each network layer in the preference adjustment generation model is determined based on the smooth activation distribution. The activation value smoothing preprocessing step optimizes the distribution of activation values in the model using the SmoothQuant technique. Its key feature is calculating a scaling factor to transfer extreme values from the activation values to the weight matrix, making the activation value distribution more concentrated and reducing the difficulty of subsequent quantization. Smoothing the activation distribution refers to the statistical distribution characteristics of the activation values after preprocessing, characterized by a significantly reduced proportion of extreme values and a numerical range suitable for low-bit quantization.
[0087] The weight information includes the numerical values, dimensions, and distribution characteristics of the weight matrices of each layer of the model, and is the target object of quantization processing.
[0088] Specifically, SmoothQuant is first used for activation value smoothing preprocessing. After SFT+DPO optimization, the preference-adjusted generative model has a small number of extreme values in the activation value distribution (such as abnormally high values in the attention score), and direct quantization would lead to a severe loss of accuracy. Then, by analyzing the statistical distribution of activation values in each layer, the optimal scaling factor s is calculated, transferring the extreme values of activation values to the weight matrix. For example, the activation value x of a certain layer is divided by s, and the weight matrix W is multiplied by s, so that each bit of the smoothed activation value distribution is reduced to the low-bit quantization range, thus laying the foundation for high-precision weight quantization. Subsequently, after SmoothQuant processing, the activation value x becomes x / s. To keep the calculation result of Wx in the original model unchanged, the weight matrix W needs to be adjusted to Ws to determine the new weight information for each network layer.
[0089] Furthermore, all the weight information is quantized, and the quantization parameters corresponding to each weight information are optimized by an approximate second order to obtain an initial quantization model. Among them, the approximate second-order optimization is the core strategy of the GPTQ weight quantization algorithm. By calculating the optimal rounding threshold of the weight matrix column by column, the quantization reconstruction error is minimized, thereby achieving weight compression.
[0090] Specifically, based on the weight information obtained from the smooth activation distribution, weight quantization and approximate second-order optimization are performed. The GPTQ algorithm is used to dynamically select the rounding threshold for each column of weights in the preprocessed weight matrix, and the reconstruction error is minimized through approximate second-order optimization. After quantization, an initial quantization model is formed.
[0091] Furthermore, the quantization error of all network layers in the initial quantization model is evaluated, and network layers that are sensitive to quantization error are selected based on the quantization error evaluation results.
[0092] Quantization error refers to the degree of deviation between the quantized model output and the original model, and is usually evaluated through cross-entropy loss or semantic similarity. The network layer to be corrected is a key layer that is sensitive to error after quantization, and its performance directly affects the naturalness and emotional relevance of the connecting words.
[0093] Specifically, the quantization error is evaluated and network layers to be corrected are selected. By comparing the generated results of the initial quantization model and the original model on the test set, such as the naturalness of the emotional continuation words "urgent", the quantization error of each layer is calculated, and the layers with errors exceeding the corresponding preset thresholds are marked as network layers to be corrected.
[0094] Furthermore, the parameters of all the network layers to be corrected are fine-tuned to correct quantization errors, thereby obtaining the receiving text generation model.
[0095] Among them, parameter fine-tuning refers to performing low-precision fine-tuning on the quantized network layer to be corrected, compensating for the subtle semantic features lost in quantization, and ensuring the quality of generation.
[0096] Specifically, the parameters of the sensitive layers are fine-tuned to compensate for errors. A small number of preference dataset samples are used to perform low-precision fine-tuning on the selected network layers to be corrected, focusing on optimizing the expression of emotional vocabulary. After fine-tuning, it is re-identified whether there are still network layers to be corrected. If not, a deployable text generation model is confirmed; otherwise, a new round of corrections is performed.
[0097] It is worth noting that, considering the obvious shortcomings of the linear two-step training method using SFT+DPO, such as overly singular preference optimization dimensions, lack of constraints on long-range dialogue consistency, and the tendency to forget role knowledge learned in SFT during the DPO stage, this application proposes an iterative training method, which includes the following steps before the step of quantizing the preference adjustment generative model: The successor text generated by the preference adjustment generation model is evaluated based on the preset multidimensional evaluation criteria to determine whether the preference adjustment generation model meets the preset multidimensional alignment conditions. The multidimensional evaluation criteria are a multi-dimensional indicator system used to evaluate the quality of the text generated by the preference-modulation generation model. They cover dimensions such as language style fit, emotional expression stability, and role setting consistency. These dimensions correspond to the model's performance requirements in different interaction scenarios. The multidimensional alignment condition is a quantitative threshold set based on the multidimensional evaluation criteria. Only when the model reaches or exceeds this threshold in all evaluation dimensions is the model considered to meet the deployment requirements.
[0098] Specifically, the evaluation criteria cover dimensions such as language style (e.g., colloquialism and sentence variety), emotional expression (e.g., whether the reassuring tone is appropriate when conveying an "urgent" emotion), and role consistency (e.g., whether the model consistently uses gentle vocabulary when set as a "friendly assistant"). During evaluation, the model-generated follow-up text is compared with high-quality manually annotated samples, and the performance of each dimension is quantified using indicators such as semantic similarity and emotion classification accuracy.
[0099] Furthermore, if the preference adjustment generation model does not meet the multidimensional alignment condition, the step of concatenating the training input text with the preset task instruction and inputting it into the target training model is returned to iterate and obtain a new preference adjustment generation model. The preference adjustment generation model that meets the multidimensional alignment conditions is quantized to obtain the receiving text generation model.
[0100] Specifically, the evaluation results determine whether the model meets the multidimensional alignment criteria. If a certain dimension fails to meet the criteria, the training input text is reassembled with the preset task instructions and re-input into the target training model for iterative fine-tuning. For example, to address the issue of insufficient emotional expression, training samples with extreme emotional labels are added during the SFT stage, or the preference signal for the "emotional adaptation" dimension is strengthened during the DPO stage, enabling the model to focus on optimizing this aspect in subsequent iterations. Finally, the preference adjustment generation model that meets the multidimensional alignment criteria is quantified to obtain a lightweight, deployable text generation model.
[0101] In this embodiment of the application, it is also proposed that a self-distillation method can be combined to improve the solid grasp of the character style. Based on this concept, this embodiment of the application further proposes that before the step of determining whether the preference adjustment generation model meets the preset multidimensional alignment conditions, the method further includes: Obtain new input text, and process the new input text through the preference-adjusted generation model to generate candidate successor text pairs; The new input text consists of unlabeled samples used for model self-optimization. These samples typically come from real user interaction logs or synthetic scene data and cover a variety of user intents, such as "historical event query" and "food recommendation," as well as emotion combinations, such as "doubt + eagerness" and "curiosity + neutrality," to test the model's generalization ability in unseen scenarios.
[0102] Among them, candidate successor text pairs are two successor texts with different styles and emotional expressions generated by the preference adjustment generation model for the same input text. For example, for "help me find Jay Chou's new songs", the model generates "Okay, I'll search for Jay Chou's latest songs" (colloquial, positive emotion) and "searching for Jay Chou's new songs" (formal, neutral emotion).
[0103] Specifically, the process begins by acquiring new input text and generating candidate successor text pairs. The new input text can cover marginal scenarios not fully addressed during model training, such as low-frequency intentions or complex emotions. The preference-adjusting generative model generates two or more successor texts with significantly different styles by adjusting the decoding strategy, ensuring that the candidate pairs contain comparable superior and inferior features.
[0104] Furthermore, based on the multidimensional evaluation criteria, newly selected preferred samples that meet the evaluation criteria and newly selected inferior samples that do not meet the criteria are selected from the candidate receiving text pairs and combined into self-distilled sample pairs.
[0105] The self-distilled sample pairs consist of comparative data pairs composed of "newly added superior samples" and "newly added inferior samples". The superior samples are high-quality supporting texts selected through multi-dimensional evaluation criteria, while the inferior samples are texts with obvious defects in dimensions such as style and emotion. Both are used together for the self-supervised optimization of the model.
[0106] Specifically, self-distilled sample pairs are then selected based on multi-dimensional evaluation criteria. The evaluation criteria use three dimensions: language style fit, emotional expression stability, and role setting consistency, to quantitatively score the candidate receiving text pairs. For example, for the input of "anxiety," if one receiving text contains "Don't worry, I'll help you as soon as possible" (emotional fit 90%), and another only contains "I'm processing it" (emotional fit 50%), then the former is selected as the new preferred sample, and the latter is selected as the new inferior sample, and the two form a self-distilled sample pair.
[0107] Furthermore, the preference adjustment generation model is subjected to self-distillation adjustment of preference parameters based on the self-distillation samples, and the preference adjustment generation model that has completed the self-distillation adjustment is used as the evaluation target.
[0108] Among them, the self-distillation adjustment of preference parameters refers to the model using self-distilled sample pairs to update its own parameters through comparative learning, thereby strengthening the learning of high-quality supporting text features and weakening the tendency to generate inferior samples. In essence, it is a process of model "self-correction".
[0109] Specifically, the model's preference parameters are adjusted using self-distilled samples. The model is generated by adjusting the input preferences using self-distilled samples, employing a contrastive loss function (such as the binary loss in DPO) to ensure the model generates a significantly higher probability of selecting preferred samples than undesirable ones. During the adjustment process, only the model's low-rank adaptation (LoRA) parameters are updated to avoid compromising the fundamental learning capabilities of the SFT and DPO stages, while simultaneously enhancing its ability to discern subtle style differences. Finally, the optimized model is used as the evaluation target for multidimensional alignment conditions.
[0110] More specifically, through a self-distillation design that generates its own samples and is optimized under self-supervision, the model's generalization ability is enhanced by new input text. Furthermore, by combining multi-dimensional evaluation criteria, the model ensures that the quality of self-distilled sample pairs is significantly different, thus avoiding low-quality samples from interfering with model optimization. Additionally, the model generates candidate text pairs on its own, reducing the reliance on manual annotation.
[0111] In step S4, the target function is determined based on the user intent tag, a response threshold is set based on the target function, the execution time of the target function is monitored, and the dialogue acceptance text is output when the execution time reaches the response threshold.
[0112] Among them, the target call function refers to the specific tool or service triggered by the intelligent agent according to the user's intent tag, such as calling the weather API, stock query interface, or search engine. The execution time varies greatly depending on the complexity of the function. For example, a simple query takes 1 second, while complex data processing takes 5 seconds.
[0113] The response threshold is a preset time threshold for the target function call. When the function execution time reaches this threshold, the continuation word is triggered for output. It is usually dynamically adjusted based on the average time of the function, for example, taking 1 / 3 of the average time. The execution time is the actual time taken for the target function call from startup to return a result, which is monitored in real time by a timer.
[0114] Specifically, the system first matches the target function to be invoked based on the user's intent label. After receiving user input, the intent recognition model outputs a structured label, and the system determines the specific function to be executed through a pre-defined intent-function mapping table. For example, if the user's intent label is "stock query," the system executes the corresponding target function by referring to the mapping table as "stock query → call stock market information interface."
[0115] Secondly, since the average execution time of different functions varies significantly, for example, the "chat" function takes an average of 0.5 seconds and the "long text generation" function takes an average of 4 seconds, the system will set the response threshold to 1 / 3 to 1 / 2 of the average execution time of the function based on historical execution data or function metadata (such as the response time marked in the interface documentation). For example, the average execution time of stock query is 3 seconds, and the threshold is set to 1 second to ensure that the continuation words are output before the user feels the wait.
[0116] Next, a timer is started when the function is triggered to continuously track the time elapsed from function call to result return. Finally, the decision on whether to output a continuation word is made based on the relationship between execution time and response threshold. If the execution time reaches or exceeds the response threshold, the dynamic continuation word generation model is invoked to output text; if the function is completed within the threshold, the output is skipped to avoid redundant interaction.
[0117] More specifically, by strongly correlating response thresholds with function execution time, the system adapts to the execution characteristics of different functions, avoiding redundant concluding words in fast-response scenarios while ensuring timely reassurance to users in long-duration scenarios, reducing their anxiety during wait. Simultaneously, a conditional output mechanism is constructed based on response thresholds, ensuring that concluding words appear only when necessary. For example, if a user asks "What's the weather like in Shenzhen?" and the weather API returns a result within 0.6 seconds, the agent directly outputs the answer, avoiding the mechanical concluding "searching." If the interface times out by 1 second without a response, then "Okay, let me check the current weather in Shenzhen" is output, making the interaction flow closer to real-life conversation logic.
[0118] Reference Figure 5 , Figure 5 This is a virtual structural diagram of the dynamic generation device for dialogue succession text provided in this application. A second aspect of this application provides a dynamic generation device for dialogue succession text, comprising: Input statement acquisition module 100 is used to acquire user input statements; The statement tag extraction module 200 is used to input the user input statement into a preset tag recognition model, and extract the user intent tag and user emotion tag through the tag recognition model; The receiving text generation module 300 is used to integrate the user intent tag, the user emotion tag and the user input statement into a condition triple, and input the condition triple into a preset receiving text generation model, and generate dialogue receiving text through the receiving text generation model based on the user intent tag and the user emotion tag; The receiving text output module 400 is used to determine the target call function based on the user intent tag, set a response threshold based on the target call function, monitor the execution time of the target call function, and output the dialogue receiving text when the execution time reaches the response threshold.
[0119] The dynamic generation device for dialogue acceptance text described in this application embodiment can execute the dynamic generation method for dialogue acceptance text provided in the above embodiment. The dynamic generation device for dialogue acceptance text has the corresponding functional steps and beneficial effects of the dynamic generation method for dialogue acceptance text described in the above embodiment. For details, please refer to the embodiment of the dynamic generation method for dialogue acceptance text described above. This application embodiment will not repeat the details here.
[0120] This application also provides an electronic device, please refer to... Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device may include a processor and a memory, which can be connected via a bus or other means. The processor may be a Central Processing Unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations of the above types of chips. The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the dynamic generation method of dialogue acceptance text in the embodiments of this application. The processor executes various functional applications and data processing by running the non-transitory software programs, instructions, and modules stored in the memory, thereby realizing the dynamic generation method of dialogue acceptance text in the above method embodiments.
[0121] The memory may include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a function; the data storage area may store data created by the processor, etc. Furthermore, the memory may include high-speed random access memory and non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. The one or more modules stored in the memory, when executed by the processor, perform the dynamic generation method for dialogue reception text as described in the above method embodiments. Specific details of the above electronic device can be understood by referring to the corresponding descriptions and effects in the above method embodiments, and will not be repeated here. Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it may include the processes of the embodiments of the above methods. The storage medium may be a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD), etc.; the storage medium may also include a combination of the above types of memory.
[0122] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this application may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0123] Similarly, it should be understood that, in order to streamline this disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of this application, various features of this application are sometimes grouped together in a single embodiment, figure, or description thereof. However, this approach to disclosure should not be construed as reflecting an intention that the claimed application requires more features than expressly recited in each claim. Rather, as reflected in the claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of this application.
[0124] It should be noted that the above embodiments are illustrative of this application and not restrictive of this application, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims.
Claims
1. A method for dynamically generating dialogue transition text, characterized in that, The method includes: Get user input; The user input statement is input into a preset tag recognition model, and the user intent tag and user emotion tag are extracted by the tag recognition model; The user intent tag, the user emotion tag, and the user input statement are integrated into a condition triple, and the condition triple is input into a preset follow-up text generation model. The follow-up text generation model generates dialogue follow-up text based on the user intent tag and the user emotion tag. The target function is determined based on the user intent tag, a response threshold is set based on the target function, the execution time of the target function is monitored, and the dialogue acceptance text is output when the execution time reaches the response threshold.
2. The method for dynamically generating dialogue succession text according to claim 1, characterized in that, The label recognition model includes an intent recognition model and an emotion recognition model; both the intent recognition model and the emotion recognition model include an encoder, a classification network, and a decoder. In the step of extracting user intent tags and user emotion tags through the tag recognition model, the intent recognition model and the emotion recognition model respectively perform the following processing steps: The user input statement is encoded into an integer symbol sequence, the integer symbol sequence is mapped into a word vector, and positional encoding is superimposed to form an input vector matrix; The input vector matrix is input into the encoder, and the encoder performs contextual semantic feature extraction to generate a semantic feature matrix. The semantic feature matrix is pooled to obtain the text semantic representation; The semantic representation of the text is input into the classification network, the label probability distribution is calculated by the classification network, and the label category with the highest probability is mapped to the corresponding user intent label or user emotion label by the decoder.
3. The method for dynamically generating dialogue succession text according to claim 1, characterized in that, Before the step of inputting the condition triples into the preset receiving text generation model, the method further includes: Construct a basic dataset and a preference dataset, and determine the target training model; the basic dataset includes preset task instructions and multiple sets of training samples, each set of training samples contains training input text and its corresponding standard successor text; the preference dataset contains multiple sets of preference sample sets, each set of preference sample sets includes example input text and its corresponding preferred successor text and unpreferred successor text; The training input text is concatenated with the preset task instruction and then input into the target training model to obtain the model-generated text. The target adjustment parameters in the target training model are adjusted according to the difference between the model-generated text and the standard receiving text to obtain the basic generation model. Based on the preference sample group, the preference parameters of the basic generative model are adjusted to obtain a preference-adjusted generative model; The preference adjustment generation model is quantified to obtain the receiving text generation model.
4. The method for dynamically generating dialogue succession text according to claim 3, characterized in that, The step of adjusting the target adjustment parameters in the target training model based on the difference between the model-generated text and the standard inherited text to obtain the base generative model includes: Identify the target linear transformation layer of the target training model, and introduce a low-rank adapter into the target linear transformation layer; the low-rank adapter constitutes a low-rank parameter increment through the product of a pair of low-rank matrices; Freeze the model parameters except for the low-rank matrix, and adjust the low-rank matrix according to the difference between the model-generated text and the standard receiving text in order to train the low-rank adapter; The trained low-rank adapter is integrated with the target training model to form the basic generative model.
5. The method for dynamically generating dialogue succession text according to claim 3, characterized in that, Before the step of quantizing the preference adjustment generation model, the method further includes: The successor text generated by the preference adjustment generation model is evaluated based on the preset multidimensional evaluation criteria to determine whether the preference adjustment generation model meets the preset multidimensional alignment conditions. If the preference adjustment generation model does not meet the multidimensional alignment condition, then return to the step of concatenating the training input text with the preset task instruction and inputting it into the target training model, so as to iteratively obtain a new preference adjustment generation model; The preference adjustment generation model that meets the multidimensional alignment conditions is quantized to obtain the receiving text generation model.
6. The method for dynamically generating dialogue succession text according to claim 5, characterized in that, Before the step of determining whether the preference adjustment generation model meets the preset multidimensional alignment conditions, the method further includes: A new input text is obtained, and the new input text is processed by the preference-adjusted generation model to generate candidate successor text pairs; the candidate successor text pairs contain newly added successor texts with different styles; Based on the multidimensional evaluation criteria, newly selected superior samples that meet the evaluation criteria and newly selected inferior samples that do not meet the criteria are selected from the candidate acceptance text pairs and combined into self-distilled sample pairs. The preference adjustment generation model is adjusted by self-distillation based on the self-distillation sample, and the preference adjustment generation model that has completed the self-distillation adjustment is used as the evaluation target.
7. The method for dynamically generating dialogue succession text according to claim 3, characterized in that, The step of quantifying the preference adjustment generation model includes: The activation values of the preference adjustment generation model are preprocessed to obtain a smooth activation distribution, and the weight information of each network layer in the preference adjustment generation model is determined based on the smooth activation distribution. All the weight information is quantized, and the quantization parameters corresponding to each weight information are optimized by approximate second order to obtain the initial quantization model. The quantization error of all network layers in the initial quantization model is evaluated, and the network layers that are sensitive to quantization error are selected based on the quantization error evaluation results. The parameters of all the network layers to be corrected are fine-tuned to correct the quantization error, thereby obtaining the text generation model.
8. A dynamic generation device for dialogue continuation text, characterized in that, include: The input statement acquisition module is used to acquire user input statements; The statement tag extraction module is used to input the user input statement into a preset tag recognition model, and extract the user intent tag and user emotion tag through the tag recognition model; The continuation text generation module is used to integrate the user intent tag, the user emotion tag, and the user input statement into a condition triple, and input the condition triple into a preset continuation text generation model, and generate dialogue continuation text based on the user intent tag and the user emotion tag through the continuation text generation model; The receiving text output module is used to determine the target function to be invoked based on the user intent tag, set a response threshold based on the target function to be invoked, monitor the execution time of the target function to be invoked, and output the dialogue receiving text when the execution time reaches the response threshold.
9. An electronic device, characterized in that, include: One or more processors; One or more memory units; And one or more computer programs, wherein the one or more computer programs are stored in the one or more memories, the one or more computer programs including instructions that, when executed by the one or more processors, cause the electronic device to perform the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The storage medium stores a program or instructions that, when executed, implement the method as described in any one of claims 1 to 7.