A multi-granularity role-aware personalized question-answer pair dynamic generation method and device

By constructing instantaneous role vectors in a personalized question-and-answer system, the system dynamically perceives user intent, resolves the conflict between immediate user intent and long-term user profile, improves recommendation accuracy and user satisfaction, and enables the dynamic generation and continuous optimization of personalized question-and-answer pairs.

CN121328743BActive Publication Date: 2026-05-12XIAMEN SHIBAO NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
XIAMEN SHIBAO NETWORK TECH CO LTD
Filing Date
2025-12-15
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing personalized question-answering systems often produce inaccurate recommendations when dealing with the conflict between users' immediate intent and long-term profiles, resulting in a poor user experience and an inability to effectively capture users' immediate needs and long-term preferences.

Method used

By acquiring long-term user profile vectors and real-time context vectors, and using a pre-trained projection matrix to project them onto a common role space, the role agility factor is calculated for dynamic weighted fusion to construct an instantaneous role vector. The fit of the question-and-answer pair is evaluated by combining role embedding and content embedding models, triggering a dynamic generation process to generate personalized question-and-answer pairs and updating the long-term profile in real time.

Benefits of technology

实现了对用户即时意图的动态感知,提高了推荐结果的精准度和覆盖率,确保系统能够响应小众或情景化需求,提供持续优化的个性化体验。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121328743B_ABST
    Figure CN121328743B_ABST
Patent Text Reader

Abstract

The application discloses a kind of multi-granularity role perception personalized question-answer pair dynamic generation method and device, it is related to artificial intelligence technical field, including: obtaining user long-term portrait vector and instant context original vector, calculate the role agile factor for quantifying intention deviation degree, construct instantaneous role vector;Obtain candidate question-answer pair;Obtain final adaptation degree score;Pre-set adaptation degree threshold, compare final adaptation degree score with adaptation degree threshold;Collect user interaction feedback signal, long-term portrait vector is closed loop correction.The application constructs instantaneous role by dynamically fusing user long-term portrait and instant context;Double matching is carried out in independent role space and content space, and the evaluation accuracy is improved;When there is no suitable candidate, new question-answer pair can be dynamically generated;And long-term portrait is closed loop correction using user feedback, so that portrait continues to evolve, the precision of personalized recommendation and user experience are significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, specifically to a method and apparatus for dynamically generating personalized question-and-answer pairs with multi-granularity role perception. Background Technology

[0002] Personalized recommendation systems, especially in the question-and-answer field, are an application of artificial intelligence technology that aims to provide relevant information by analyzing user data. The principle typically involves building a long-term user profile using historical behavioral data and combining it with the user's current immediate query or contextual information to retrieve and recommend matching question-and-answer content from a knowledge base, thereby improving the user's information retrieval efficiency.

[0003] To ensure the accuracy of recommendations, the system needs to comprehensively judge both the user's long-term preferences and immediate intentions. However, in practical applications, a user's immediate intentions are influenced by external factors such as the current task and browsing environment, which can easily lead to deviations or conflicts between these intentions and the long-term profile. For example, a user's knowledge level may change temporarily. Current technologies typically involve matching and calculating these profiles and contextual data, and then making recommendations based on the results. However, in reality, the data used for matching contains significant noise and some data that has little impact on the user's current actual needs. If matching and recommendations are made directly based on this data, for example, static long-term profiles cannot reflect changes in immediate intentions; this can easily lead to inaccurate recommendations, such as recommending content that does not match the user's current cognitive granularity or is irrelevant to the context, thus posing a significant risk of poor user experience and low satisfaction. Summary of the Invention

[0004] The purpose of this invention is to provide a method and apparatus for dynamically generating personalized question-and-answer pairs with multi-granularity role perception, which solves the problems existing in the background art.

[0005] To address the aforementioned technical problems, this invention provides a method for dynamically generating personalized question-and-answer pairs with multi-granularity role awareness, the specific steps of which include:

[0006] S1. Obtain the user's long-term profile vector and the original context vector; project the original context vector onto the common role space using a pre-trained projection matrix to obtain the context role vector; calculate the role agility factor to quantify the degree of intent deviation based on the distance between the long-term profile vector and the context role vector; and dynamically weight and fuse the long-term profile vector and the context role vector according to the role agility factor to construct the instantaneous role vector.

[0007] S2. Obtain candidate question-answer pairs; use role embedding model and content embedding model respectively to vectorize the candidate question-answer pairs to obtain question-answer pair role vectors and question-answer pair content vectors; in the common role space, calculate the granularity matching degree between the question-answer pair role vector and the instantaneous role vector; in the content space, calculate the content relevance between the question-answer pair content vector and the instantaneous context original vector; combine the preset granularity weight and content weight to weight the granularity matching degree and content relevance to obtain the final fit score, and sort the final fit scores of all candidate question-answer pairs in descending order;

[0008] S3. Preset fit threshold; compare the final fit score with the fit threshold. When the final fit score is higher than the fit threshold, select the candidate question-answer pair with the highest score for recommendation; when the final fit score is not higher than the fit threshold, trigger the dynamic generation process.

[0009] S4. Collect user interaction feedback signals; and use the interaction feedback signals and instantaneous character vectors to perform closed-loop correction on the long-term profile vector.

[0010] Preferably, in S1, obtaining the user's long-term profile vector and the original vector of the immediate context, and constructing the instantaneous role vector, specifically includes:

