Intelligent question answering methods and devices, electronic devices, and readable storage media

By extracting user style and attribute features and combining them with multi-turn dialogue coding and intent recognition models, personalized response information is generated, which solves the problem that user interaction style and attribute information are not considered in existing technologies, and achieves more accurate intent recognition and personalized responses.

CN122364407BActive Publication Date: 2026-11-17BEIJING SUPERHEXA CENTURY TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610663718.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-05-14
Publication Date
2026-11-17
Estimated Expiration
2046-05-14

AI Technical Summary

Technical Problem

Existing intelligent question answering methods fail to effectively combine users' interaction style preferences and objective attribute information, resulting in a low degree of consistency between intent recognition results and users' actual needs, and the generated response content lacks personalization and adaptability.

Method used

By extracting user-defined style description text and attribute information, style feature sets and attribute feature sets are generated. Multi-turn dialogues are then vectorized and encoded. Combined with a pre-set intent recognition model and a large language model, personalized response information is generated.

Benefits of technology

It improves the personalization and intent recognition accuracy of intelligent question answering, ensuring that responses closely align with users' core needs and preferences, and providing a precise and personalized interactive experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122364407B_ABST
    Figure CN122364407B_ABST
Patent Text Reader

Abstract

This application provides an intelligent question-answering method, device, electronic device, and readable storage medium, belonging to the field of intelligent interaction. The method includes: extracting user-defined style description text to obtain a style feature set; obtaining an attribute feature set based on attribute information; vectorizing historical dialogue sequences and aggregating them through temporal encoding to obtain a context encoding vector; obtaining a candidate intent set and confidence level through a preset intent recognition model; determining the target matching degree by combining style, attribute feature set, context encoding vector, and confidence level, thereby determining the target intent and intent prompt words; and finally generating response information for the current input through a large language model. The intelligent question-answering method, device, electronic device, and readable storage medium provided by this application can provide users with an accurate and personalized interactive experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of intelligent interaction technology, and more specifically, relates to an intelligent question-answering method and device, electronic device, and readable storage medium. Background Technology

[0002] With intelligent interaction technologies widely used in scenarios such as intelligent assistants and online customer service, most existing interaction methods rely solely on the user's current text input. They use pre-trained intent recognition models to determine intent and generate responses. In practice, these methods fail to consider users' subjective interaction style preferences or objective attributes such as age and location. Relying solely on a single dimension of text input for intent recognition and response generation results in a low degree of alignment between intent recognition and actual user needs. The generated responses lack personalization and ultimately fail to provide users with an accurate and tailored interactive experience. Summary of the Invention

[0003] The purpose of this application is to provide an intelligent question-answering method and device, electronic device, and readable storage medium that can provide users with an accurate and personalized interactive experience.

[0004] A first aspect of this application provides an intelligent question-answering method, including: Feature extraction is performed on the user's custom style description text to obtain the user's style feature set. The custom style description represents the user's preferred interaction style during the intelligent question answering process. Based on the user's attribute information, the user's attribute feature set is obtained. The attribute information includes at least one of age, gender, region, and occupation. For the historical dialogue sequence in the current multi-turn dialogue, the dialogue text of each turn in the historical dialogue sequence is vectorized to obtain multiple dialogue text vectors; and the multiple dialogue text vectors are temporally encoded and information aggregated to obtain a context encoding vector that represents the overall semantics and state of the multi-turn dialogue. Based on the text information currently input by the user, and through a preset intent recognition model, the user's candidate intent set and the confidence level of each candidate intent are obtained; the preset intent recognition model is trained in advance through a labeled dataset, which contains multiple types of intents; The target matching degree of each candidate intent is determined by fusing style feature set, attribute feature set, context encoding vector and confidence of each candidate intent. The user's target intent is determined based on the target matching degree of each candidate intent, and intent prompt words are determined based on the target intent; Based on intent prompts and using a large language model, response information is generated, which is a response to textual information.

[0005] A second aspect of this application provides an intelligent question-answering device, comprising: The feature set acquisition module is used to extract features from the user's custom style description text to obtain the user's style feature set. The custom style description represents the user's preferred interaction style during the intelligent question answering process. Based on the user's attribute information, the module obtains the user's attribute feature set. The attribute information includes at least one of age, gender, region, and occupation. The vector acquisition module is used to vectorize the historical dialogue sequence in the current multi-turn dialogue, representing each round of dialogue text in the historical dialogue sequence to obtain multiple dialogue text vectors; and to perform temporal encoding and information aggregation on the multiple dialogue text vectors to obtain a context encoding vector representing the overall semantics and state of the multi-turn dialogue. The intent candidate module is used to obtain the user's candidate intent set and the confidence level of each candidate intent based on the text information currently input by the user and through a preset intent recognition model. The preset intent recognition model is trained in advance through a labeled dataset, which contains multiple types of intents. The matching calculation module is used to fuse style feature sets, attribute feature sets, context encoding vectors and the confidence of each candidate intent to determine the target matching degree of each candidate intent; The prompt word determination module is used to determine the user's target intent based on the target matching degree of each candidate intent, and to determine the intent prompt words based on the target intent; The information response module is used to generate response information based on intent prompts and a large language model. The response information is text-based.

[0006] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the above-described intelligent question-answering method.

[0007] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the intelligent question-answering method described above.

[0008] The beneficial effects of the intelligent question-answering method, apparatus, electronic device, and readable storage medium provided in this application are as follows: This application's embodiments obtain a style feature set by extracting user-defined style description text and an attribute feature set based on attribute information, allowing question-answering to adapt to user interaction styles and objective attributes, avoiding the drawbacks of traditional indiscriminate responses; vectorizing and encoding historical dialogue sequences and aggregating them to obtain context encoding vectors can capture the overall semantics and state of multi-turn dialogues, solving the problem of misinterpretation caused by relying solely on the current input; by using a preset intent recognition model to output a candidate intent set and confidence level, and combining the aforementioned feature set and context encoding vector to determine the target matching degree, it can comprehensively optimize intent judgment based on multi-dimensional information, improving the accuracy of intent recognition; by generating prompt words based on the target intent and generating responses through a large language model, it ensures that responses closely adhere to core needs. In summary, this application's embodiments, through multi-dimensional feature fusion and context awareness, improve the personalization adaptability, intent recognition accuracy, and response coherence of intelligent question answering, providing users with a precise and personalized interactive experience. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 A flowchart illustrating an intelligent question-answering method provided in an embodiment of this application; Figure 2 A structural block diagram of an intelligent question-answering device provided in an embodiment of this application; Figure 3 This is a schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0011] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0012] It is understood that in the embodiments of this application, data such as user information are involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with relevant laws, regulations and standards.

[0013] To make the objectives, technical solutions, and advantages of this application clearer, the following description will be provided in conjunction with the accompanying drawings and specific embodiments.

[0014] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the intelligent question-answering method provided in this application, which can be executed by an electronic device. The method may include: S101: Extract features from the user's custom style description text to obtain the user's style feature set. The custom style description represents the user's preferred interaction style during the intelligent question answering process. Based on the user's attribute information, obtain the user's attribute feature set. The attribute information includes at least one of age, gender, region, and occupation.

[0015] In this embodiment, the custom style description text is natural language text actively entered by the user to define the interaction style of the intelligent question-and-answer process. It represents the interaction style that the user prefers during the intelligent question-and-answer process, such as "the reply should be concise and efficient, without redundant expressions" or "it should be as humorous and down-to-earth as chatting with a Northeastern friend".

[0016] In this embodiment, the style feature set is a collection obtained after extracting features from user-defined style description text. It can be implemented using the TF-IDF algorithm combined with the LDA topic model. The TF-IDF threshold is set to 0.3. After filtering out style keywords, the style topics are clustered using the LDA model (with 5 topics and 100 iterations) to form the style feature set. Each feature contains keywords and initial weights. For example, a set of style keywords such as "concise and efficient" and "humorous and down-to-earth" is used to accurately represent the user's interaction style preferences.

[0017] In this embodiment, the attribute feature set is a structured collection based on the attribute information filled in by the user. It can be collected through optional fields in the interactive interface. The user can choose to fill in at least one of age, gender, region, and occupation. After filling in, it can be automatically organized into a structured attribute feature set, with each attribute labeled with a specific value. For example, "Age: 28 years old, Gender: Male, Region: Shenyang, Liaoning, Occupation: Programmer"; it is used to represent the user's basic attribute features.

[0018] In this embodiment, user-initiated custom style description text is received. A feature extraction algorithm is used to filter out style keywords from the text and cluster them to form a style feature set that accurately represents user interaction preferences. Simultaneously, at least one attribute information provided by the user, such as age, gender, region, or occupation, is collected and organized into a structured attribute feature set. The generation of these two feature sets breaks the limitation of indiscriminate responses in traditional question-answering methods, laying a data foundation for subsequent personalized adaptation.