[0011] S11. Collect global long-term profile data of users, including users' historical browsing records and historical Q&A interaction data, and construct a long-term profile vector. The long-term profile vector is located in a predefined common role space.

[0012] S12. Collect real-time context data, including the query text currently entered by the user and the content of the currently viewed page, and construct it into a real-time context raw vector through a content encoder. The real-time context raw vector is located in the content space.

[0013] S13. Use the pre-trained projection matrix to perform a linear transformation on the original instantaneous context vector, mapping it from the content space to the common role space to obtain the context role vector.

[0014] Preferably, S1 further includes:

[0015] S14. Calculate the distance between the long-term portrait vector and the context character vector in the common character space, and use the activation function to calculate the character agility factor.

[0016] S15. Using the character agility factor as a dynamic mixing coefficient, linear interpolation is performed on the long-term portrait vector and the context character vector to construct the instantaneous character vector.

[0017] Preferably, S2 includes:

[0018] S21. Based on the original vector of the immediate context, retrieve candidate question-answer pairs from the knowledge base;

[0019] S22. Use a role embedding model to generate question-answer pair role vectors, where the question-answer pair role vectors are located in a common role space;

[0020] S23. Use a content embedding model to generate question-answer pair content vectors, which are located in the content space.

[0021] Preferably, S2 further includes:

[0022] S24. In the shared role space, calculate the distance between the question-answer pair role vector and the instantaneous role vector, and normalize it to obtain the granular matching degree.

[0023] S25. In the content space, the cosine similarity function is used to calculate the relevance between the question-answer pair content vector and the original vector of the immediate context to obtain the content relevance.

[0024] S26. The granularity matching degree and content relevance are weighted and summed to obtain the final fit score.

[0025] Preferably, the dynamic generation process includes:

[0026] S31. When the trigger signal of the dynamic generation process is received, the instantaneous character vector and the original vector of the immediate context are subjected to affine transformation, projected and merged into the generator condition space to construct the generation control vector.

[0027] S32. Input the generated control vector and the instant context text corresponding to the instant context original vector into the pre-trained generative model.

[0028] S33. The generative model generates dynamically generated question-and-answer pairs under the constraints of the generation control vector.

[0029] Preferably, S4 includes:

[0030] S41. Monitor users' interaction behavior with candidate question-and-answer pairs or dynamically generated question-and-answer pairs in real time and quantify it as interaction feedback signals;

[0031] S42. In the shared role space, based on the preset long-term portrait learning rate, the long-term portrait vector of the previous moment is updated online using the interactive feedback signal and the instantaneous role vector to obtain the updated long-term portrait vector.

[0032] A multi-granularity role-aware personalized question-and-answer pair dynamic generation device is also provided, including:

[0033] The instantaneous role construction unit is used to obtain the user's long-term profile vector and the instantaneous context original vector. It uses a pre-trained projection matrix to project the instantaneous context original vector onto the common role space to obtain the context role vector. It calculates the role agility factor based on the distance between the long-term profile vector and the context role vector, and dynamically weights and fuses the long-term profile vector and the context role vector according to the role agility factor to construct the instantaneous role vector.

[0034] The fit evaluation unit is used to obtain candidate question-answer pairs. It uses role embedding model and content embedding model to vectorize the candidate question-answer pairs to obtain question-answer pair role vector and question-answer pair content vector. In the common role space, it calculates the granular matching degree between the question-answer pair role vector and the instantaneous role vector. In the content space, it calculates the content relevance between the question-answer pair content vector and the instantaneous context original vector. It combines preset granularity weight and content weight to weight the granular matching degree and content relevance to obtain the final fit score.

[0035] The question-answering decision unit is used to preset the fit threshold, compare the final fit score with the fit threshold, and when the final fit score is higher than the fit threshold, select the candidate question-answer pair with the highest score for recommendation. When the final fit score is not higher than the fit threshold, trigger the dynamic generation process.

[0036] The profile correction unit is used to collect user interaction feedback signals and use the interaction feedback signals and instantaneous character vectors to perform closed-loop correction on long-term profile vectors.

[0037] Preferably, the question-and-answer decision unit triggers a dynamic generation process, including:

[0038] The generation control vector construction module is used to perform affine transformation on the instantaneous character vector and the original vector of the immediate context when a trigger signal of the dynamic generation process is received, project and merge them into the generator condition space to construct the generation control vector.

[0039] The question-answer pair generation module is used to input the generation control vector and the immediate context text into the pre-trained generative model, so that the generative model can generate dynamically generated question-answer pairs under the constraints of the generation control vector.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] It can dynamically perceive the user's instantaneous intent, resolving potential conflicts between long-term user profiles and immediate contextual intents. By introducing a dynamic arbitration mechanism, it can assess the degree of deviation between the user's long-term profile vector and the current contextual role vector in real time, and generate a dynamic role agility factor accordingly. This factor is used to dynamically weight and fuse the long-term profile and the immediate context to construct an instantaneous role vector, enabling the system to both respect the user's long-term habits and keenly capture their immediate needs.

[0042] When evaluating the suitability of question-answer pairs, a multi-dimensional, space-specific matching strategy was adopted to ensure the logical rigor and mathematical validity of the comparison. The matching process was decomposed into two independent and dimensionally consistent calculations: first, in the common role space, the matching degree between the role granularity of the candidate question-answer pair and the instantaneous role vector of the user was accurately calculated; second, in the content space, the content relevance between the semantic content of the question-answer pair and the content relevance of the user's instantaneous context vector was calculated. This dual evaluation mechanism avoids the defects of invalid comparisons between heterogeneous spaces with different semantics and dimensions. By independently evaluating the role granularity and content relevance and then weighting them, the accuracy of the recommendation results was greatly improved.

[0043] By combining retrieval and generative modes, the system's coverage and user satisfaction are significantly improved. When the candidate question-answer pairs in the existing knowledge base cannot meet the user's specific suitability requirements, the system no longer simply returns an empty result. Instead, it is designed to seamlessly trigger a dynamic generation process. It can use the user's instantaneous role vector and immediate context vector as control signals to guide the pre-trained generative model to dynamically and instantly create a brand-new personalized question-answer pair that meets both role granularity and content relevance requirements. This ensures that even if the user's needs are very niche or highly contextualized, the system can still provide an effective response.

[0044] A closed-loop, online-correction profile evolution mechanism has been constructed, which can collect user interaction feedback signals to recommended or generated question-and-answer pairs in real time, whether it is a positive click or a negative ignore. By using these immediate feedback signals and combining them with the instantaneous role vector of the user at the time of the feedback, the system can update the user's long-term profile vector online. This ensures that the long-term profile is no longer static, but can continuously learn and evolve, making it increasingly accurate in reflecting the user's true preferences and knowledge level over time, thereby providing a continuously optimized personalized experience in subsequent interactions. Attached Figure Description

[0045] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, 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 the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0046] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0047] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0048] Example 1:

[0049] Please see Figure 1 This invention provides a method and apparatus for dynamically generating personalized question-and-answer pairs with multi-granularity role perception, the specific steps of which include:

[0050] S1. Obtain the user's long-term profile vector and the original context vector; project the original context vector onto the common role space using a pre-trained projection matrix to obtain the context role vector; calculate the role agility factor to quantify the degree of intent deviation based on the distance between the long-term profile vector and the context role vector; and dynamically weight and fuse the long-term profile vector and the context role vector according to the role agility factor to construct the instantaneous role vector.

[0051] S2. Obtain candidate question-answer pairs; use role embedding model and content embedding model respectively to vectorize the candidate question-answer pairs to obtain question-answer pair role vectors and question-answer pair content vectors; in the common role space, calculate the granularity matching degree between the question-answer pair role vector and the instantaneous role vector; in the content space, calculate the content relevance between the question-answer pair content vector and the instantaneous context original vector; combine the preset granularity weight and content weight to weight the granularity matching degree and content relevance to obtain the final fit score, and sort the final fit scores of all candidate question-answer pairs in descending order;

[0052] S3. Preset fit threshold; compare the final fit score with the fit threshold. When the final fit score is higher than the fit threshold, select the candidate question-answer pair with the highest score for recommendation; when the final fit score is not higher than the fit threshold, trigger the dynamic generation process.

[0053] S4. Collect user interaction feedback signals; and use the interaction feedback signals and instantaneous character vectors to perform closed-loop correction on the long-term profile vector.

[0054] In step S1, the instantaneous role vector construction, the system obtains a long-term profile vector representing the user's long-term habits and an instantaneous contextual vector representing the current intent. Since the two have different sources and dimensions, the system uses a pre-trained projection matrix to project the instantaneous contextual vector onto a common role space, unifying its dimension with that of the long-term profile vector, thus obtaining a contextual role vector. The system calculates the distance between these two vectors in the common role space and uses this distance as input to calculate a role agility factor used to quantify the degree of intent deviation. This factor, as a dynamic weight, is used to dynamically weight and fuse the long-term profile vector and the contextual role vector, i.e., linear interpolation, ultimately constructing an instantaneous role vector that includes both long-term habits and current intent.

[0055] In the S2 and Q&A fit assessment steps, the system obtains candidate question-answer pairs from the knowledge base. To achieve accurate matching, the system performs dual vectorization on each candidate question-answer pair, resulting in a question-answer pair role vector representing its applicable role granularity in the common role space and a question-answer pair content vector representing its semantic content in the content space. In the common role space, the system calculates the granularity matching degree between the question-answer pair role vector and the instantaneous role vector constructed in S1. Simultaneously, in the content space, the system calculates the content relevance between the question-answer pair content vector and the original vector of the immediate context. The system combines preset granularity weights and content weights to perform a weighted sum of these two independently calculated scores to obtain the final fit score, and sorts the final fit scores of all candidate questions and answers in descending order.

[0056] In the S3 and Q&A dynamic filtering and triggering steps, the system presets an adaptation threshold; the system compares the highest final adaptation score calculated in S2 with this threshold; when the score is higher than the threshold, it means that a question-and-answer pair that both fits the current role and matches the context content has been found, and the system selects the candidate question-and-answer pair with the highest score for recommendation; when the score is not higher than, i.e. less than or equal to, the threshold, it means that the existing knowledge base cannot meet the user's personalized needs, and the system triggers the dynamic generation process;

[0057] In the S4 long-term profile closed-loop correction step, regardless of whether the system recommends the Q&A selected in S2 or the Q&A generated in S3, the system will collect user interaction feedback signals such as clicks and ignores; the system uses this real-time feedback signal and the instantaneous role vector constructed in S1 to perform closed-loop correction and online update of the user's long-term profile vector.

[0058] S1 involves obtaining the user's long-term profile vector and the original vector of the immediate context, and constructing the instantaneous role vector. Specifically, this includes:

[0059] S11. Collect global long-term profile data of users, including users' historical browsing records and historical Q&A interaction data, and construct a long-term profile vector. The long-term profile vector is located in a predefined common role space.