[0019] S102: For the historical dialogue sequence in the current multi-turn dialogue, vectorize the dialogue text of each turn in the historical dialogue sequence to obtain multiple dialogue text vectors; and perform temporal encoding and information aggregation on the multiple dialogue text vectors to obtain a context encoding vector that represents the overall semantics and state of the multi-turn dialogue.

[0020] In this embodiment, the historical dialogue sequence refers to the content of multiple rounds of dialogue (such as the last 10 rounds of dialogue) before the user's current input text, including the user's input text and response text.

[0021] In this embodiment, the dialogue text vector is a dense numerical tensor obtained by vectorizing the dialogue text of each round in the historical dialogue sequence. It is a machine-recognizable text semantic carrier. This embodiment can be implemented using a lightweight BERT model. First, each round of dialogue text is preprocessed by word segmentation (using the jieba word segmentation tool) and stop word removal. Then, a 768-dimensional dialogue text vector is generated by model encoding. The vector element values ​​range from [-1, 1].

[0022] In this embodiment, temporal coding is a coding technique that can capture the temporal correlation and semantic dependency between data points in temporal data (such as multi-turn dialogue sequences), highlighting the chronological order and logical relationship of texts in different turns of a historical dialogue. Information aggregation refers to a technique that fuses multiple vector data into a comprehensive vector, integrating the semantic information of multiple dialogue text vectors to generate a vector representing the overall semantics of the multi-turn dialogue. This embodiment can be implemented using a Transformer encoder, which includes two coding layers, each containing eight attention heads with a head dimension of 64. It captures the temporal correlation and semantic dependency between turns of dialogue through a self-attention mechanism, and then aggregates them through a fully connected layer (with ReLU activation function) to obtain a 768-dimensional context coding vector. The context coding vector can fully represent the overall semantics and interaction state of the multi-turn dialogue.

[0023] In this embodiment, the historical dialogue sequence of the current multi-turn dialogue is retrieved, and the user input text and system response text of each turn in the sequence are vectorized to generate dialogue text vectors with semantic representation capabilities. Subsequently, temporal coding technology is used to capture the chronological order and logical connections between each turn of dialogue, and then information aggregation technology is used to fuse multiple dialogue text vectors into a comprehensive vector, ultimately obtaining a context-coded vector that can represent the overall semantics and state of the multi-turn dialogue. The generation of this vector solves the problem of traditional question-answering methods taking things out of context, and provides complete contextual semantic support for intent recognition.

[0024] S103: Based on the text information currently input by the user, and through a preset intent recognition model, obtain the user's candidate intent set and the confidence level of each candidate intent; the preset intent recognition model is a model trained in advance through a labeled dataset, which contains multiple types of intents.

[0025] In this embodiment, the preset intent recognition model is a machine learning model pre-trained on a labeled dataset, which has the ability to classify the intent of user input text. This embodiment can be trained based on a lightweight BERT model, with 50 training iterations, a learning rate of 1e-5, an optimizer of AdamW (weight decay coefficient of 0.01), and a loss function of cross-entropy loss. The model deployment is accelerated using TensorRT, and the inference latency is controlled within 100ms.

[0026] The labeled dataset is a sample set used to train the intent recognition model. It contains dialogue text and corresponding intent labels for multiple types of intents, such as information inquiry, style adjustment request, casual conversation, instruction execution, and intent ambiguity. Each type of intent has no less than 1,000 samples. The sample format is "dialogue text + intent label + confidence label". The dataset is divided into training set, validation set and test set in a 7:2:1 ratio. The test set can only be used for model training after the accuracy reaches the target.

[0027] The candidate intent set refers to the set of multiple possible intents output by the intent recognition model after matching the intent of the user's current input text. Each element in the set corresponds to a possible user intent. In this embodiment, the number of candidate intents output by the model does not exceed 5. Each candidate intent corresponds to a confidence level (value range [0,1]), which can be calculated by the Softmax function of the model output layer, representing the probability of the model's judgment of the intent. In order to facilitate subsequent fusion calculation, the confidence level can be retained to two decimal places.

[0028] In this embodiment, the user's current text input is fed into a pre-trained intent recognition model. This model, based on intent classification capabilities learned from labeled datasets, performs semantic matching and intent categorization on the input text, outputting a candidate intent set containing multiple possible intents. Simultaneously, the model assigns a confidence score to each candidate intent using algorithms such as the Softmax function. The confidence score ranges from [0,1], with higher values ​​indicating a greater probability of the model classifying that intent. This method achieves a preliminary transformation from user natural language input to machine-quantifiable intent.

[0029] S104: Determine the target matching degree of each candidate intent based on the style feature set, attribute feature set, context encoding vector, and confidence of each candidate intent.

[0030] In this embodiment, the target matching degree refers to the metric obtained by quantifying the degree of fit between each candidate intent and the user's actual needs by comprehensively considering the style feature set, attribute feature set, context encoding vector, and candidate intent confidence (the value range is [0,1]). This metric is the result of multi-dimensional information collaborative evaluation. The higher the value, the closer the candidate intent is to the user's needs, providing a clear quantitative standard for the final determination of the target intent.

[0031] In this embodiment, the confidence level of candidate intents is used as the basis for judgment. At the same time, the user's personalized preferences reflected by style feature sets and attribute feature sets, as well as the overall semantics and state of multi-turn dialogues carried by context encoding vectors, are combined to comprehensively evaluate each candidate intent through multi-dimensional collaborative judgment logic. This effectively avoids the problem of misjudgment of intent caused by relying solely on single-turn text or single-dimensional information in traditional methods, and realizes the transition from preliminary intent recognition to accurate intent screening.

[0032] S105: Determine the user's target intent based on the target matching degree of each candidate intent, and determine the intent prompt words based on the target intent.

[0033] In this embodiment, the target intent is the intent with the highest target matching degree selected from the candidate intent set that meets the preset threshold requirement. For example, the target matching degree threshold is set to 0.6, and the candidate intent with the highest matching degree and not lower than the threshold is selected as the target intent. If the matching degree of all candidate intents is lower than the threshold, a standardized clarification request (e.g., "Do you want to consult on related issues, adjust your dialogue style, or do you have other needs?") is sent to obtain the explicit intent.

[0034] Intent prompts are natural language text generated based on the target intent. They can clearly convey the user's needs and personalized constraints. For example, they can be in natural language text format and include the core requirements of the target intent and personalized adaptation requirements. An example is "Core requirement: answer the computer assembly steps; Personalization requirement: use Northeastern dialect, concise expression, avoid technical terms, and fit the language habits of a 28-year-old programmer user".

[0035] In this embodiment, the target matching degree of each candidate intent is sorted, and the candidate intent with the highest matching degree and meeting the preset threshold requirement is selected as the user's target intent. This target intent is the core need of the user's current input text. Subsequently, based on the connotation of this target intent, combined with the user's style feature set and attribute feature set, intent prompt words that can clearly convey the user's needs and personalized constraints are generated. The generation of intent prompt words realizes the transformation from machine-quantified intent to natural language instructions, providing clear guidance for the response generation of the large language model.

[0036] S106: Based on intent prompts and through a large language model, generate response information, which is a response to textual information.

[0037] In this embodiment, the large language model refers to an artificial intelligence model with powerful natural language understanding and generation capabilities, such as GPT-4 and LLaMA3, which can generate response information that meets user needs based on intent prompts; the response information refers to the response text generated by the large language model based on intent prompts in response to the user's current input text, which is the final output of the intelligent question answering method.

[0038] In this embodiment, the generated intent prompts are input into a large language model. Based on its powerful natural language understanding and generation capabilities, the model strictly follows the requirements and personalization requirements in the intent prompts and combines the contextual semantic background to generate response information for the user's current input text. Finally, the response information is output to the user, completing a complete intelligent question-and-answer interaction.

[0039] As can be seen from the above, this embodiment obtains a style feature set by extracting user-defined style description text and an attribute feature set based on attribute information, allowing question answering to adapt to user interaction style and objective attributes, avoiding the drawbacks of traditional indiscriminate replies. Vectorizing and encoding historical dialogue sequences and aggregating them to obtain context encoding vectors captures the overall semantics and state of multi-turn dialogues, solving the problem of misinterpretation caused by relying solely on the current input. By using a preset intent recognition model to output a candidate intent set and confidence level, and combining the aforementioned feature set and context encoding vector to determine the target matching degree, multi-dimensional information can be comprehensively used to optimize intent judgment and improve intent recognition accuracy. Generating prompt words based on the target intent and generating replies through a large language model ensures that the replies closely adhere to the core needs. In summary, this embodiment improves the personalization adaptability, intent recognition accuracy, and reply coherence of intelligent question answering through multi-dimensional feature fusion and context awareness, providing users with a precise and personalized interactive experience.