[0060] S12. Collect real-time context data, including the query text currently entered by the user and the content of the currently viewed page, and construct it into a real-time context raw vector through a content encoder. The real-time context raw vector is located in the content space.

[0061] S13. Use the pre-trained projection matrix to perform a linear transformation on the original instantaneous context vector, mapping it from the content space to the common role space to obtain the context role vector.

[0062] This embodiment provides specific limitations on the vector acquisition and projection steps of S1;

[0063] S11. Collect global long-term user profile data, including users' historical browsing records and historical Q&A interaction data, and construct a long-term profile vector. ;

[0064] Long-term image vector This refers to a vector used to describe a user's long-term, stable interests and knowledge level; its function is to serve as a benchmark for the user's static role; in this embodiment, it resides in a predefined shared role space. Middle; Shared Role Space This refers to a dimension. A unified vector space, where all vectors related to roles or granularity are such as and All definitions and comparisons are made within this space; It can be obtained by long-term modeling of user historical behavior data, such as browsing history and historical Q&A, for example, by training an RNN or Transformer model.

[0065] S12. Collect real-time context data, including the query text currently entered by the user and the content of the currently viewed page, and construct it into a real-time context raw vector through a content encoder. ;

[0066] Instantaneous Context Original Vector This refers to a vector used to describe the text content or real-time query that a user is currently viewing; its function is to capture the user's current, dynamic intent; in this embodiment, it resides in the content space. Chinese; Content Space This refers to the semantic vector space naturally output by content encoders such as BERT and Word2Vec, whose dimension is... ; It is obtained directly by inputting real-time context data, such as the current webpage paragraph T, into the content encoder;

[0067] S13, Using pre-trained projection matrices For the immediate context original vector Perform a linear transformation from the content space Mapping to a shared role space , obtain the context role vector ;

[0068] The technical motivation for this step is that... lie in space Wei, and lie in space Dimension, the dimensions of both and They are usually unequal and have different physical meanings, making direct comparison impossible; therefore, it is necessary to... Projected to space;

[0069] The calculation method is as follows:

[0070]

[0071] : Context role vector, is exist Projection in space, dimension 1 ;

[0072] The pre-trained projection matrix is ​​a trainable parameter matrix with dimensions of . ;

[0073] : The original context vector, from S12, with dimensions of ;

[0074] The pre-trained projection matrix is ​​obtained through offline training, for example, using contrastive learning; to obtain this projection matrix A calibration dataset is required; this dataset contains paired samples. ,in It is a content space The calibration vector in It is in the shared role space The corresponding known target vector; The calibration process involves minimizing the value using optimization algorithms such as least squares or gradient descent. The error is used to fit the parameters of the matrix.

[0075] Specifically, this calibration dataset can be constructed by inviting a group of calibrators with different backgrounds to read a set of standardized content documents and asking them to provide feedback reflecting their current level of understanding or intent; this feedback is quantified or mapped into a shared role space. A known target vector For example, an expert's reading feedback on a professional document can be mapped to an expert role vector, while a novice's reading feedback on the same document can be mapped to a novice role vector; by collecting a large number of such... The calibration pair can then be used The fit;

[0076] Through this linear transformation, this embodiment obtained the same result as... In the same In space, with consistent dimensions This laid the mathematical foundation for subsequent distance calculation and fusion.

[0077] S1 also includes:

[0078] S14. Calculate the distance between the long-term portrait vector and the context character vector in the common character space, and use the activation function to calculate the character agility factor.

[0079] S15. Using the character agility factor as a dynamic mixing coefficient, linear interpolation is performed on the long-term portrait vector and the context character vector to construct the instantaneous character vector.

[0080] This embodiment further defines the specific construction process of the instantaneous role vector in S1;

[0081] S14. Calculate the long-term image vector. With context role vector In the shared role space The distance in the middle is used to calculate the character's agility factor using an activation function. ;

[0082] The purpose of this step is to quantify the current intent. With long-term portrait The degree of deviation between them;

[0083] The calculation method is as follows:

[0084]

[0085] The character's agility factor is a scalar whose range is defined by... The hyperbolic tangent activation function is constrained to the range of 0, 1;

[0086] Sensitivity hyperparameter is a preset normal value; its function is to adjust the system's response to... and The sensitivity to distance between them; this value can be determined based on industry standards or statistical analysis of experimental data from a calibration dataset;

[0087] Distance metric is... Computed in space and The Euclidean distance or L2 norm between them;

[0088] More specifically, The value controls the system's sensitivity to deviations from the current intent; a larger value... The value will lead to Even in and Even at medium distances, the system rapidly approaches 1, causing it to frequently switch to immediate intentions. ; a smaller The value then makes Slower growth makes the system more conservative, tending to maintain a long-term profile, i.e. During optimization, a grid search can be used to find a suitable target on the calibration dataset. Values ​​are used to balance the system's individual stability and immediate responsiveness.

[0089] The technical motivation for this formula is: when and When the distance is very close, meaning the current intention matches the long-term profile. The value is close to 0. It is also close to 0; when and When the distance is very large, meaning the current intention deviates significantly from the long-term profile, The value is very large. Close to 1;

[0090] S15, Utilizing the character's agility factor As a dynamic blending coefficient, it is used for long-term profile vectors and context role vector Perform linear interpolation to construct instantaneous character vectors. ;

[0091] The purpose of this step is to use the calculations from S14. Dynamic integration and ;

[0092] The calculation method is as follows:

[0093]

[0094] : Instantaneous character vector, which is the final output of S1, located at Space, dimension ;

[0095] : Dynamic mixing coefficient, from S14;

[0096] The technical motivation behind this formula is:

[0097] when When the value approaches 0, the intent aligns with the profile, and the formula becomes... At this point, the system places more trust in the user's long-term profile.

[0098] when When the value approaches 1, the intention conflicts with the image, and the formula becomes... At this point, the system considers the user's immediate intent to be more important, and the instantaneous role should be closer to the current context.

[0099] This will serve as the core input for subsequent S2 fit assessment and S4 profile correction.

[0100] S2 includes:

[0101] S21. Based on the original vector of the immediate context, retrieve candidate question-answer pairs from the knowledge base;

[0102] S22. Use a role embedding model to generate question-answer pair role vectors, where the question-answer pair role vectors are located in a common role space;

[0103] S23. Use a content embedding model to generate question-answer pair content vectors, which are located in the content space.

[0104] This embodiment provides specific limitations on the Q&A vectorization process of S2;

[0105] S21, Based on the original vector of instant context Retrieve candidate question-answer pairs (Qj, Aj) from the knowledge base;

[0106] This step is a prerequisite for S2, and its purpose is to narrow down the matching range; the system uses the results obtained in S12... lie in The space is used as a query vector, and it is stored in the same way. Semantic retrieval can be performed in a knowledge base of spatial vectors, for example, using vector retrieval tools such as FAISS or Milvus, to recall a set of candidate Q&A pairs that are initially related in terms of content.

[0107] S22. Using a role embedding model to generate question-answer pair role vectors. The question-and-answer pair's role vectors reside in the shared role space. ;

[0108] Question-and-answer pair role vector It refers to a A dimensional vector, whose purpose is to describe the implicit role attributes or granularity attributes of the Q&A pair (Qj, Aj) itself, such as whether the Q&A is beginner or expert level; this vector is generated by a pre-trained role embedding model, which is trained to map Q&A text to... Space; This character embedding model was also obtained through offline training, and its calibration dataset contains Q&A text and its corresponding manually annotated character-level labels. , It is a known vector or classification used for calibration;

[0109] S23. Use content embedding models to generate question-answer pair content vectors. The question-answer pair content vectors are located in the content space. ;

[0110] Question-answer pair content vector It refers to a The vector, whose purpose is to describe the semantic content of the Q&A pair (Qj, Aj), i.e., what it is talking about; this vector is generated by a content embedding model, typically in S12. The same or compatible models are generated.

[0111] S2 also includes:

[0112] S24. In the shared role space, calculate the distance between the question-answer pair role vector and the instantaneous role vector, and normalize it to obtain the granular matching degree.

[0113] S25. In the content space, the cosine similarity function is used to calculate the relevance between the question-answer pair content vector and the original vector of the immediate context to obtain the content relevance.

[0114] S26. The granularity matching degree and content relevance are weighted and summed to obtain the final fit score.

[0115] This embodiment further defines the specific calculation process of the fitness score in S2;

[0116] S24, In the shared role space In the process of calculating the role vector of the question-and-answer pair... With instantaneous character vector The distance is calculated and normalized to obtain the granularity matching degree. ;

[0117] The purpose of this step is to In the space, the pre-defined roles for evaluating Q&A. With the user's current instantaneous role Does it match?

[0118] The calculation method is as follows:

[0119]

[0120] Granularity matching degree is a normalized scalar value, for example, in the range of [0,1]; the higher the value, the better the role granularity matching.

[0121] Distance metric is... The distance between two vectors in space;

[0122] The preset maximum distance is a A constant in the space used for normalization; this value can be determined by statistically sampling the maximum distance between all vector pairs in the training set.

[0123] Specifically, the training set refers to the calibration dataset used to train the role embedding model described in S22; to ensure the robustness of normalization and avoid interference from extreme outliers, Preferably, it is done by statistically analyzing all data in the dataset. Vectors and all possible The distance distribution between vectors is used to determine the distance, for example, at the 99th percentile; using percentiles instead of absolute maximum values ​​ensures... The normalization is stable and meaningful in most cases;

[0124] S25, in content space In this paper, the cosine similarity function is used to calculate the content vector of the question-answer pair. With the original vector of the immediate context The relevance is used to obtain content relevance. ;

[0125] The purpose of this step is to In the space, assess the content of the Q&A. With the user's current context Are they semantically related?

[0126] The calculation method is as follows:

[0127]

[0128] Content relevance is a scalar value, for example, in the range of [-1,1] or [0,1]; the higher the value, the more relevant the content.

[0129] The cosine similarity function is a standard method for calculating the consistency of vector directions.

[0130] S26, Granularity matching degree Content relevance The final fitness score is obtained by performing a weighted summation. ;

[0131] The purpose of this step is to combine two fractions that are calculated independently in their respective spaces and are both scalars with the same dimensions;

[0132] The calculation method is as follows:

[0133]

[0134] The final fitness score is the final output of S2 and is used for ranking and decision-making in S3.

[0135] Granularity and content weight are preset scalar weights, for example... ,and These weights can be adjusted based on business needs, such as whether role matching or content matching is more important.

[0136] The dynamic generation process includes:

[0137] S31. When the trigger signal of the dynamic generation process is received, the instantaneous character vector and the original vector of the immediate context are subjected to affine transformation, projected and merged into the generator condition space to construct the generation control vector.