[0040] In one embodiment of this application, the target matching degree of each candidate intent is determined based on the style feature set, attribute feature set, context encoding vector, and the confidence level of each candidate intent, including: The first formula is used to calculate the first degree of correlation between each candidate intent and the user's style feature set and attribute feature set, respectively. The second formula is used to calculate the second correlation degree between the current encoding vector and the context encoding vector corresponding to the current user input text information. The third formula is used to fuse the first relevance, the second relevance, and the confidence of each candidate intent to obtain the target matching degree of each candidate intent. The first formula is: ; ; in, This represents the first correlation between the i-th candidate intent and the style feature set. This represents the first degree of correlation between the i-th candidate intent and the attribute feature set. Let represent the semantic similarity between the i-th candidate intent and feature s in the style feature set. Let represent the semantic similarity between the i-th candidate intent and feature p in the attribute feature set. This represents the weight of feature s in the style feature set. This represents the weight corresponding to feature p in the attribute feature set; The second formula is: ; in, Indicates the second degree of relevance. This represents the Sigmoid activation function. This represents the weight matrix of the fully connected layer. Indicates the current encoded vector. Represents the context encoding vector. This indicates a splicing operation. Indicates the bias term of the fully connected layer; The third formula is: ; in, This represents the target matching degree of the i-th candidate intent. This represents the confidence level of the i-th candidate intent.

[0041] In the first formula of this embodiment, Used to measure the semantic fit between the i-th candidate intent and the features s in the style feature set. Used to measure the semantic fit between the i-th candidate intent and feature p in the attribute feature set. and The Word2Vec algorithm can be used for calculation. The Word2Vec algorithm adopts the Skip-gram architecture, with a vector dimension of 300, a training window size of 5, a negative sampling number of 5, and a semantic similarity value range of [0,1]. The closer the value is to 1, the higher the degree of association.

[0042] This is used to demonstrate the importance of this style feature in personalized adaptation. This attribute is used to reflect the importance of the attribute feature in personalized adaptation, and its value range is [0,1]. This embodiment... and Assignments can be made using preset rules, which can be based on style features explicitly emphasized by the user. A value of 0.8 indicates a common style characteristic. The value is 0.5, attribute characteristic The value is 0.3, and will be dynamically adjusted based on user feedback.

[0043] and It can be obtained by weighted summation of the semantic similarity between each feature in the feature set and the candidate intent, which represents the overall correlation between the candidate intent and the corresponding feature set.

[0044] In the second formula of this embodiment, the second degree of correlation The value range is [0,1], which represents the degree of semantic association between the candidate intent corresponding to the current input text and the context of the multi-turn dialogue; This represents the Sigmoid activation function, expressed as: The function is to map the calculation results to the [0,1] interval, ensuring that the second correlation degree meets the probability representation requirements and avoiding numerical overflow affecting the fusion result; the Sigmoid activation function is a commonly used non-linear activation function that can map any real number input to the [0,1] interval, and is often used for probability normalization processing of the output layer; the weight matrix W of the fully connected layer has a dimension of 1536×1, corresponding to the dimension of the concatenation of the current encoding vector and the context encoding vector. The matrix parameters can be obtained through model training and are used to linearly transform the fusion vector to ensure stable convergence during the training process; the current encoding vector The current user input text can be encoded using a lightweight natural language processing model. It has 768 dimensions and is used to represent the semantic information of the current input text, with values ​​ranging from [-1, 1]. and The current encoding vector and the context encoding vector are concatenated column by column to form a higher-dimensional fusion vector, which provides a basis for subsequent correlation calculation. The bias term b of the fully connected layer is a scalar, with an initial value of 0. It can be dynamically adjusted through model training to correct the linear output of the fully connected layer and improve the calculation accuracy.

[0045] In the third formula of this embodiment, This represents the confidence level of the i-th candidate intent, which is the initial probability of the preset intent recognition model in determining the candidate intent. The value range is [0,1]. The target matching degree of the i-th candidate intent is represented by the comprehensive correlation degree, the second correlation degree, and the confidence degree. It is the core indicator for quantifying the degree of fit between the candidate intent and the user's real needs. 0.4, 0.3, 0.15, and 0.15 are fixed weight coefficients, which satisfy the condition that the sum of the coefficients is 1. This prioritizes the role of the initial confidence degree of the intent recognition model, while also taking into account the influence of feature correlation degree and contextual correlation degree. In practical applications, the coefficients can be optimized through grid search (search range 0.1-0.6, step size 0.05) with the goal of improving the accuracy of intent recognition.

[0046] In this embodiment, the first formula is used to calculate the first correlation degree between the candidate intent and the style feature set and the attribute feature set, respectively, by combining the weights of each feature and semantic similarity. This quantifies the degree of fit between the candidate intent and the user's personalized features, highlighting the influence of high-weight features. Secondly, the current encoding vector and the context encoding vector are concatenated and input into the fully connected layer. The second correlation degree is calculated by the sigmoid activation function and the second formula, reflecting the semantic association between the candidate intent and the multi-turn dialogue context. Finally, the third formula is used to sum the candidate intent confidence, the two first correlation degrees, and the second correlation degree according to preset weight coefficients to obtain the target matching degree of each candidate intent. This achieves the orderly fusion of multi-dimensional indicators and provides quantitative support for the accurate determination of target intent.

[0047] As can be seen from the above, this embodiment achieves multi-dimensional index fusion calculation by clearly defining the quantitative formula, making the target matching degree calculation process traceable, avoiding the subjective bias of traditional fusion methods, and improving the accuracy of target matching degree calculation; by reasonably allocating the weight coefficients of each index, it not only ensures the core role of the initial confidence, but also fully integrates personalized features and contextual information, further improving the accuracy of target intent judgment and effectively reducing the probability of intent misjudgment caused by ambiguous input.

[0048] In one embodiment of this application, the intent prompt includes core prompts and auxiliary prompts; Based on intent prompts and using a large language model, response information is generated, including: The complexity of the target intent is determined by the number of core and auxiliary cue words; The target splicing pattern is determined based on complexity, and the corresponding prompt word elements are selected based on the target splicing pattern; The intent cue words and cue word elements are concatenated to obtain the target intent cue words, and then a response message is generated through a large language model. The prompt elements include fixed prompts, variable prompts, target context information, and the text information currently entered by the user; Both the style feature set and the attribute feature set contain weights for their features; The methods for determining variable prompts include: A personalized prompt word set is generated based on the style feature set, and the prompt words in the personalized prompt word set correspond one-to-one with the features in the style feature set; Select personalized prompt words whose weights in the style feature set and attribute feature set are greater than the preset weights as variable prompt words; The methods for determining target context information include: Feature extraction is performed on the context encoding vector to select target context encoding vectors whose semantic relevance to the current input text information is greater than a preset relevance threshold. The target context encoding vectors are then standardized to obtain the target context information.

[0049] In this embodiment, the core prompt word is a component of the intent prompt word, used to characterize the core needs of the target intent. It is directly generated from the target intent. In this embodiment, it can be expressed in concise natural language, such as "answering computer assembly steps" or "recommending a high-performance computer CPU around 5000 yuan". Each target intent corresponds to one core prompt word. Auxiliary prompts are also a component of intent prompts, used to characterize the user's personalized adaptation needs. They correspond one-to-one with style features and attribute features, reflecting user interaction preferences and objective attributes. Examples include "using Northeastern dialect", "concise and non-redundant reply", and "fitting the language habits of Liaoning users". Each feature corresponds to one auxiliary prompt. The complexity of the target intent is a quantitative indicator calculated based on the number of core cue words and auxiliary cue words. The formula is K = number of core cue words × 0.5 + number of auxiliary cue words × 0.5, which is used to judge the complexity of the target intent. The number of core cue words is fixed at 1, and the number of auxiliary cue words ranges from 1 to 5. Therefore, the K value ranges from 0.5 to 3.0. The larger the K value, the higher the complexity of the target intent. The target concatenation mode is a cue word concatenation rule determined by the complexity of the target intent. It corresponds to different combinations of cue word elements to ensure that the target intent cue words are accurate and concise. After concatenation, the format integrity is automatically checked to avoid missing elements.

[0050] In this embodiment, the cue word elements are the basic components used to concatenate and generate target intent cue words, including four categories: fixed cue words, variable cue words, target context information, and the text information currently input by the user; wherein: Fixed prompts: These are fixed, unchanging basic constraint texts. The content can be something like, "You are an intelligent question-and-answer assistant. Your replies must conform to language standards, have no grammatical errors, be logically clear, strictly follow user-added requirements to achieve style adaptation, and not add irrelevant content." These are the basic guidelines used to constrain the replies of the large language model and ensure that the replies are compliant. Variable prompt words: Personalized and dynamically adjusted prompt words, with a preset weight threshold of 0.6. They are composed of personalized prompt words corresponding to features with a weight ≥ 0.6 in the style feature set and attribute feature set. The format is uniformly "Style requirement: XXX; Attribute adaptation: XXX". Setting the threshold to 0.6 can effectively distinguish between core and secondary features. In practical applications, it can be adjusted to 0.5-0.7. This application embodiment does not limit this. Target context information: generated based on context encoding vectors, which are the 768-dimensional context encoding vectors mentioned earlier; the preset relevance threshold is 0.7, and the semantic relevance between the context encoding vector and the current encoding vector is calculated using the cosine similarity algorithm, and the semantic content corresponding to the context encoding vector with a relevance ≥ 0.7 is selected; the standardization process is to use a unified prefix "recent dialogue context:", extract the core semantics and remove redundant information, for example "recent dialogue context: the user previously consulted for recommendations on high-performance computer CPUs with a budget of 5000 yuan, focusing on the balance between performance and power consumption"; The text information currently entered by the user: The original text submitted by the user in the current round, without modification or deletion, is directly used as the prompt word element to ensure that the large language model obtains complete input information.