[0138] S32. Input the generated control vector and the instant context text corresponding to the instant context original vector into the pre-trained generative model.

[0139] S33. The generative model generates dynamically generated question-and-answer pairs under the constraints of the generation control vector.

[0140] This embodiment provides specific limitations on the dynamic generation process triggered in S3; this process is determined in S3. When triggered; Adaptability threshold It is a preset scalar value, such as 0.75. This threshold is determined by statistical analysis of historical data, such as taking the optimal equilibrium point of the ROC curve, and is used to judge whether the best Q&A selected by S2 is good enough.

[0141] S31. When a trigger signal for the dynamic generation process is received, the instantaneous role vector will be... and instant context original vector Perform affine transformation, project, and merge into the generator condition space. Construct and generate control vectors ;

[0142] The purpose of this step is to construct a single control vector that simultaneously tells the generative model what content to generate. And at what role granularity should the generation be from ;

[0143] Generator condition space This refers to pre-trained generative models. The comprehensible vector space used for receiving conditional control has a dimension of ;

[0144] Its calculation method is as follows: a standard affine transformation:

[0145]

[0146] : Generate control vectors, located at space The dimension will be used as input to the generative model;

[0147] The character projection matrix is ​​a trainable matrix. 3D matrix, used to... from Projected to ;

[0148] The content projection matrix is ​​a trainable matrix. 3D matrix, used to... from Projected to ;

[0149] : Bias vector, is In space Dimensional bias; these parameters The calibration process and Similarly, through a containing Fitting to the calibration dataset, where It is a calibration input pair. It is the expected generation control vector;

[0150] This transformation will transform two heterogeneous spaces and The vectors were uniformly projected and merged into space;

[0151] S32, Generate control vector With real-time contextual text Common input to the pre-trained generative model ;

[0152] S33, Generative Model In generating control vectors Under the constraints, dynamically generated question-answer pairs (Qgen, Agen) are generated;

[0153] This step involves the specific generation and execution;

[0154] Its operation can be represented as:

[0155]

[0156] The dynamically generated question-and-answer pairs are the final output text results;

[0157] The pre-trained generative model can be a fine-tuned ConditionedGeneration large language model that supports conditional generation, such as GPT, T5, or BART.

[0158] The immediate context text corresponding to the original immediate context vector, i.e., the text used to extract in S12. The original text;

[0159] The model will simultaneously focus on during generation. The content, and received Command In Ingredients will constrain Generate code at a granular level that fits the role, such as more colloquial or more professional. Ingredients will constrain Generate questions and answers related to this content.

[0160] S4 includes:

[0161] S41. Monitor users' interaction behavior with candidate question-and-answer pairs or dynamically generated question-and-answer pairs in real time and quantify it as interaction feedback signals;

[0162] S42. In the shared role space, based on the preset long-term portrait learning rate, the long-term portrait vector of the previous moment is updated online using the interactive feedback signal and the instantaneous role vector to obtain the updated long-term portrait vector.

[0163] This embodiment provides specific limitations on the long-term image closed-loop correction steps in S4;

[0164] S41. Monitor user interaction behavior in real time with candidate question-answer pairs from S2 or dynamically generated question-answer pairs from S3, and quantify it as interaction feedback signals. ;

[0165] Interactive feedback signals This refers to a scalar value used to quantify user satisfaction with recommendation results; its source is explicit or implicit user feedback determined by tracking points specific to the application scenario; for example:

[0166] The user clicked and read the Q&A: Positive feedback

[0167] The user ignored the Q&A: Weak negative feedback

[0168] Users either downvoted or closed the Q&A: Strong negative feedback

[0169] S42, In the shared role space In the middle, based on the preset long-term profile learning rate Utilizing interactive feedback signals and instantaneous character vector The long-term profile vector of the previous moment Perform online updates to obtain updated long-term profile vectors. ;

[0170] The purpose of this step is to utilize the feedback from S41 to address the issues in S1. Make adjustments to enable it to learn the user's latest preferences;

[0171] This update operation must be performed within... It takes place in space, because and All In space, dimensional consistency is guaranteed;

[0172] The calculation method uses a custom online update rule as follows:

[0173]

[0174] / The long-term profile vectors before and after the update are both located in space; This will be used as the input to S1 in the next iteration. ;

[0175] The long-term profile learning rate is a preset minimum value, for example... Its source is determined through experimental optimization, with the aim of ensuring convergence while preventing excessive disturbance to the stable profile caused by a single feedback.

[0176] : Interactive feedback signal, from S41;

[0177] Instantaneous character vector, from S1, representing user-generated... The instantaneous role one plays when providing feedback;

[0178] The technical motivation behind this formula is:

[0179] First item It's an old portrait The attenuation term; the key here is the attenuation coefficient. It is also related to the absolute value of the feedback signal. Relevant; its technological motivation is: when users provide strong feedback, whether positive or negative, that is... When it is larger, it indicates the current This is a signal with a lot of information, and the system should learn more extensively in the update items. At the same time, old things should be forgotten or decayed more quickly. To accelerate image vector Converge in a more accurate direction; if the feedback is weak. If it is close to 0, then It shows almost no decay, maintaining the stability of the image;

[0180] Second item It is an update item; if It is positive feedback. , Will be pulled towards Right now Will learn Features; if It is negative feedback. , They will be pushed away .

[0181] Example 2:

[0182] The present invention also provides a multi-granularity role-aware personalized question-and-answer pair dynamic generation device, comprising:

[0183] The instantaneous role construction unit is used to obtain the user's long-term profile vector and the instantaneous context original vector. It uses a pre-trained projection matrix to project the instantaneous context original vector onto the common role space to obtain the context role vector. It calculates the role agility factor based on the distance between the long-term profile vector and the context role vector, and dynamically weights and fuses the long-term profile vector and the context role vector according to the role agility factor to construct the instantaneous role vector.

[0184] The fit evaluation unit is used to obtain candidate question-answer pairs. It uses role embedding model and content embedding model to vectorize the candidate question-answer pairs to obtain question-answer pair role vector and question-answer pair content vector. In the common role space, it calculates the granular matching degree between the question-answer pair role vector and the instantaneous role vector. In the content space, it calculates the content relevance between the question-answer pair content vector and the instantaneous context original vector. It combines preset granularity weight and content weight to weight the granular matching degree and content relevance to obtain the final fit score.

[0185] The question-answering decision unit is used to preset the fit threshold, compare the final fit score with the fit threshold, and when the final fit score is higher than the fit threshold, select the candidate question-answer pair with the highest score for recommendation. When the final fit score is not higher than the fit threshold, trigger the dynamic generation process.

[0186] The profile correction unit is used to collect user interaction feedback signals and use the interaction feedback signals and instantaneous character vectors to perform closed-loop correction on long-term profile vectors.

[0187] This device is the physical implementation of the above method; it can be integrated into a server, cloud computing platform, or terminal device; in this embodiment, the device includes:

[0188] Instantaneous character building unit:

[0189] Its purpose is to execute S1; this unit is used to obtain the user's long-term profile vector. and instant context original vector ; Utilizing pre-trained projection matrices Will Projected into shared role space To obtain the context role vector ;based on and Distance calculation of character agility factor ; and according to right and Dynamic weighted fusion is performed to construct instantaneous role vectors. ;

[0190] Fit Assessment Unit:

[0191] Its purpose is to execute S2; this unit is used to obtain candidate question-answer pairs (Qj, Aj); the candidate question-answer pairs are vectorized using role embedding model and content embedding model respectively to obtain exist neutralization exist In; in Computation in space and Granularity matching degree ;exist Computation in space and Content relevance ; and combined with preset weights right and Weighting is applied to obtain the final fit score. ;

[0192] Question and Answer Decision Unit:

[0193] Its purpose is to execute S3; this unit is used to preset the fitness threshold. ;Compare and ;when When, the candidate question-answer pair with the highest score is selected for recommendation; when When the dynamic generation process is triggered, this signal will activate the module;

[0194] Image correction unit:

[0195] Its purpose is to execute S4; this unit is used to collect user interaction feedback signals. ; and utilize and ,exist In space, for long-term image vectors Perform online updates and closed-loop corrections;

[0196] In specific implementations, these units can be software modules executed by processors such as CPUs, GPUs, or NPUs, or hardware logic circuits embedded in ASICs or FPGAs.

[0197] The question-and-answer decision unit triggers a dynamic generation process, including:

[0198] The generation control vector construction module is used to perform affine transformation on the instantaneous character vector and the original vector of the immediate context when a trigger signal of the dynamic generation process is received, project and merge them into the generator condition space to construct the generation control vector.

[0199] The question-answer pair generation module is used to input the generation control vector and the immediate context text into the pre-trained generative model, so that the generative model can generate dynamically generated question-answer pairs under the constraints of the generation control vector.

[0200] This embodiment specifically defines the substructures involved after the question-answering decision unit triggers the dynamic generation process; this process consists of the following modules, which can be regarded as downstream components of the question-answering decision unit or specific implementations of S3:

[0201] Module for generating control vectors:

[0202] Its purpose is to execute S31; this module is used to obtain the instantaneous role vector when it receives the dynamic generation trigger signal from the question-answering decision unit. From instantaneous character building units and instantaneous context raw vectors It originates from the data acquisition end; it performs an affine transformation, i.e. Project and merge these two heterogeneous vectors into the generator condition space. To construct a single generative control vector ;

[0203] Question-answer pair generation module:

[0204] Its purpose is to execute S32 and S33; this module is used to process the output of the control vector generation module. and real-time context text Both are input into a pre-trained generative model. This module drives the model. exist Under the constraints, new and personalized question-and-answer pairs are dynamically generated and output to the user interface.

[0205] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A method for dynamically generating personalized question-and-answer pairs with multi-granularity role perception, characterized in that, The specific steps include: S1. Obtain the user's long-term profile vector and the original context vector; project the original context vector onto the common role space using a pre-trained projection matrix to obtain the context role vector; calculate the role agility factor to quantify the degree of intent deviation based on the distance between the long-term profile vector and the context role vector; and dynamically weight and fuse the long-term profile vector and the context role vector according to the role agility factor to construct the instantaneous role vector. S2. Obtain candidate question-answer pairs; use role embedding model and content embedding model respectively to vectorize the candidate question-answer pairs to obtain question-answer pair role vectors and question-answer pair content vectors; in the common role space, calculate the granularity matching degree between the question-answer pair role vector and the instantaneous role vector; in the content space, calculate the content relevance between the question-answer pair content vector and the instantaneous context original vector; combine the preset granularity weight and content weight to weight the granularity matching degree and content relevance to obtain the final fit score, and sort the final fit scores of all candidate question-answer pairs in descending order; S3. Preset fit threshold; compare the final fit score with the fit threshold. When the final fit score is higher than the fit threshold, select the candidate question-answer pair with the highest score for recommendation; when the final fit score is not higher than the fit threshold, trigger the dynamic generation process. S4. Collect user interaction feedback signals; and use the interaction feedback signals and instantaneous character vectors to perform closed-loop correction on the long-term profile vector; S1 involves obtaining the user's long-term profile vector and the original vector of the immediate context, and constructing the instantaneous role vector. Specifically, this includes: S11. Collect global long-term profile data of users, including users' historical browsing records and historical Q&A interaction data, and construct a long-term profile vector. The long-term profile vector is located in a predefined common role space. S12. Collect real-time context data, including the query text currently entered by the user and the content of the currently viewed page, and construct it into a real-time context raw vector through a content encoder. The real-time context raw vector is located in the content space. S13. Use the pre-trained projection matrix to perform a linear transformation on the original instantaneous context vector, mapping it from the content space to the common role space to obtain the context role vector; dynamically weight and fuse the long-term profile vector and the context role vector according to the role agility factor to construct the instantaneous role vector.