[0051] In this embodiment, the personalized prompt word set is a set of prompt words generated based on the style feature set, where each prompt word corresponds one-to-one with a feature in the style feature set, providing a basis for the selection of variable prompt words; The preset weight is used as the weight threshold for filtering variable prompt words. It can be set based on experience. In this embodiment, it is set to 0.6 (which can be adjusted in the range of 0.5-0.7). Only prompt words corresponding to features with weights greater than this threshold are selected as variable prompt words. The preset relevance threshold is a semantic relevance threshold used to filter target context encoding vectors. It can be set based on experience, usually 0.7, to retain only context encoding vectors whose semantic relevance to the current input text is greater than this threshold. Standardization is a text optimization process performed on the selected target context encoding vectors. Its purpose is to unify the expression format (prefixed with "recent dialogue context:"), extract core semantics, and remove redundant information, so as to make the context content concise and standardized.

[0052] In this embodiment, intent prompts are divided into core prompts and auxiliary prompts. Core prompts focus on the core needs of the target intent, while auxiliary prompts correspond to personalized features, achieving a hierarchical expression of needs and preferences. Next, the complexity K of the target intent is calculated based on the number of core and auxiliary prompts. The target splicing pattern is determined according to the K value, and the corresponding prompt elements are matched. Variable prompts are obtained by filtering personalized prompts corresponding to high-weight features, eliminating secondary features to reduce redundancy. Target context information is obtained through high-relevance filtering and standardization to ensure accurate and effective contextual support. Finally, intent prompts and selected prompt elements are spliced ​​in a preset order to form target intent prompts. After being input into a large language model, response information that fits the needs is generated.

[0053] As can be seen from the above, this embodiment, through the hierarchical design of core and auxiliary prompt words, ensures that the intent prompt words clearly define the core needs while also taking into account personalized adaptation, avoiding confusion between needs and preferences; high-weight feature filtering of variable prompt words reduces the redundancy of prompt words and focuses on the user's core preferences; high-relevance filtering and standardized processing of target context information avoids contextual redundancy interference and improves the coherence of the response; and dynamic selection of splicing mode based on complexity allows prompt words to adapt to different complexity requirements, significantly improving the accuracy and personalization of the large language model's response.

[0054] In one embodiment of this application, the target stitching pattern includes a first stitching pattern or a second stitching pattern; The target splicing pattern is determined based on complexity. Based on this pattern, appropriate cue word elements are selected and spliced ​​to obtain the target intent cue words, including: Based on the response accuracy of the first and second splicing modes in the test scenario, the intent complexity threshold is determined. If the complexity is less than or equal to the complexity threshold, the first concatenation pattern is taken as the target concatenation pattern, and the intent prompt, fixed quantity prompt, and variable prompt are concatenated to obtain the target intent prompt. If the complexity exceeds the complexity threshold, the second concatenation mode is used as the target concatenation mode, and the intent prompt, fixed quantity prompt, variable prompt, target context information and the text information currently input by the user are concatenated to obtain the target intent prompt. The number of prompt words corresponding to the first splicing pattern is less than the number of prompt words corresponding to the second splicing pattern.

[0055] In this embodiment, the first concatenation mode is suitable for simple intent scenarios (complexity ≤ intent complexity threshold). The prompt word element combination consists of intent prompt words + fixed prompt words + variable prompt words, a total of 3 types of elements; the concatenation order is "fixed prompt words + intent prompt words + variable prompt words", ensuring that core constraints and requirements are prioritized for recognition by the large language model. An example is: "You are an intelligent question-and-answer assistant. Your replies must conform to language norms, have no grammatical errors, be logically clear, strictly follow the user's additional requirements to complete style adaptation, and not add irrelevant content. Core requirement: answer computer installation steps; Personalization requirement: use Northeastern dialect, concise expression. Style requirement: use Northeastern dialect, concise expression; Attribute adaptation: fit the language habits of Liaoning users."

[0056] The second concatenation mode is suitable for complex intent scenarios (complexity > intent complexity threshold). The cue word element combination consists of intent cue word + fixed cue word + variable cue word + target context information + user's current input text information, a total of 5 elements; the concatenation order is "fixed cue word + intent cue word + variable cue word + target context information + user's current input text information", providing complete support for large language models. The example adds "recent dialogue context: the user previously consulted for recommendations on high-performance computer CPUs with a budget of 5000 yuan, focusing on the balance between performance and power consumption; the user's current input: Hey bro, can you give me a computer assembly guide, keep it simple" to the first concatenation mode.

[0057] The intent complexity threshold is a critical value used to distinguish between simple and complex intent scenarios. It can be determined by comparing the response accuracy of the two splicing modes in the test scenario. The test scenario is a set of experimental scenarios used to determine the intent complexity threshold. The test scenario covers simple intent scenarios (single information inquiry, short instruction execution) and complex intent scenarios (multiple needs superimposed, inquiry requiring context support). The test sample size for each scenario is no less than 500. The response accuracy of the two splicing modes in each scenario is calculated separately. The K value with the smallest difference in response accuracy between the two modes is used as the threshold. The typical threshold is set to 1.5. In practical applications, the threshold can be dynamically adjusted according to the addition of test samples. This application embodiment does not limit this.

[0058] In this embodiment, the complexity K value is calculated as K = number of core prompt words × 0.5 + number of auxiliary prompt words × 0.5. The number of core prompt words is fixed at 1, and the number of auxiliary prompt words is 1-5. Therefore, the K value ranges from 0.5 to 3.0. When K ≤ 1.5, it is determined to be a simple intent scenario, and the first splicing mode is selected. When K > 1.5, it is determined to be a complex intent scenario, and the second splicing mode is selected.

[0059] The splicing process is executed automatically by the system. After splicing, the target intent prompt words are checked by a grammar checker to ensure that there are no grammatical errors and the information is complete. If the check passes, the information is input into the large language model. If the check fails, the splicing is re-executed according to the original pattern, and the number of retries is limited to 3.

[0060] In this embodiment, by comparing the response accuracy of two splicing modes in a test scenario, a reasonable intent complexity threshold is determined, establishing a correspondence between complexity and splicing modes to provide an objective basis for mode selection. Next, the complexity K value of the target intent is calculated, and the K value is compared with the threshold to determine the intent scenario type and select the corresponding target splicing mode. For simple intent scenarios, the first splicing mode is used, splicing only three core elements to reduce redundancy and improve generation efficiency. For complex intent scenarios, the second splicing mode is used, supplementing the target context information and the current input text to provide complete support. Finally, target intent prompt words are generated according to the splicing order of the corresponding modes, and input into a large language model to generate response information, balancing efficiency and quality.

[0061] As can be seen from the above, this embodiment determines the complexity threshold through test data to avoid subjective bias in mode selection; the first splicing mode is used in simple scenarios, which improves the efficiency of large language model response generation while ensuring response accuracy; the second splicing mode is used in complex scenarios to supplement the complete context and input information, thereby improving the response accuracy in complex scenarios and avoiding responses that are taken out of context; the two modes are dynamically switched to adapt to different complexity intent scenarios, taking into account both response generation efficiency and quality, and meeting diverse interaction needs.

[0062] In one embodiment of this application, determining intent prompts based on the target intent includes: Based on the target intent, the corresponding target prompt word template is determined from the preset prompt word template library. The target prompt word template is used to constrain the content contained in the response information. Based on the weights of each style feature in the style feature set, the correlation between each style feature and the target intent is calculated. Also, based on the weights of each attribute feature in the attribute feature set, the correlation between each attribute feature and the target intent is calculated. Based on the relevance, features with a relevance greater than the threshold are selected from the style feature set and attribute feature set respectively, and these features are converted into natural language descriptions to form personalized auxiliary prompt words; Combine target cue templates with personalized auxiliary cue words to generate intent cue words.

[0063] In this embodiment, the preset prompt word template library is a database that stores prompt word templates categorized by intent type. Each intent type corresponds to at least one template. The template contains the core content and expression specifications that the reply must cover, and can be stored in JSON format for easy retrieval and updating. For example, the template for information consultation is "Core requirement: The reply must include specific steps / methods, be logically clear, and have no redundant information," and the template for style adjustment is "Core requirement: Adjust the interaction style; the reply must meet the style requirements and maintain the continuity of the dialogue." The template library supports dynamic updates, and templates can be added or modified according to actual application scenarios. After updating, historical versions are retained for easy rollback.

[0064] The target prompt template is a template matched from the prompt template library that corresponds to the target intent. If multiple corresponding templates exist, the template with the highest frequency of use is selected as the target template. The placeholders in the target template are filled with the core requirements of the target intent, and after filling, they form a structured core prompt content. For example, if the target intent is "consulting on computer assembly steps", the template after filling is "core requirements".

[0065] The relevance threshold is a critical value used to filter strongly correlated features. It can be set according to the actual application scenario. In this embodiment, it can be set to 0.5 (which can be adjusted in the range of 0.4-0.6). Only features with a relevance greater than this threshold are selected to generate personalized auxiliary prompts. The formula for calculating the relevance is as follows: ,in For feature weights, The semantic similarity between features and target intent is calculated (using the Word2Vec algorithm); the correlation between style features and attribute features is calculated separately, with values ​​ranging from [0,1]. This calculation method can take into account both feature weights and semantic relevance, ensuring the accuracy of the correlation.

[0066] Personalized auxiliary prompts are natural language text generated based on strongly correlated style and attribute features. The format is uniformly "Style Requirements: XXX; Attribute Matching: XXX". Example: Filter out "Northeastern Dialect (…)". =0.85, correlation =0.82) "Concise expression ( =0.83, correlation =0.80) "Liaoning Shenyang ( =0.4, relevance=0.55), after conversion, it becomes "Style requirements: use Northeastern dialect, concise expression; attribute adaptation: fit the language habits of users in Shenyang, Liaoning"; combine in the order of "target prompt word template + personalized auxiliary prompt word", optimize the fluency of the sentence after combination, avoid repetition and redundancy, generate clear and well-constrained intent prompt words, and ensure that the large language model accurately understands the needs and preferences.

[0067] In this embodiment, target prompt word templates are matched from the template library according to the target intent type. The templates are used to construct a core constraint framework for the response, ensuring that the response covers the core requirements and avoids deviating from the topic. Next, the correlation between features and target intent is calculated by combining the weights of each feature and semantic similarity. Strongly correlated features are selected based on the correlation threshold and converted into natural language descriptions to form personalized auxiliary prompt words, ensuring that personalized information is accurately adapted to the target intent. Finally, the target prompt word templates and personalized auxiliary prompt words are combined in sequence, and the sentences are optimized to generate intent prompt words. This clarifies the core content requirements and constrains the personalized adaptation direction, providing clear and accurate response guidance for the large language model.

[0068] As can be seen from the above, this embodiment, by using a preset prompt word template, gives the intent prompt words a fixed constraint framework, improving the completeness of the content of the large language model's response and preventing the response from deviating from the topic; it filters personalized information based on feature weights and relevance, eliminates weakly relevant features, improves the targeting of personalized auxiliary prompt words, and avoids interference from irrelevant preferences; the intent prompt words generated by the combination of template and personalized prompt words take into account both core needs and personalized preferences, so that the response not only meets the content requirements but also fits the user's style, and the accuracy of personalized adaptation is enhanced.

[0069] In one embodiment of this application, after generating the response information, the method further includes: The response information is validated for compliance based on preset validation rules. The verification rules include: whether it contains the content required by the target prompt word template, and whether it reflects the style and attribute requirements of the personalized auxiliary prompt words; If the verification fails, an optimization instruction is generated based on the unmet verification rule item; The optimized command is combined with the intent prompt to obtain the enhanced prompt, which is used to update the response information.

[0070] In this embodiment, the preset verification rule is a binary rule used to verify the compliance of the response information, specifically: Content integrity verification: Verify whether the response contains the core content required by the target prompt template. By comparing the semantic similarity between the response and the core content of the template (threshold set to 0.8), and combining keyword retrieval, confirm whether the core content is covered. Example: If the template requires "include specific steps for computer assembly", then search whether the response contains core step keywords such as "CPU installation" and "motherboard fixing".

[0071] Personalized Adaptation Validation: Validate whether the response reflects the style and attribute requirements in the personalized auxiliary prompts. This is done by searching for keywords corresponding to the style / attribute in the response (such as Northeastern dialect keywords "laotie", "dui", "qihuo"), and combining this with semantic similarity (threshold set to 0.7) to determine whether it meets the requirements.

[0072] In this embodiment, compliance verification is an automatic verification process executed after the response information is generated. This embodiment can use a semantic matching algorithm (BERT semantic vector comparison) combined with keyword retrieval to achieve this, and the verification time is controlled within 50ms. The verification result is divided into pass and fail. When it fails, the specific rule item that was not met is marked, for example: "The content integrity requirement is not met (the graphics card installation steps of the computer are missing); the personalization adaptation requirement is not met (the expression of Northeastern dialect is not used)".

[0073] In this embodiment, the optimization instruction is a targeted natural language optimization instruction generated for unmet rule items. The instruction content clearly states the specific content that needs to be supplemented or adjusted, and the format is uniformly "Optimization requirement: XXX", for example: "Optimization requirement: Please supplement the computer's graphics card installation steps. The reply should be expressed in Northeastern dialect and kept concise and without redundancy". The optimization instruction accurately corresponds to the unmet item and avoids vague expression.

[0074] Enhanced prompts are obtained by merging optimization commands with original intent prompts. In this embodiment, the merging can be done in the order of "original intent prompt + optimization command". After merging, the sentences are integrated, duplicate content is deleted, and information is ensured to be complete and fluent. Example: "Core requirement: Answer the computer assembly steps; the reply must include specific steps, be logically clear, and have no redundant information. Style requirements: use Northeastern dialect and concise expression; attribute adaptation: fit the language habits of users in Shenyang, Liaoning. Optimization requirements: please supplement the computer assembly graphics card installation steps, the reply must be expressed in Northeastern dialect, and be concise and without redundancy." After merging, the prompts are checked with a grammar checker to ensure there are no grammatical errors.

[0075] In this embodiment, the enhanced prompt words are input into the large language model, and the original generation parameter configuration is used. The model regenerates the response based on the enhanced prompt words. The updated response needs to be verified for compliance again until the verification passes. The number of retries shall not exceed 3. If the verification fails multiple times, the user is prompted to adjust the expression of the request.

[0076] In this embodiment, after generating the response information, the response is automatically checked for content completeness and personalization adaptability based on two preset verification rules to determine whether the response meets the requirements of the target prompt word template and personalized auxiliary prompt words. If the verification passes, the response information is directly output. If the verification fails, a clear optimization instruction is generated for the unmet rule items, informing the large language model of the specific content that needs to be adjusted. Then, the optimization instruction is merged with the original intent prompt word to generate an enhanced prompt word, strengthening the response constraint requirements and making up for the lack of guidance of the original prompt word. Finally, the enhanced prompt word is input into the large language model to regenerate the response, and the verification process is repeated until the response passes the verification, realizing automatic optimization and iteration of the response information without manual intervention from the user.

[0077] As can be seen from the above, this embodiment effectively filters out non-compliant responses through the compliance verification process, thereby improving the compliance rate of responses and avoiding responses that deviate from requirements, omit core content, or lack personalization. Targeted optimization of instructions and enhanced prompts allows the large language model to accurately locate and adjust the direction, enabling response updates to be completed without manual user feedback, reducing the number of repeated interactions and improving interaction efficiency. Multiple verification iterations ensure that the final response meets the requirements, improving the user experience.

[0078] In one embodiment of this application, the method further includes: Acquire user feedback behavior on reply information and determine the corresponding sentiment tendency of the feedback behavior; Determine the target style features and / or target attribute features invoked in the intent cue words used when generating response information; Based on sentiment bias, the weights of target style features and / or target attribute features in the corresponding feature set are dynamically adjusted; Specifically, if the sentiment is positive, the weights of the target style features and / or target attribute features are increased; if the sentiment is negative, the weights of the target style features and / or target attribute features are decreased.

[0079] In this embodiment, feedback behavior refers to the user's evaluation of the generated response information. Feedback can be provided through an interactive interface. Feedback behaviors include click-based feedback (two buttons, "Satisfied" and "Dissatisfied," located on the right below the response information) and text-based feedback (users can enter evaluation text, limited to 500 characters). The system collects feedback behaviors in real time, associates them with the corresponding response information, user ID, and target features, and stores them in the feedback log database for 90 days.

[0080] Sentiment orientation is an emotional attitude determined based on user feedback behavior. It can be determined using a sentiment analysis model, and sentiment orientation is divided into only two categories: positive and negative. Clicking the "Satisfied" button is directly determined as positive, and clicking the "Dissatisfied" button is directly determined as negative. Text-based feedback is analyzed by the model, and the probability of sentiment orientation is output. If the probability is ≥0.7, it is determined as the corresponding sentiment orientation. If the probability is <0.7, a pop-up window prompts the user to click to provide additional feedback.