2. The method for dynamically generating personalized question-and-answer pairs with multi-granularity role perception according to claim 1, characterized in that, S1 also includes: S14. Calculate the distance between the long-term portrait vector and the context character vector in the common character space, and use the activation function to calculate the character agility factor. S15. Using the character agility factor as a dynamic mixing coefficient, linear interpolation is performed on the long-term portrait vector and the context character vector to construct the instantaneous character vector. The calculation formula is as follows: in, For instantaneous character vectors, For dynamic mixing coefficients, For long-term image vectors, This is a context role vector.

3. The method for dynamically generating personalized question-and-answer pairs with multi-granularity role perception according to claim 1, characterized in that, S2 include: S21. Based on the original vector of the immediate context, retrieve candidate question-answer pairs from the knowledge base; S22. Use a role embedding model to generate question-answer pair role vectors, where the question-answer pair role vectors are located in a common role space; S23. Use a content embedding model to generate question-answer pair content vectors, which are located in the content space.

4. The method for dynamically generating personalized question-and-answer pairs with multi-granularity role perception according to claim 3, characterized in that, S2 also includes: S24. In the shared role space, calculate the distance between the question-answer pair role vector and the instantaneous role vector, and normalize it to obtain the granular matching degree. S25. In the content space, the cosine similarity function is used to calculate the relevance between the question-answer pair content vector and the original vector of the immediate context to obtain the content relevance. S26. The granularity matching degree and content relevance are weighted and summed to obtain the final fit score.

5. The method for dynamically generating personalized question-and-answer pairs with multi-granularity role perception according to claim 1, characterized in that, The dynamic generation process includes: S31. When the trigger signal of the dynamic generation process is received, the instantaneous character vector and the original vector of the immediate context are subjected to affine transformation, projected and merged into the generator condition space to construct the generation control vector. S32. Input the generated control vector and the instant context text corresponding to the instant context original vector into the pre-trained generative model. S33. The generative model generates dynamically generated question-and-answer pairs under the constraints of the generation control vector.

6. The method for dynamically generating personalized question-and-answer pairs with multi-granularity role perception according to claim 1, characterized in that, S4 include: S41. Monitor users' interaction behavior with candidate question-and-answer pairs or dynamically generated question-and-answer pairs in real time and quantify it as interaction feedback signals; S42. In the shared role space, based on the preset long-term portrait learning rate, the long-term portrait vector of the previous moment is updated online using the interactive feedback signal and the instantaneous role vector to obtain the updated long-term portrait vector.

7. A multi-granularity role-aware personalized question-and-answer pair dynamic generation device, used to execute the multi-granularity role-aware personalized question-and-answer pair dynamic generation method as described in any one of claims 1-6, characterized in that, include: The instantaneous role construction unit is used to obtain the user's long-term profile vector and the instantaneous context original vector. It uses a pre-trained projection matrix to project the instantaneous context original vector onto the common role space to obtain the context role vector. It calculates the role agility factor based on the distance between the long-term profile vector and the context role vector, and dynamically weights and fuses the long-term profile vector and the context role vector according to the role agility factor to construct the instantaneous role vector. The fit evaluation unit is used to obtain candidate question-answer pairs. It uses role embedding model and content embedding model to vectorize the candidate question-answer pairs to obtain question-answer pair role vector and question-answer pair content vector. In the common role space, it calculates the granular matching degree between the question-answer pair role vector and the instantaneous role vector. In the content space, it calculates the content relevance between the question-answer pair content vector and the instantaneous context original vector. It combines preset granularity weight and content weight to weight the granular matching degree and content relevance to obtain the final fit score. The question-answering decision unit is used to preset the fit threshold, compare the final fit score with the fit threshold, and when the final fit score is higher than the fit threshold, select the candidate question-answer pair with the highest score for recommendation. When the final fit score is not higher than the fit threshold, trigger the dynamic generation process. The question-and-answer decision unit triggers a dynamic generation process, including: The generation control vector construction module is used to perform affine transformation on the instantaneous character vector and the original vector of the immediate context when a trigger signal of the dynamic generation process is received, project and merge them into the generator condition space to construct the generation control vector. The question-answer pair generation module is used to input the generation control vector and the immediate context text into the pre-trained generative model, so that the generative model can generate dynamically generated question-answer pairs under the constraints of the generation control vector. The profile correction unit is used to collect user interaction feedback signals and use the interaction feedback signals and instantaneous character vectors to perform closed-loop correction on long-term profile vectors.