[0081] The target style feature is the style requirement feature in the corresponding personalized auxiliary prompts used when generating the reply; the target attribute feature is the attribute adaptation feature in the corresponding personalized auxiliary prompts used when generating the reply. The target style feature and target attribute feature can be extracted from the intent prompts on which the reply is based, that is, the style feature and attribute feature corresponding to the personalized auxiliary prompts. For example, if the personalized auxiliary prompts in the intent prompts are "Style requirement: use Northeastern dialect, concise expression; Attribute adaptation: fit the language habits of users in Shenyang, Liaoning", then the target style feature is "Northeastern dialect" and "concise expression", and the target attribute feature is "Shenyang, Liaoning". The extraction process is achieved through keyword matching, accurately associating the features used when generating the reply.

[0082] In this embodiment, dynamic adjustment is an operation that adjusts the weights of target style features / target attribute features in real time based on the sentiment tendencies of user feedback. Positive feedback increases the weights, and negative feedback decreases the weights, ensuring that the weights align with the user's true preferences; specifically: Adjustment range: A fixed adjustment range can be preset. When the sentiment is positive, the target feature weight is increased by 0.1-0.2, with a single increase not exceeding 0.2, and the adjusted weight not exceeding 1.0. When the sentiment is negative, the target feature weight is decreased by 0.1-0.2, with a single decrease not less than 0.0, and the adjusted weight not less than 0.0. The adjustment range varies depending on the feedback intensity. When the text feedback is clear and strong approval / disapproval, the adjustment range is 0.2, and when the approval / disapproval is slight, the adjustment range is 0.1.

[0083] Adjustment timing: After a user submits feedback and their sentiment is determined, the corresponding target feature weights are automatically adjusted immediately. After adjustment, the feature weights in the user feature database are updated, and the adjustment time, original weights, new weights, and feedback basis are recorded simultaneously to facilitate the tracking of the adjustment process.

[0084] Adjustment scope: Only the weights of the target features called when generating the response are adjusted, while the weights of non-target features remain unchanged to avoid irrelevant feature weights being adjusted incorrectly; if the feedback targets multiple features, the weights of each target feature are adjusted accordingly.

[0085] In this embodiment, user feedback behavior to the reply is obtained through the interactive interface. A sentiment analysis model is used to determine the sentiment tendency (positive / negative) of the feedback, clarifying the user's evaluation of the current personalized adaptation effect. Next, the target style features and / or target attribute features called by the intent prompt words when generating the reply are located, and the feature range that needs to be adjusted in weight is locked. Finally, the weights of the target features are dynamically adjusted according to the sentiment tendency. Positive feedback increases the weight to strengthen the subsequent impact of the feature, while negative feedback decreases the weight to weaken the subsequent impact of the feature. The adjusted weights are synchronously updated to the user feature library and used in subsequent interactions for feature correlation calculation, variable prompt word filtering, etc., so that the system gradually conforms to the user's real preferences and achieves self-optimization of personalized adaptation capabilities.

[0086] As can be seen from the above, this embodiment dynamically adjusts feature weights through user feedback, enabling the system to have self-iterative optimization capabilities and avoiding the rigidity of personalized adaptation caused by fixed weights; positive feedback strengthens preferred features, while negative feedback weakens unpopular features, and after multiple rounds of interaction, the style fit score continues to improve; the weight adjustment process is traceable, which facilitates system optimization analysis and further improves the accuracy of personalized adaptation; at the same time, weight optimization can be completed without manual intervention, reducing system maintenance costs and improving the system's adaptability.

[0087] In one embodiment of this application, an optimization instruction is generated based on unmet verification rule items, including: When the unmet validation rule item is "does not contain the content required by the target prompt word template", the structure of the target prompt word template is analyzed, at least one missing content element is extracted, and a first type of optimization sub-instruction is generated. The first type of optimization sub-instruction is used to instruct the missing content element to be added in the response. When the unmet validation rule is "the style and attribute requirements in the personalized auxiliary prompts are not reflected", at least one unmet target personalization requirement is parsed from the personalized auxiliary prompts. Based on the target personalization requirements, retrieve and obtain the target feature items and their descriptions corresponding to the target personalization requirements from the style feature set and / or attribute feature set; Based on the target feature terms and their descriptions, a second type of optimization sub-instruction is generated. The second type of optimization sub-instruction is used to indicate at least one of the following in the response text: language style, level of detail, professional depth, or wording preference, in order to match the target feature terms. The first type of optimized sub-instructions and / or the second type of optimized sub-instructions are combined and structured to generate optimized instructions.

[0088] In this embodiment, the target prompt template structure analysis can be performed by adopting a structured format of "core requirements + content requirements" for the target prompt template. The content requirements include several core content elements. For example, if the target prompt template is "Core requirement: Answer computer assembly steps; the reply must include specific steps, a tool list, and precautions," its structure is divided into a core requirement module and a content requirement module, with the content elements being specific steps, a tool list, and precautions. The structure analysis is achieved through regular expression matching to accurately identify the content requirement module in the template and extract the corresponding list of content elements.

[0089] Missing content elements can be extracted using a combination of keyword retrieval and semantic similarity comparison. The response information is matched one by one with the list of content elements in the target prompt template, with a semantic similarity threshold of 0.8. Content elements with a similarity below this threshold are considered missing. For example, if the response only contains installation steps but does not mention a tool list or precautions, then "tool list" and "precautions" are extracted as missing content elements.

[0090] The first type of optimized sub-instruction generation: The sub-instruction adopts a fixed format "Please supplement the missing content elements in the reply: XXX", where XXX is the extracted missing content element, and multiple elements are separated by commas. For example, when the missing elements are tool list and precautions, the first type of optimized sub-instruction is "Please supplement the missing content elements in the reply: tool list, precautions".

[0091] Personalized Requirement Analysis: Personalized auxiliary prompts adopt the format of "style requirement + attribute adaptation." The analysis process is achieved through keyword segmentation, breaking down the prompts into several independent personalized requirement items. For example, if the personalized auxiliary prompts are "style requirement: use Northeastern dialect, concise expression; attribute adaptation: conform to the language habits of Liaoning users," the analyzed personalized requirements are "use Northeastern dialect," "concise expression," and "conform to the language habits of Liaoning users." Each requirement item is semantically compared with the response information, and items with a semantic similarity of less than 0.7 are determined to be unmet personalized requirements.

[0092] Target Feature Item and Description Retrieval: A mapping table is pre-established between style feature sets, attribute feature sets, and personalization requirements. The table stores the personalization requirement description corresponding to each feature item. Based on unmet target personalization requirements, the corresponding feature item and its description are retrieved from the mapping table. For example, if the unmet requirement is "using Northeastern dialect," then the corresponding target feature item retrieved from the style feature set is "Northeastern dialect," and the feature description is "using Northeastern dialect words such as 'laotie,' 'qihuo,' and 'dui,' with a friendly and down-to-earth tone."

[0093] The second type of optimization sub-instruction generation: Based on the type of the target feature, targeted adjustment instructions are generated. The instructions must clearly specify the direction of adjustment, including at least one of the following: language style, level of detail, professional depth, or word choice preference. For example, when the target feature is "Northeastern dialect," the sub-instruction would be "Please adjust the language style of your reply, using Northeastern dialect words such as 'laotie' and 'qihuo,' and making the tone more friendly and down-to-earth." When the target feature is "concise expression," the sub-instruction would be "Please adjust the level of detail in your reply, removing redundant expressions and retaining core information."

[0094] Optimization Instruction Combination and Structure: When only one type of rule item is not met, the corresponding sub-instruction is directly used as the optimization instruction; when both types of rule items exist, the first and second types of optimization sub-instructions are arranged in sequence, using a unified prefix "Optimization Requirements:" to form a structured optimization instruction. The structured format is "Optimization Requirements: 1.XXX; 2.XXX", where 1 corresponds to the first type of optimization sub-instruction and 2 corresponds to the second type of optimization sub-instruction. For example, the combined optimization instruction is "Optimization Requirements: 1. Please supplement the missing content elements in the reply: tool list, precautions; 2. Please adjust the language style of the reply, using Northeastern dialect words such as 'laotie' and 'qihuo' to make the tone friendly and down-to-earth."

[0095] In this embodiment, when the response lacks the content required by the target prompt template, a first type of sub-instruction with clear supplementary content is generated by analyzing the template structure and extracting the missing elements. When the response does not meet the personalized requirements, a second type of sub-instruction with clear adjustment direction is generated by parsing the prompt words and retrieving the corresponding feature descriptions. Finally, the two types of sub-instructions are combined into a structured optimization instruction, clearly conveying the adjustment requirements. The entire process realizes the transformation of optimization instructions from "general and vague" to "precise and specific," providing clear optimization guidance for large language models.

[0096] As can be seen from the above, this embodiment generates targeted optimization sub-instructions for different scenarios, enabling the large language model to accurately locate problems in the response, clarify the direction of adjustment, and improve the compliance rate of the optimized response; the structured optimization instruction format is uniform and the logic is clear, reducing the understanding cost of the large language model and greatly improving the optimization efficiency; at the same time, the optimization instruction is directly associated with the description of the target feature item, ensuring that the adjusted response can accurately match personalized requirements.

[0097] Corresponding to the intelligent question-answering method in the above embodiments, Figure 2 This is a structural block diagram of an intelligent question-answering device provided according to an embodiment of this application. For ease of explanation, only the parts relevant to the embodiment of this application are shown. References Figure 2 The intelligent question-answering device 20 includes: a feature set acquisition module 21, a vector acquisition module 22, an intent candidate module 23, a matching calculation module 24, a prompt word determination module 25, and an information reply module 26.

[0098] Among them, the feature set acquisition module 21 is used to extract features from the user's custom style description text to obtain the user's style feature set. The custom style description represents the user's preferred interaction style in the intelligent question answering process. Based on the user's attribute information, the user's attribute feature set is obtained. The attribute information includes at least one of age, gender, region and occupation. The vector acquisition module 22 is used to vectorize the historical dialogue sequence in the current multi-turn dialogue, representing each round of dialogue text in the historical dialogue sequence to obtain multiple dialogue text vectors; and to perform temporal encoding and information aggregation on the multiple dialogue text vectors to obtain a context encoding vector representing the overall semantics and state of the multi-turn dialogue. The intent candidate module 23 is used to obtain the user's candidate intent set and the confidence level of each candidate intent based on the text information currently input by the user and through a preset intent recognition model; the preset intent recognition model is a model trained in advance through a labeled dataset, which contains multiple types of intents; The matching calculation module 24 is used to fuse style feature set, attribute feature set, context encoding vector and confidence of each candidate intent to determine the target matching degree of each candidate intent; The prompt word determination module 25 is used to determine the user's target intent based on the target matching degree of each candidate intent, and to determine the intent prompt word based on the target intent; The information response module 26 is used to generate response information based on intent prompt words and through a large language model. The response information is text-based.

[0099] In one embodiment of this application, the matching calculation module 24 is specifically used for: The first formula is used to calculate the first degree of correlation between each candidate intent and the user's style feature set and attribute feature set, respectively. The second formula is used to calculate the second correlation degree between the current encoding vector and the context encoding vector corresponding to the current user input text information. The third formula is used to fuse the first relevance, the second relevance, and the confidence of each candidate intent to obtain the target matching degree of each candidate intent. The first formula is: ; ; in, This represents the first correlation between the i-th candidate intent and the style feature set. This represents the first degree of correlation between the i-th candidate intent and the attribute feature set. Let represent the semantic similarity between the i-th candidate intent and feature s in the style feature set. Let represent the semantic similarity between the i-th candidate intent and feature p in the attribute feature set. This represents the weight of feature s in the style feature set. This represents the weight corresponding to feature p in the attribute feature set; The second formula is: ; in, Indicates the second degree of relevance. This represents the Sigmoid activation function. This represents the weight matrix of the fully connected layer. Indicates the current encoded vector. Represents the context encoding vector. This indicates a splicing operation. Indicates the bias term of the fully connected layer; The third formula is: ; in, This represents the target matching degree of the i-th candidate intent. This represents the confidence level of the i-th candidate intent.

[0100] In one embodiment of this application, the intent prompt includes core prompts and auxiliary prompts; The information reply module 26 is specifically used for: The complexity of the target intent is determined by the number of core and auxiliary cue words; The target splicing pattern is determined based on complexity, and the corresponding prompt word elements are selected based on the target splicing pattern; The intent cue words and cue word elements are concatenated to obtain the target intent cue words, and then a response message is generated through a large language model. The prompt elements include fixed prompts, variable prompts, target context information, and the text information currently entered by the user; Both the style feature set and the attribute feature set contain weights for their features; The methods for determining variable prompts include: A personalized prompt word set is generated based on the style feature set, and the prompt words in the personalized prompt word set correspond one-to-one with the features in the style feature set; Select personalized prompt words whose weights in the style feature set and attribute feature set are greater than the preset weights as variable prompt words; The methods for determining target context information include: Feature extraction is performed on the context encoding vector to select target context encoding vectors whose semantic relevance to the current input text information is greater than a preset relevance threshold. The target context encoding vectors are then standardized to obtain the target context information.

[0101] In one embodiment of this application, the target stitching pattern includes a first stitching pattern or a second stitching pattern; The information reply module 26 is also specifically used for: Based on the response accuracy of the first and second splicing modes in the test scenario, the intent complexity threshold is determined. If the complexity is less than or equal to the complexity threshold, the first concatenation pattern is taken as the target concatenation pattern, and the intent prompt, fixed quantity prompt, and variable prompt are concatenated to obtain the target intent prompt. If the complexity exceeds the complexity threshold, the second concatenation mode is used as the target concatenation mode, and the intent prompt, fixed quantity prompt, variable prompt, target context information and the text information currently input by the user are concatenated to obtain the target intent prompt. The number of prompt words corresponding to the first splicing pattern is less than the number of prompt words corresponding to the second splicing pattern.

[0102] In one embodiment of this application, the prompt word determination module 25 is specifically used for: Based on the target intent, the corresponding target prompt word template is determined from the preset prompt word template library. The target prompt word template is used to constrain the content contained in the response information. Based on the weights of each style feature in the style feature set, the correlation between each style feature and the target intent is calculated. Also, based on the weights of each attribute feature in the attribute feature set, the correlation between each attribute feature and the target intent is calculated. Based on the relevance, features with a relevance greater than the threshold are selected from the style feature set and attribute feature set respectively, and these features are converted into natural language descriptions to form personalized auxiliary prompt words; Combine target cue templates with personalized auxiliary cue words to generate intent cue words.

[0103] In one embodiment of this application, the intelligent question-answering device 20 further includes: an enhancement module; specifically used for: The response information is validated for compliance based on preset validation rules. The verification rules include: whether it contains the content required by the target prompt word template, and whether it reflects the style and attribute requirements of the personalized auxiliary prompt words; If the verification fails, an optimization instruction is generated based on the unmet verification rule item; The optimized command is combined with the intent prompt to obtain the enhanced prompt, which is used to update the response information.

[0104] In one embodiment of this application, the intelligent question-answering device 20 further includes: a weight adjustment module; specifically used for: Acquire user feedback behavior on reply information and determine the corresponding sentiment tendency of the feedback behavior; Determine the target style features and / or target attribute features invoked in the intent cue words used when generating response information; Based on sentiment bias, the weights of target style features and / or target attribute features in the corresponding feature set are dynamically adjusted; Specifically, if the sentiment is positive, the weights of the target style features and / or target attribute features are increased; if the sentiment is negative, the weights of the target style features and / or target attribute features are decreased.

[0105] See Figure 3 , Figure 3 This is a schematic block diagram of an electronic device provided according to an embodiment of this application. Figure 3 The electronic device 300 in this embodiment may include one or more processors 301, one or more input devices 302, one or more output devices 303, and one or more memories 304. The processors 301, input devices 302, output devices 303, and memories 304 communicate with each other via a communication bus 305. The memories 304 store computer programs, including program instructions. The processors 301 execute the program instructions stored in the memories 304. Specifically, the processors 301 are configured to invoke the program instructions to perform the functions of the modules in the aforementioned device embodiments, for example... Figure 2 The functions of the feature set acquisition module 21, vector acquisition module 22, intent candidate module 23, matching calculation module 24, prompt word determination module 25, and information response module 26 are shown.

[0106] It should be understood that, in the embodiments of this application, the processor 301 may be a central processing unit (CPU), or it may 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, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0107] Input device 302 may include a touchpad, a fingerprint sensor (for collecting the user's fingerprint information and fingerprint orientation information), a microphone, etc., and output device 303 may include a display (LCD, etc.), a speaker, etc.

[0108] The memory 304 may include read-only memory and random access memory, and provides instructions and data to the processor 301. A portion of the memory 304 may also include non-volatile random access memory. For example, the memory 304 may also store information such as style feature sets and attribute feature sets.

[0109] In specific implementations, the processor 301, input device 302, and output device 303 described in the embodiments of this application can execute the implementation method described in the intelligent question-answering method provided in the embodiments of this application, or they can execute the implementation method of the electronic device described in the embodiments of this application, which will not be repeated here.

[0110] In another embodiment of this application, a computer-readable storage medium is provided. This computer-readable storage medium stores a computer program, which includes program instructions. When executed by a processor, the program instructions implement all or part of the processes in the methods described above. Alternatively, the computer program can instruct related hardware to complete the process. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include any entity or device capable of carrying computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0111] The computer-readable storage medium can be an internal storage unit of the electronic device in any of the foregoing embodiments, such as a hard disk or memory of the electronic device. The computer-readable storage medium can also be an external storage device of the electronic device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the electronic device. Furthermore, the computer-readable storage medium can include both internal and external storage units of the electronic device. The computer-readable storage medium is used to store computer programs and other programs and data required by the electronic device. The computer-readable storage medium can also be used to temporarily store data that has been output or will be output.

[0112] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

[0113] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the electronic devices and units described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0114] In the several embodiments provided in this application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces or units, or they may be electrical, mechanical, or other forms of connection.

[0115] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.

[0116] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0117] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. An intelligent question answering method, characterized by, include: Feature extraction is performed on the user's custom style description text to obtain the user's style feature set. The custom style description represents the user's preferred interaction style during the intelligent question answering process. Based on the user's attribute information, the user's attribute feature set is obtained. The attribute information includes at least one of age, gender, region, and occupation. For the historical dialogue sequence in the current multi-turn dialogue, the dialogue text of each turn in the historical dialogue sequence is vectorized to obtain multiple dialogue text vectors; and the multiple dialogue text vectors are temporally encoded and information aggregated to obtain a context encoding vector representing the overall semantics and state of the multi-turn dialogue. Based on the text information currently input by the user, and through a preset intent recognition model, the user's candidate intent set and the confidence level of each candidate intent are obtained; the preset intent recognition model is a model that has been trained in advance through a labeled dataset, which contains multiple types of intents; Based on the style feature set, the attribute feature set, the context encoding vector, and the confidence of each candidate intent, the target matching degree of each candidate intent is determined; The user's target intent is determined based on the target matching degree of each candidate intent, and intent prompt words are determined based on the target intent; Based on the intent prompt words, and through a large language model, a response message is generated, which is a response message to the text information; The step of determining the target matching degree of each candidate intent based on the style feature set, the attribute feature set, the context encoding vector, and the confidence of each candidate intent includes: The first formula is used to calculate the first degree of correlation between each candidate intent and the user's style feature set and attribute feature set, respectively. The second formula is used to calculate the second correlation degree between the current encoding vector corresponding to the current user input text information and the context encoding vector. The first correlation, the second correlation, and the confidence of each candidate intent are fused using the third formula to obtain the target matching degree of each candidate intent.

2. The intelligent question-answering method as described in claim 1, characterized in that, The first formula is: ; ; Among them, the This represents the first correlation between the i-th candidate intent and the style feature set. This represents the first degree of correlation between the i-th candidate intent and the attribute feature set. Let represent the semantic similarity between the i-th candidate intent and feature s in the style feature set. Let represent the semantic similarity between the i-th candidate intent and feature p in the attribute feature set. This represents the weight of feature s in the style feature set. This represents the weight corresponding to feature p in the attribute feature set; The second formula is: ; in, Indicates the second degree of relevance. This represents the Sigmoid activation function. This represents the weight matrix of the fully connected layer. Indicates the current encoded vector. Represents the context encoding vector. This indicates a splicing operation. Indicates the bias term of the fully connected layer; The third formula is: ; in, This represents the target matching degree of the i-th candidate intent. This represents the confidence level of the i-th candidate intent.

3. The intelligent question-answering method as described in claim 1, characterized in that, The intent prompts include core prompts and auxiliary prompts; The process of generating response information based on the intent prompt words and using a large language model includes: The complexity of the target intent is determined based on the number of the core prompt words and the auxiliary prompt words; The target splicing pattern is determined based on the complexity, and the corresponding prompt word element is selected based on the target splicing pattern; The intent prompt and the prompt element are concatenated to obtain the target intent prompt, and a response message is generated through a large language model; The prompt elements include fixed prompts, variable prompts, target context information, and the text information currently entered by the user; The features in both the style feature set and the attribute feature set include weights; The method for determining the variable prompt words includes: A personalized prompt word set is generated based on the style feature set, and the prompt words in the personalized prompt word set correspond one-to-one with the features in the style feature set; Personalized prompt words with weights greater than preset weights in the style feature set and the attribute feature set are selected as variable prompt words; The methods for determining the target context information include: Feature extraction is performed on the context encoding vector to select target context encoding vectors whose semantic relevance to the currently input text information is greater than a preset relevance threshold, and the target context encoding vectors are standardized to obtain target context information.

4. The intelligent question-answering method as described in claim 3, characterized in that, The target splicing pattern includes a first splicing pattern or a second splicing pattern; The process involves determining a target splicing pattern based on the complexity, selecting appropriate prompting word elements based on this pattern, and splicing them together to obtain target intent prompting words, including: Based on the response accuracy of the first and second splicing modes in the test scenario, the intent complexity threshold is determined. If the complexity is less than or equal to the complexity threshold, then the first splicing pattern is taken as the target splicing pattern, and the intent prompt word, the fixed quantity prompt word and the variable prompt word are spliced ​​together to obtain the target intent prompt word; If the complexity is greater than the complexity threshold, then the second splicing mode is taken as the target splicing mode, and the intent prompt word, the fixed prompt word, the variable prompt word, the target context information and the text information currently input by the user are spliced ​​together to obtain the target intent prompt word; The number of prompt words corresponding to the first splicing pattern is less than the number of prompt words corresponding to the second splicing pattern.

5. The intelligent question-answering method as described in claim 1, characterized in that, The process of determining intent prompts based on the target intent includes: Based on the stated target intent, a corresponding target prompt word template is determined from a preset prompt word template library. The target prompt word template is used to constrain the content contained in the response information. Based on the weights of each style feature in the style feature set, the correlation between each style feature and the target intent is calculated; and based on the weights of each attribute feature in the attribute feature set, the correlation between each attribute feature and the target intent is calculated. Based on the correlation degree, features with a correlation degree greater than the correlation degree threshold are selected from the style feature set and attribute feature set, respectively, and the features with a correlation degree greater than the correlation degree threshold are converted into natural language descriptions to form personalized auxiliary prompt words; The target prompt word template is combined with the personalized auxiliary prompt word to generate the intent prompt word.

6. The intelligent question-answering method as described in claim 5, characterized in that, After generating the response information, the following is also included: The compliance of the response information is verified based on preset verification rules; The verification rules include: whether it contains the content required by the target prompt word template, and whether it reflects the style and attribute requirements of the personalized auxiliary prompt words; If the verification fails, an optimization instruction is generated based on the unmet verification rule item; The optimization command is fused with the intent prompt to obtain an enhanced prompt, which is used to update the response information.

7. The intelligent question-answering method as described in claim 3, characterized in that, Also includes: Obtain user feedback behavior on the reply information and determine the sentiment tendency corresponding to the feedback behavior; Determine the target style features and / or target attribute features invoked in the intent prompts used when generating the response information; Based on the emotional tendency, the weights of the target style features and / or target attribute features in the corresponding feature set are dynamically adjusted; Specifically, if the sentiment tendency is positive, the weights of the target style feature and / or the target attribute feature are increased; if the sentiment tendency is negative, the weights of the target style feature and / or the target attribute feature are decreased.

8. An intelligent question-and-answer device, characterized in that, include: The feature set acquisition module is used to extract features from the user's custom style description text to obtain the user's style feature set. The custom style description represents the user's preferred interaction style during the intelligent question answering process. Based on the user's attribute information, the module obtains the user's attribute feature set. The attribute information includes at least one of age, gender, region, and occupation. The vector acquisition module is used to vectorize the historical dialogue sequence in the current multi-turn dialogue, representing each round of dialogue text in the historical dialogue sequence to obtain multiple dialogue text vectors; and to perform temporal encoding and information aggregation on the multiple dialogue text vectors to obtain a context encoding vector that represents the overall semantics and state of the multi-turn dialogue. The intent candidate module is used to obtain the user's candidate intent set and the confidence level of each candidate intent based on the text information currently input by the user and through a preset intent recognition model; the preset intent recognition model is a model trained in advance through a labeled dataset, which contains multiple types of intents; The matching calculation module is used to fuse the style feature set, the attribute feature set, the context encoding vector and the confidence of each candidate intent to determine the target matching degree of each candidate intent; The prompt word determination module is used to determine the user's target intent based on the target matching degree of each candidate intent, and to determine the intent prompt word based on the target intent; The information response module is used to generate response information based on the intent prompt words and through a large language model. The response information is a response to the text information. The matching calculation module is specifically used for: The first formula is used to calculate the first degree of correlation between each candidate intent and the user's style feature set and attribute feature set, respectively. The second formula is used to calculate the second correlation degree between the current encoding vector corresponding to the current user input text information and the context encoding vector. The first correlation, the second correlation, and the confidence of each candidate intent are fused using the third formula to obtain the target matching degree of each candidate intent.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • A prompt word generation method, device, electronic device and readable storage medium

    CN119761359A

  • Stylized intelligent dialogue method based on retrieval enhancement generation

    CN121029933A