Text generation method and device, and electronic device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PING AN INT FINANCIAL LEASING CO LTD
- Filing Date
- 2026-05-19
- Publication Date
- 2026-08-07
AI Technical Summary
[0004]针对上述情况,本申请实施例提供了一种文本生成方法、装置及电子设备,旨在解决现有技术生成的文本无法较准确地贴合用户意图的技术问题
[0009] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application.
Smart Images

Figure CN122528850A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence technology and natural language processing technology, and more specifically, to a text generation method, apparatus, and electronic device. Background Technology
[0002] With the popularization of artificial intelligence technology, users' needs for text generation in their work and life are becoming increasingly diversified. They are no longer satisfied with simple information output, but expect the system to generate precisely matched text content based on their deeper intentions. For example, in the fintech field, users need to generate investment analysis reports that conform to regulatory tone and have a rigorous structure; in the digital healthcare field, they need to generate easy-to-understand and logically clear health guidance or medical record summaries.
[0003] Currently, existing AI content generation technologies, whether for text or image descriptions, typically rely on fixed pre-trained model parameters or user-input keywords as guidance. These technologies lack the ability to flexibly respond to dynamic user needs, resulting in generated text that fails to accurately match user intent. Summary of the Invention
[0004] In view of the above situation, this application provides a text generation method, apparatus and electronic device, which aims to solve the technical problem that the text generated by the prior art cannot accurately match the user's intention.
[0005] In a first aspect, embodiments of this application provide a text generation method, the method comprising: The first explicit input data, first context data, first interface operation behavior trajectory data, and first implicit input data are processed to generate a first intent feature vector; wherein, the first explicit input data includes at least one of the following: text data, voice data, structured selection data, image data, and file data, and the first implicit input data includes at least one of the following: voice feature data, image attention data, and click heatmap data; the first intent feature vector contains at least one of the following label information: text type, text audience, and text language style; Based on the text type information, a target base template is determined from a pre-built text template library, and the target base template is modified using the first explicit input data and the first context data to generate initial AI-generated text. The acquired second explicit input data, second context data, second interface operation behavior trajectory data, and second implicit input data are processed to generate a second intent feature vector. Based on the second intent feature vector, text control parameters are generated; the text control parameters include: text modification prompt words and model decoding hyperparameters; The preset generation model is invoked, and the text control parameters are used to optimize the initial AI-generated text, thereby generating optimized AI-generated text.
[0006] Secondly, embodiments of this application also provide a text generation apparatus, the apparatus comprising: The first intent recognition module is used to process the acquired first explicit input data, first context data, first interface operation behavior trajectory data, and first implicit input data to generate a first intent feature vector; wherein, the first explicit input data includes at least one of the following: text data, voice data, structured selection data, image data, and file data; the first implicit input data includes at least one of the following: voice feature data, image attention data, and click heatmap data; the first intent feature vector contains at least one of the following label information: text type, text audience, and text language style. The first generation module is used to determine a target base template from a pre-built text template library based on the text type information, and modify the target base template using the first explicit input data and the first context data to generate initial AI-generated text. The second intent recognition module is used to process the acquired second explicit input data, second context data, second interface operation behavior trajectory data and second implicit input data to generate a second intent feature vector. The control parameter generation module is used to generate text control parameters based on the second intent feature vector; the text control parameters include: text modification prompt words and model decoding hyperparameters; The second generation module is used to call a preset generation model and optimize the initial AI-generated text using the text control parameters to generate optimized AI-generated text.
[0007] Thirdly, embodiments of this application also provide an electronic device, including: a processor; and a memory arranged to store computer-executable instructions, which, when executed, cause the processor to perform the steps of the text generation method described in the first aspect.
[0008] By utilizing the above technical solutions, the text generation method, apparatus, and electronic device provided in this application embodiment can generate intent feature vectors by integrating multiple types of explicit input data, context data, interface operation behavior trajectory data, and implicit input data. This effectively compensates for the ambiguity of intent in a single input form, comprehensively mining the core intent, language style, and usage scenario information of user creation, and significantly improving the overall accuracy of intent recognition. Based on the text type information carried by the intent feature vector, a suitable pre-built target basic template is matched, and then the basic template is adjusted and reconstructed in combination with effective input and context information. This can efficiently generate initial text that meets basic creative requirements, avoiding the situation where the generated content has a scattered structure and logical discontinuity. Then, multi-dimensional interactive data is integrated again to generate a new intent feature vector, which is converted into text control parameters that include modification prompts and decoding hyperparameters. Based on the preset generation model, the initial text is deeply optimized and polished according to the control parameters. Finally, this embodiment can obtain AI-generated text that is more in line with the user's real creative intent and style, has higher adaptability, and stronger content integrity.
[0009] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0010] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This illustration shows an application environment diagram of the text generation method provided in an embodiment of this application; Figure 2 A flowchart illustrating the text generation method provided in an embodiment of this application is shown; Figure 3 A schematic diagram of the structure of the text generation apparatus provided in an embodiment of this application is shown; Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0011] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0012] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0013] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such use can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the term "comprising" and its variations should be interpreted as open-ended terms meaning "including but not limited to."
[0014] As previously described, existing technologies typically rely on fixed pre-trained model parameters or user-input keywords as guidance. However, existing generation technologies lack the ability to flexibly respond to dynamic user needs, resulting in generated text that fails to accurately match user intent. Therefore, this application proposes a text generation method, apparatus, and electronic device, which will be described in detail below through specific embodiments.
[0015] The text generation method provided in this application embodiment can be applied to, for example, Figure 1In this application environment, the client communicates with the server via a network. The server can obtain and process first explicit input data, first context data, first interface operation behavior trajectory data, and first implicit input data from the client to generate a first intent feature vector. The first explicit input data includes at least one of the following: text data, voice data, structured selection data, image data, and file data. The first implicit input data includes at least one of the following: voice feature data, image attention data, and click heatmap data. The first intent feature vector contains at least one of the following label information: text type, text audience, and text language style. Based on the text type information, a target basic template is determined from a pre-built text template library, and the first explicit input data and first context data are used to modify the target basic template to generate initial AI-generated text, which is then fed back to the client. The server receives and processes second explicit input data, second context data, second interface operation behavior trajectory data, and second implicit input data from the client to generate a second intent feature vector. Based on the second intent feature vector, text control parameters are generated. The text control parameters include: text modification prompts and model decoding hyperparameters. Pre-defined parameters are then called. The model is constructed, and the initial AI-generated text is optimized using the text control parameters to generate optimized AI-generated text. The optimized AI-generated text is then fed back to the client. In this application, by integrating multiple types of explicit input data, context data, interface operation behavior trajectory data, and implicit input data to generate intent feature vectors, the ambiguity of intent in a single input form can be effectively compensated for. This comprehensively explores the core intent, language style, and usage scenario information of the user's creation, significantly improving the accuracy of overall intent recognition. Based on the text type information carried by the intent feature vector, a suitable pre-built target basic template is matched, and then the basic template is adjusted and reconstructed in combination with effective input and context information. This can efficiently generate initial text that meets basic creative requirements, avoiding the situation where the generated content has a scattered structure and logical discontinuity. Then, multi-dimensional interactive data is integrated again to generate a new intent feature vector, which is converted into text control parameters that include modification prompts and decoding hyperparameters. Based on the preset generation model, the initial text is deeply optimized and refined according to the control parameters. Finally, this embodiment can obtain AI-generated text that is more in line with the user's real creative intent and style, has higher adaptability, and stronger content integrity. The client can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented using a standalone server or a server cluster consisting of multiple servers. The following detailed description uses specific embodiments to illustrate this application.
[0016] Figure 2 This document illustrates a flowchart of a text generation method provided in an embodiment of this application. Figure 2 It can be seen that the embodiments of this application include at least steps S201-S205: S201: Process the acquired first explicit input data, first context data, first interface operation behavior trajectory data, and first implicit input data to generate a first intent feature vector; wherein, the first explicit input data includes at least one of the following: text data, voice data, structured selection data, image data, and file data; the first implicit input data includes at least one of the following: voice feature data, image attention data, and click heatmap data; the first intent feature vector contains at least one of the following label information: text type, text audience, and text language style; S202: Based on the text type information, determine the target basic template from the pre-built text template library, and modify the target basic template using the first explicit input data and the first context data to generate initial AI-generated text; S203: Process the acquired second explicit input data, second context data, second interface operation behavior trajectory data, and second implicit input data to generate a second intent feature vector; S204: Generate text control parameters based on the second intention feature vector; the text control parameters include: text modification prompt words and model decoding hyperparameters; S205: Call the preset generation model, use the text control parameters to optimize the initial AI-generated text, and generate optimized AI-generated text.
[0017] It should be noted that the method provided in this application can flexibly generate various types of text content, including various written reports such as formal work reports, market analysis reports and competitor comparison plans, as well as functional texts with different styles and functions such as social media copy, commercial marketing copy and team incentive emails. It can also output popular science articles or knowledge articles for different audiences, as well as scripts required for video creation, descriptions and sketches related to image creation, and intelligent dialogue response content in interactive scenarios such as customer service.
[0018] In particular, this method can be applied to the financial field, such as automatically generating investment analysis reports, risk assessment documents, financial product descriptions, or financial advice for clients; it can also be applied to the medical field, such as generating medical record summaries, medical image descriptions, clinical trial summary reports, or patient health guidance documents.
[0019] By parsing explicit and implicit input data to generate intent feature vectors, and using style, template, and decoding hyperparameters in the text control parameters to guide the generative model, the emotional tendency, target audience, and presentation style of the content can be customized as needed, thus adapting to various practical application scenarios such as content creation, business operations, customer service, audio and video production, image creation, financial analysis, and medical assistance.
[0020] For example, in the fintech field, a user first inputs "Please generate a risk analysis report on recent bond market fluctuations" via text. Simultaneously, the system obtains the first contextual data, recording the user's actions on the interface, including selecting the "For Risk Control Director" option, and the user's urgent tone during the voice inquiry, as the first implicit input data. After comprehensive processing, a first intent feature vector is generated, where the text type is "Risk Control Report," the audience is "Risk Control Director," and the language style is "formal and rigorous." Then, based on the text type, a basic "Risk Control Report" template is matched from the template library. Using the market data input by the user and historical volatility in the context, the risk factors and response suggestions in the template are filled in, generating the initial AI-generated text. After reading, the user adds the second explicit input data via voice: "Please add a stress test scenario, and make the tone more assertive." The system combines the second round of actions and implicit tone to generate a second intent feature vector, which in turn generates modification prompts including "stress test scenario supplementation" and sets a lower-temperature decoding hyperparameter. Finally, the generation model is called to optimize the initial text, outputting a risk analysis report with a stress test scenario and a decisive tone.
[0021] For example, in the field of digital healthcare, a patient or their attending physician inputs the first explicit input data, "Generate a daily health management suggestion for a patient with hypertension." Simultaneously, historical dialogues are retrieved as the first contextual data, recording the doctor's actions on the template selection interface, such as selecting the "simplified version," and the implicit tone of the doctor's voice input emphasizing "making it understandable for the elderly." This data is processed to obtain the first intent feature vector: text type "health guidance," audience "elderly patients," and language style "easy to understand." Based on the text type, a basic "health guidance" template is matched. Using the patient's blood pressure data and medication information in the context, suggestions for diet, exercise, and monitoring are filled into the template, generating the initial AI-generated text. The patient's family then input the second explicit input data via text: "Can you add reminders for medication time and use a more friendly tone?" The system combines the operation trajectory and tone features to generate a second intent feature vector. Based on this, it generates modification prompts such as "add reminders for medication time and change to a friendly tone" and decoding hyperparameters to appropriately increase the repetition penalty. Finally, it calls the generation model to optimize the initial text and outputs a health management suggestion with friendly language and a specific medication timetable.
[0022] As can be seen, this embodiment of the application generates intent feature vectors by integrating multiple types of explicit input data, contextual data, interface operation behavior trajectory data, and implicit input data. This effectively compensates for the ambiguity of intent in a single input form, comprehensively mining the core intent, language style, and usage scenario information of user creation, and significantly improving the overall accuracy of intent recognition. Based on the text type information carried by the intent feature vector, a suitable pre-built target basic template is matched, and then the basic template is adjusted and reconstructed in combination with effective input and contextual information. This efficiently generates initial text that meets basic creative requirements, avoiding the situation where the generated content has a scattered structure and logical discontinuity. Then, multi-dimensional interactive data is integrated again to generate a new intent feature vector, which is converted into text control parameters that include modification prompts and decoding hyperparameters. Based on the preset generation model, the initial text is deeply optimized and polished according to the control parameters. Finally, this embodiment can obtain AI-generated text that is more in line with the user's real creative intent and style, has higher adaptability, and stronger content integrity.
[0023] The following provides a detailed explanation of S201-S205.
[0024] Regarding the above S201: In this embodiment of the application, first explicit input data, first context data, first interface operation behavior trajectory data, and first implicit input data are first obtained.
[0025] The first explicit input data is user-inputted data, which includes at least one of the following: text data, voice data, structured selection data, image data, and file data. Structured selection data refers to parameters actively set by the user in the interface through methods such as checking labels, dropdown options, and single or multiple selection buttons, such as report style and content category. File data is a non-image format document uploaded by the user, such as PDF, Excel, or Word documents. In a specific implementation, for example, the user-input string is obtained from the front-end input box to obtain text data; an audio stream is captured through a microphone, sampled, encoded, and stored as an audio file, i.e., voice data; the structured selection data can be obtained directly by monitoring changes in the state of interface controls. Image data is uploaded by the user through the terminal interaction interface. The front end encapsulates the image resources into a binary byte stream and transmits it to the backend server via a network communication protocol. The server, i.e., the execution entity in this embodiment, captures the transmitted data packets through a preset data receiving interface, completes format verification and decoding, and extracts the original image pixel data that can be processed by algorithms. File data is uploaded by the user by selecting various local document files. The front end encapsulates and segments the selected file into binary format for transmission. The backend receives the complete file data stream through the file receiving interface, and after legality verification, file stream reassembly and format parsing, obtains the complete original file data that can be used for subsequent parsing and processing.
[0026] The first context data refers to the user's historical interaction content, historical input information, previously generated AI text, and scene attribute information corresponding to the current business interaction scenario within the current human-computer interaction session. In specific implementation, for example, the context data relies on the terminal's local session cache space to collect and temporarily store historical interaction records and page scene identifiers during the current interaction process in real time. Simultaneously, the backend matches the unique identifier of the current user's session, calls the standard data reading interface of the session management database, and retrieves the archived historical input records, historical generated content, and scene classification tags under the corresponding session. The collected multi-source information is then structured and cleaned to ultimately form the first context data that can be used for subsequent intent feature calculation and processing.
[0027] The first-level interface operation behavior trajectory data refers to the sequential record of all user interactions on the system interface in chronological order. This includes the type of each operation (e.g., click, hover, drag, swipe, input, selection, etc.), the target element of the operation (e.g., button, text box, slider, label, etc.), the coordinates of the operation's location, and the time interval and sequence relationship between operations. This time-series data reflects changes in the user's focus, operating habits, and underlying intentions. To obtain this data, front-end event tracking can be implemented: JavaScript can be used to listen for various DOM events such as click, mousemove, mousedown, mouseup, drag, change, input, and scroll. For each event, the event type, the ID or XPath of the target element, mouse coordinates (x, y), timestamp (accurate to milliseconds), and associated data (e.g., slider value, selected option text) should be recorded. For continuous movement events (e.g., mouse drag or hover), sampling throttling (e.g., recording one point every 50 milliseconds) is necessary to avoid excessive data volume. Finally, these events are sorted by user session ID and timestamp to generate an event sequence array. Further calculations can be made of derived features such as time difference between adjacent events, operation transition probability, and dwell time. On the server side, data can be received in real-time via WebSocket or reported in batches via requests, and stored as trajectory data in a time-series database for subsequent analysis.
[0028] The first implicit input data consists of behavioral signals generated by users involuntarily, unconsciously, or indirectly during interaction. These signals are not explicit inputs directly expressing the user's intentions, but they reflect their true preferences, emotional states, or potential needs. They are not independent data modalities, but rather enhancement signals to explicit inputs such as text, voice, and images. The first implicit input data includes at least one of the following: voice feature data, image attention data, and click heatmap data. Among these, voice feature data consists of non-textual attributes extracted from the user's voice signal, including fundamental frequency, energy, speech rate, timbre, and emotion tags, reflecting the user's emotional state or potential attitude. Image attention data refers to the hotspots and areas of focus exhibited by users when viewing images, typically obtained through mouse hovering or eye tracking, reflecting the intensity of the user's interest in specific content within the image. Click heatmap data is a two-dimensional hotspot distribution map formed by recording the user's click coordinates, target elements, and timestamps on the interface, and then statistically analyzing and estimating the density, used to reveal the user's focus and operational path. In practical implementation, for speech feature data, the collected speech signal can be segmented, pre-emphasized, and windowed. The fundamental frequency is extracted using the autocorrelation method, and the short-time energy is calculated as the amplitude. The speech rate is detected by the number of syllables per unit time. Then, Mel-frequency cepstral coefficients are extracted and input into a pre-trained emotion classification model to obtain emotion labels and confidence levels. For image attention data, mouse movement events on the image can be monitored on the front end, recording the mouse hover position coordinates and dwell time. These coordinates are mapped to pixel areas of the image. Combined with image content recognition (such as OCR or object detection), the information contained in the attention area (such as "overdue records") is determined, and finally, the attention area label and duration are output. For click heatmap data, click events can be monitored on the front end, recording the x and y coordinates, target element ID, and timestamp of each click. Then, Gaussian kernel density estimation is performed on all click coordinates to generate a two-dimensional probability density heatmap. The interface is divided into grids to count the number of clicks within each grid. Time-series heatmaps can also be generated by slicing by time period.
[0029] The first explicit input data, the first context data, the first interface operation behavior trajectory data, and the first implicit input data are then processed to generate a first intent feature vector. This first intent feature vector contains at least one of the following label information: text type, text audience, and text language style. Text type is an attribute identifier that defines the application category and genre framework of the text, used to classify the text's business purpose and overall writing structure. Common types include: risk control assessment reports, business emails, public speeches, industry analysis documents, and medical science popularization articles. The text audience refers to the target reading and receiving group of the text content, directly determining the depth of professional expression, content focus, and knowledge adaptation level. It mainly covers industry professionals, the general public, workplace managers, and young users. The text language style is the overall tone, wording, and expression of the text, reflecting its linguistic characteristics. It can be divided into different style types such as formal and rigorous, simple and plain, relaxed and friendly, and academic and professional, adapting to the reading and usage needs of different text types and audiences.
[0030] In a specific implementation, for example, a large language model can be invoked to process the first explicit input data, the first context data, the first interface operation behavior trajectory data, and the first implicit input data to generate a first intent feature vector.
[0031] In some embodiments, the process of processing the acquired first explicit input data, first context data, first interface operation behavior trajectory data, and first implicit input data to generate a first intent feature vector includes: Obtain the previous round weight data of each modal data and the first interface operation behavior trajectory data in the first explicit input data; Intent recognition is performed on each modal data in the first explicit input data and the first interface operation behavior trajectory data to obtain the corresponding confidence data; Each modal data in the first explicit input data and the first interface operation behavior trajectory data are calculated and processed to obtain the corresponding information entropy data; Based on historical user satisfaction data, the historical recognition accuracy data of each modality data in the first explicit input data and the first interface operation behavior trajectory data are calculated respectively. Based on the weight data of the previous round, the confidence data, the information entropy data, and the historical recognition accuracy data, the current round weight data of each modal data in the first explicit input data and the first interface operation behavior trajectory data are calculated respectively. Using the weight data of each current round, the first explicit input data, the first context data, the first interface operation behavior trajectory data, and the first implicit input data are processed to generate the first intent feature vector.
[0032] In this embodiment, firstly, the previous round weight data of each modality in the first explicit input data and the first interface operation behavior trajectory data are obtained. As mentioned above, the first explicit input data includes text data, voice data, structured selection data, image data, and file data. Each type of data is considered an independent modality. The previous round weight data refers to the weight value calculated for each modality, such as text, voice, image, and interface operation behavior trajectory, during the previous processing of the user session, used to reflect the importance of each modality in historical interactions. If it is the first interaction, a preset initial weight is used, such as 0.6 for text, 0.2 for voice, 0.1 for image, and 0.1 for interface operation behavior trajectory. In implementation, the execution entity of this embodiment can read these weights from storage and prepare them for subsequent calculations.
[0033] Then, intent recognition is performed on each modality of the first explicit input data and the first interface operation behavior trajectory data to obtain the corresponding confidence data. For example, for the text modality, the text is input into a pre-trained text classification model such as the Transformer classification model. The model outputs a probability distribution for each intent category, and the maximum probability value is taken as the confidence data for that modality. For the speech modality, speech is first converted to text using automatic speech recognition, and then the same text classification model is used to obtain the confidence data; alternatively, a dedicated speech intent classification model can be used to directly output the probability distribution, and the maximum probability is taken as the confidence data. For the image modality, an image classification model such as ResNet with an intent classification head is used to directly output the intent classification probability of the image content, and the maximum value is taken as the confidence data; if the image contains text, OCR can be performed first to extract the text before classification. For structured selection data, the user-selected tags or options are directly mapped to the corresponding intent category, and the confidence level is generally set to 1.0. For interface operation behavior trajectory data, the operation sequence is encoded into a vector. For example, information such as each operation type, target element, and dwell time is concatenated or encoded through a small-scale time series model. This vector is then input into an intent classifier to obtain the probability of each intent, and the maximum value is taken as the confidence score. Finally, the confidence score data for each modality is obtained.
[0034] This embodiment also calculates and processes each modal data in the first explicit input data and the first interface operation behavior trajectory data to obtain the corresponding information entropy data. Here, the information entropy data can measure the uncertainty of the current intent judgment of the modality. In specific implementation, for each modality, the probability distribution P(y1), P(y2), …, P(y3) output by the intent recognition model when calculating the confidence data can be used. K ), where K is the number of intent categories, substituting into the Shannon entropy formula: E = -Σ P(y i ) × log(P(y i If the probability distribution is highly concentrated, meaning the probability of a certain category is close to 1, then E is close to 0, indicating clear information; if the distribution is uniform, then E is larger, indicating ambiguous information. The calculated E value for each modality is the information entropy data for that modality. Note that for structured selection data, since it is directly mapped to a unique intent, its probability distribution is a single-point distribution, and its entropy value is 0.
[0035] This embodiment also calculates the historical recognition accuracy data for each modality in the first explicit input data and the first interface operation behavior trajectory data based on historical user satisfaction data. Here, historical user satisfaction data refers to records of the most recent 100 interactions over a given period: the user's final feedback (such as likes, dislikes, number of modifications, star ratings, etc.) after a particular modality is used as the dominant signal (i.e., its highest weight) to generate content. This feedback is quantified into satisfaction scores (e.g., likes = 1, dislikes = 0, more modifications result in lower scores). Then, for each modality, the average satisfaction score is calculated across all cases where that modality dominates, yielding the historical recognition accuracy data for that modality. For example, when the text modality dominates, the average user satisfaction is 0.9; when the image modality dominates, the average is 0.6. This value reflects the reliability of the modality for a specific user or general scenario over long-term use.
[0036] Next, based on the weight data from each previous round, the confidence data, the information entropy data, and the historical recognition accuracy data, the current round weight data for each modality in the first explicit input data and the first interface operation behavior trajectory data is calculated. In practice, for example, since these data have different dimensions and numerical ranges, each data point needs to be normalized first. Normalization methods include, for example, min-max scaling or Z-score standardization, to uniformly map each feature to the same numerical range to eliminate the influence of dimensions. Then, for each modality in the first explicit input data and the first interface operation behavior trajectory data, the normalized confidence, normalized information entropy, and normalized historical accuracy are extracted. Next, using a preset weighted fusion formula, such as linear weighting: Current round weight = α × previous round weight + β × normalized confidence - γ × (1 - normalized information entropy) + δ × normalized historical accuracy, the current round weight of the data is calculated, where α, β, γ, and δ are preset coefficients. Finally, repeat the above calculations for all modal and trajectory data to output a set of updated weight data for the current round, which will be used for subsequent intent vector generation.
[0037] Finally, using the weight data of each current round, the first explicit input data, the first context data, the first interface operation behavior trajectory data, and the first implicit input data are processed to generate the first intent feature vector. In implementation, for example, deep feature vectors are first extracted from each modality in the first explicit input data, the first context data, the first interface operation behavior trajectory data, and the first implicit input data, and implemented using their respective encoders, such as Transformer for text, CNN+RNN for speech, ResNet for images, and LSTM for trajectories. Then, the first implicit input data is attached as an enhancement signal to the corresponding explicit modality or operation trajectory features: for example, speech intonation features are injected into the text features of the speech modality using bias or attention masks, image attention data is applied as spatial attention weights to image features, and click heatmap data and interface operation behavior trajectory features are fused using temporal encoding. Next, based on the previously calculated weight data of each modality in the current round, the fused feature vectors are weighted and summed, or a cross-modal attention mechanism is executed using the weights as attention coefficients, thereby obtaining a comprehensive semantic vector. Finally, the integrated vector is input into a classifier or regression layer to output a structured first intent feature vector.
[0038] The initial intent feature data calculation method provided in this embodiment combines the temporal correlation characteristics of the previous round's weights and modal weights. It obtains confidence through independent intent recognition of each modality to measure the reliability of single-modal intent expression. It introduces information entropy to quantify the information richness of various modal data. It relies on historical recognition accuracy to refer to the long-term recognition performance of each modality, integrates multi-dimensional indicators to collaboratively calculate the current round's weight, and then uses the current round's weight to fuse and process multiple types of input data to complete feature generation. Finally, this embodiment can obtain more accurate and stable initial intent feature data.
[0039] In other embodiments, scene type features are detected from the currently acquired first explicit input data, first interface operation behavior trajectory data, and first implicit input data. Specifically, this includes determining whether there is a user-uploaded image, whether the voice input is active (e.g., there is voice data and the voice duration exceeds a threshold), and the complexity of the interface operation behavior trajectory (e.g., whether the number of operation steps, the diversity of operation types, or the length of the operation sequence exceeds a preset threshold). Then, based on the detection results, the current round weight data of the corresponding modality is hard-incrementally adjusted. For example, if a user-uploaded image is detected, the initial weight of the image modality is increased by a preset increment value (e.g., 0.3). If the voice input is active, the weight of the voice modality is increased. If the behavior trajectory is complex, the weight of the interface operation behavior trajectory modality is increased. The weights of modalities that have not triggered conditions remain unchanged. Finally, the weights of each modality after scene adaptive adjustment are normalized.
[0040] In some embodiments, the first explicit input data includes the text data; the first intent feature vector also includes classification confidence data of the label information; the method further includes: The text feature data of the text data is calculated, and the text feature data includes at least one of the following: text length, number of entities, number of words, and syntactic tree depth; and a first determination result is generated based on the text feature data and at least one preset threshold; the first determination result is used to indicate whether the text data of the first explicit input data is too simple; Based on the classification confidence data of various labels in the first intent feature vector and a preset first confidence threshold, a second determination result is generated; the second determination result is used to indicate whether the user's intent is ambiguous. A third determination result is generated based on a preset number of confidence values for the text type label and a preset confidence difference threshold; the third determination result is used to indicate whether there is an intent conflict. Based on the first determination result, the second determination result, and the third determination result, a fourth determination result is generated; the fourth determination result is used to indicate whether it is necessary to actively ask follow-up questions. If the fourth determination result indicates that further inquiry is required, then the missing label is determined based on the classification confidence data of various labels and the preset second confidence threshold. Based on preset importance data, target missing labels are determined from the missing labels; Obtain the follow-up question template corresponding to the target missing label from the preset question template library, generate follow-up questions based on the follow-up question template, and output them; After the step of generating and outputting follow-up questions, the method further includes: Receive third explicit input data from the user, the third explicit input data including text data; Return to the step of calculating the text feature data of the text data, iterate until the preset termination condition is met, generate a third intent feature vector based on all explicit input data of the user input, use the third intent feature vector as the new first intent feature vector, and continue to execute the step of determining the target base template from the pre-built text template library according to the text type information.
[0041] In this embodiment, firstly, text feature data of the text data is calculated, and a first judgment result is generated based on the text feature data and at least one preset threshold. The text feature data are numerical indicators used to quantify the complexity of the user-input text, including text length (number of characters or words), number of entities (number of names of people, places, organizations, etc. obtained through named entity recognition), number of words (number of words after word segmentation), and syntactic tree depth (maximum depth of the tree in syntactic analysis, reflecting the complexity of sentence structure). The first judgment result is a Boolean or enumerated value used to indicate whether the text data in the first explicit input data is "too simple". Specifically, for example, the user-input text is first segmented, part-of-speech tagging is performed, entity recognition is performed, and syntactic analysis is performed to calculate the text length, number of entities, number of words, and syntactic tree depth, respectively. Then, a corresponding preset threshold is set for each feature (e.g., fewer than 5 words are considered simple, fewer than 1 entity is considered simple). If any feature is below its simple threshold, or the overall score (e.g., weighted average) is below the threshold, the first judgment result is generated as "yes" (too simple); otherwise, it is "no".
[0042] Based on the classification confidence data of various labels in the first intent feature vector and a preset first confidence threshold, a second judgment result is generated. The first intent feature vector includes labels such as text type, text audience, and text language style, as well as the classification confidence score (a probability value between 0 and 1) for each label. The second judgment result is a Boolean value used to indicate whether the user's intent is ambiguous. In practice, for example, the highest confidence score of each label is extracted. If the highest confidence score of all labels is lower than the preset first confidence threshold (e.g., 0.6), the intent is judged to be ambiguous, and the second judgment result is "yes"; otherwise, it is "no".
[0043] The system also generates a third judgment result based on a preset number of confidence values for the text type labels and a preset confidence difference threshold. The preset number of confidence values includes, for example, the confidence values of the top two or three categories with the highest confidence in the text type label prediction results. The preset confidence difference threshold is, for example, 0.15, used to determine whether two candidate intentions are too similar. The third judgment result is a Boolean value indicating whether there is an intention conflict (i.e., multiple possible intentions are difficult to distinguish). In practice, for example, the text type label prediction results are sorted in descending order of confidence, and the top K (K is usually 2) are selected. The difference between the highest and second-highest confidence values is calculated. If the difference is less than the preset difference threshold, an intention conflict is determined, and the third judgment result is "yes"; otherwise, it is "no".
[0044] Next, based on the first, second, and third judgment results, a fourth judgment result is generated to determine whether follow-up questions are needed. This fourth judgment result is a Boolean value that determines whether to proactively ask the user for clarification. In practice, for example, a logical OR operation can be used: if the first judgment result is "yes" (text too simple), the second judgment result is "yes" (ambiguous intent), or the third judgment result is "yes" (conflicting intent), then the fourth judgment result is "follow-up questions are needed"; only when all three judgment results are "no" is it determined that "follow-up questions are not needed".
[0045] If the fourth determination result indicates that further inquiry is needed, then the missing labels are determined based on the classification confidence data of various labels and a preset second confidence threshold. The preset second confidence threshold is different from the first confidence threshold in step 2 and can be set lower (e.g., 0.5) or the same. In practice, for example, all labels in the first intent feature vector are iterated through. For each label, if its highest confidence is lower than the preset second confidence threshold, then the label name is added to the missing label set; otherwise, the label is considered clear and not added.
[0046] Then, based on preset importance data, the target missing label is determined from the missing labels. The preset importance data consists of predefined importance weights for each label dimension, such as text type importance = 0.9, audience = 0.7, tone = 0.5, which can be stored in a configuration file. In practice, for example, each missing label is scored according to the preset importance data (directly taking the importance value), and the label with the highest score is selected as the target missing label. If multiple labels have the same score, they can be randomly selected or determined according to a predefined priority (e.g., text type takes precedence over audience). In essence, the target missing label is the single label selected from the set of missing labels that is most important to investigate in this round.
[0047] The system retrieves follow-up question templates corresponding to the target missing tag from a preset question template library, generates follow-up questions based on these templates, and outputs them. The preset question template library stores a mapping between tags and follow-up question formats; for example, the audience tag corresponds to "Who is your content primarily aimed at?", and the text language style tag corresponds to "Do you prefer a formal, relaxed, or humorous content style?". In practice, for example, based on the name of the target missing tag, key-value matching is performed in the template library to retrieve the corresponding template string. If the template contains slots, specific option values are extracted from the first intent feature vector or candidate categories for filling (e.g., "Do you need {Candidate A} or {Candidate B}?"). Finally, the generated complete follow-up questions are output to the user through a display interface or voice output.
[0048] The system receives the third explicit input data from the user and returns to step 1 for iteration until a preset termination condition is met. Here, the preset termination condition is, for example, triggering a judgment result of "no need for further questioning," or reaching the maximum number of questioning rounds (e.g., 3 rounds). In specific implementation, for example, after receiving new user input, it jumps back to step 1. When the fourth judgment result becomes "no need for further questioning" or the number of rounds exceeds the limit, the loop exits, and the subsequent operation of determining the target basic template from the pre-built text template library based on the text type information continues.
[0049] This embodiment extracts multi-dimensional text features such as text length, number of entities, number of words, and syntactic tree depth, and combines them with corresponding preset thresholds to quantitatively verify the completeness of user input text, thus identifying overly simplistic input data. By combining the classification confidence of various labels in the first intent feature vector with a preset first confidence threshold, the clarity of the user's expressed intent can be effectively determined. Simultaneously, relying on high-confidence candidate values of text type labels and a preset confidence difference threshold, conflicts between multiple candidate intents can be accurately detected. The fusion of these three judgment results allows for precise control over the timing of proactive follow-up questions. A preset second confidence threshold filters out labels with missing information in intent recognition, and based on the preset label importance, the core target dimension to be supplemented is identified from the missing labels. A preset question template library is matched to generate targeted follow-up questions, which are then output. Iterative verification is performed by continuously receiving explicit input data supplemented by the user until the input information and user intent meet the generation requirements before proceeding with the prompt word conversion process. Ultimately, this embodiment yields a more complete and accurate representation of user intent, significantly improving the fit and accuracy of subsequent prompt word generation and AI-generated text content.
[0050] Regarding the above S202: After obtaining the first intent feature vector, the target basic template is determined from the pre-built text template library based on the text type information. The target basic template is then modified using the first explicit input data and the first context data to generate the initial AI-generated text.
[0051] The pre-built template library is a collection of templates stored in advance. Each template is categorized by content type (such as "incentive email", "popular science article", "press release") and includes a template framework, slot structure (replaceable elements), default values, and other fields.
[0052] Examples of template library categories:
[0053] Template data structure definition, example: json { "template_id": "email_motivation_001", "scene": "workplace communication", "content_type": "incentive email", "structure": [ {"slot": "greeting", "type": "title", "required": true}, {"slot": "opening", "type": "opening remarks", "required": true}, {"slot": "goal", "type": "goal statement", "required": true}, {"slot": "action_steps", "type": "action steps", "required": true, "repeatable": true}, {"slot": "encouragement", "type": "encouragement", "required": true}, {"slot": "closing", "type": "Conclusion", "required": true}, {"slot": "signature", "type": "signature", "required": false} ], "slot_defaults": { "greeting": "Dear {team_name} team,", Closing: "Looking forward to everyone's amazing performance!" "signature": "——{sender_name}" }, "style_hints": { "formal": "Use formal terms such as 'please,' 'must,' and 'therefore'". "casual": "Use colloquial expressions such as 'we,' 'together,' and 'go for it!'" "urgent": Emphasizes the urgency of the situation, using words such as "immediately" and "within today". } } In some embodiments of this application, the first intent feature vector includes the text language style tag; the step of modifying the target base template using the first explicit input data and the first context data to generate initial AI-generated text includes: Based on the first explicit input data and the first context data, generate a set of intent parameter key-value pairs; Using the set of intent parameter key-value pairs, replaceable elements in the target base template to generate a replaced template; A preset large language model is invoked, and the style of the replaced template is transformed using the text language style tags and a pre-built style lexicon to generate the initial AI-generated text.
[0054] In this embodiment, firstly, an intent parameter key-value pair set is generated based on the first explicit input data and the first context data. Here, the intent parameter key-value pair set is a dictionary structure formed by merging and deduplicating the first explicit input data and the first context data. For example: `{"content_type":"incentive email","audience":"sales team","goal":"achieve Q3 quarterly target","tone":"formal","deadline":"September 30th"}`. In implementation, for example, the first explicit input data and the first context data can be read, and all key-value pairs of each can be extracted; a dictionary object can then be output.
[0055] Then, using the intent parameter key-value pair set, replaceable elements in the target base template to generate a replaced template. In practice, for example, iterate through the structure field of the base template to identify the name of each slot (e.g., "team_name"); search for a matching value (e.g., "sales department") in the intent parameter key-value pair set; if found, replace it directly; otherwise, use the default value provided by slot_defaults in the template, or retain a placeholder for later querying; concatenate the replaced text fragments according to the template framework order to generate a plain text skeleton without style modifications; output the replaced template.
[0056] Then, a preset large language model is invoked, and the style of the replaced template is transformed using the text language style tags and a pre-built style lexicon to generate the initial AI-generated text. The pre-built style lexicon contains commonly used words for various tones, for example: { "Formal": {"Please be sure": 1.0, "Therefore": 0.9, "In view of": 0.8}, "Relax": {"Us": 1.0, "Together": 0.9, "Go for it": 0.8}, "Humor": {"Hahaha": 1.0, "Buddhist-like": 0.8, "Lying Down": 0.7} }
[0057] During implementation, for example, style transfer prompts can be constructed, such as "Please adjust the tone of the following text to {tone label}, while keeping the core information and structure unchanged: {replaced template}"; a preset large language model is invoked to perform inference and generate the style-transferred text; this text is then output as the final initial AI-generated text.
[0058] This embodiment first integrates the first explicit input data, and the first context data forms a set of intent parameter key-value pairs, gathering complete user intent information to avoid missing partial intent information; then, it replaces replaceable elements in the basic template by replacing the intent parameter key-value pair set to achieve automated customization and filling of text content; it determines the text language style tags from the integrated intent parameters, which can provide a clear control benchmark for style optimization; it combines the text language style tags with a pre-built style lexicon and calls a large language model to perform style conversion on the replaced template, which can accurately match the user's writing habits; finally, this embodiment can obtain an initial AI-generated text that is more in line with the user's complete intent and has stronger style adaptability.
[0059] Regarding S203-S205 above: Understandably, the initial AI-generated text is displayed on the front-end interface, and the user provides feedback on it. In this embodiment, the executing entity obtains second explicit input data, second context data, second interface operation behavior trajectory data, and second implicit input data. It then processes these data to generate a second intent feature vector. The generation steps for the second intent feature vector are similar to those for the first intent feature vector and will not be repeated here. The second intent feature vector records the dimensions that the user believes need modification to the initial AI-generated text. For example, the second intent feature vector includes the following information: tone: reduce formality, increase friendliness.
[0060] Next, text control parameters are generated based on the second intent feature vector; these text control parameters include user feedback prompts and model decoding hyperparameters. In this embodiment, text control parameters refer to adjustable variables that control the text generation process, and these variables directly affect the structure, semantic tendency, and other features of the generated content.
[0061] The user feedback prompt is a natural language instruction dynamically generated based on the second intent feature vector. It guides the generative model to focus on user-suggested modifications when optimizing the initial text. For example, if a user originally requested "change the tone to be more humorous," the user feedback prompt would be: "[User Feedback] Please adjust the tone of the following text to a humorous style, adding appropriate witty remarks and lighthearted expressions, but keeping the core information unchanged." In practice, the specific steps for generating the user feedback prompt are as follows: First, extract key dimensions from the second intent feature vector, such as the user-specified modification target (tone, audience, content details), the comparison differences (differences from the initial intent), and the intensity of the modification. Then, call a prompt generator module, which can use a predefined rule template (e.g., if a tone change is detected, apply the template "Please change the tone from {original tone} to {target tone}") or a small language model (e.g., T5) for conditional generation. Next, fill the extracted intent dimension values into the template or input them into the language model, outputting a natural language instruction. Finally, the instruction undergoes post-processing, such as adding special markers (e.g., "[System Instruction]") to distinguish it from the original user input, and ensuring its length and content meet the context window requirements of the subsequent generative model. The generated user feedback prompts will serve as soft control signals, in addition to the model's decoding hyperparameters, and will be fed into the generative model along with the initial AI-generated text to generate the optimized text.
[0062] Model decoding hyperparameters are parameters that control the randomness and diversity of the generative model's output during the inference phase. For example, the temperature coefficient adjusts the smoothness of the probability distribution; lower values result in more deterministic and conservative outputs (e.g., 0.2), while higher values lead to more diverse and potentially inconsistent outputs (e.g., 1.2). Top-p (kernel sampling) limits the cumulative probability of sampled words, and the repetition penalty coefficient suppresses repeated generation. In practice, for instance, the generation of model decoding hyperparameters is based on the "creativity requirement" and "format rigor" dimensions in the intent: for high creativity requirements (e.g., creative writing), a temperature of 0.9, a top-p of 0.95, and a repetition penalty of 0.8 are set; for low creativity and high rigor requirements (e.g., financial statement analysis), a temperature of 0.2, a top-p of 0.5, and a repetition penalty of 1.2 are set. These values are calculated using predefined mapping functions (e.g., piecewise linear mapping or rule tables) and passed as parameters to the generative model's inference interface.
[0063] Finally, in this embodiment, a preset generation model is invoked to optimize the initial AI-generated text based on the text control parameters, resulting in optimized AI-generated text. Specifically, the generated text control parameters are first read and parsed to identify and parse two types of control information: text modification prompts and model decoding hyperparameters. Then, the preset generation model is loaded, and the model's inference environment is initialized. The initial AI-generated text and the parsed text control parameters are fed into the generation model's inference input. The generation model adjusts the text output's sampling rules, semantic constraints, and text generation strategy according to the built-in configuration of the decoding hyperparameters. Simultaneously, based on the optimization dimensions defined by the text modification prompts, the language style, sentence structure, paragraph logic, and content of the initial text are verified, partially rewritten, and polished segment by segment. Multiple rounds of iterative fine-tuning are completed while preserving the original core business content and overall structural framework of the initial text. Once the text's tone, logic, and structure all match the control parameter requirements, the optimized AI-generated text is output.
[0064] In some embodiments, the method further includes: Obtain a historical conversation dataset; the historical conversation dataset includes samples with and without user evaluations, the samples with user evaluations include: explicit input data from multiple rounds of conversations, final AI-generated text, and user rating data; The reward model is trained using the user evaluation samples carried by each of the above methods; For the sample carrying user evaluations, the corresponding user rating data will be used as reward signal data; For the sample without user evaluation, the reward model is used to process the explicit input data of the multi-round conversations of the sample without user evaluation and the final AI-generated text to generate predicted rating data, and the predicted rating data is determined as reward signal data. Using the preset generation model as a policy network, the weight update gradient data of the preset generation model is calculated using the reward signal data. Based on the original weight data of the preset generation model and the weight update gradient data, an optimized generation model is generated. Replace the preset generation model with the optimized generation model.
[0065] In this embodiment, the historical session dataset contains two types of samples: samples with user ratings and samples without user ratings. Samples with user ratings record multiple rounds of explicit user input during a complete generation session, the final AI-generated text, and user ratings for that text, such as likes / dislikes, star rating, and number of modifications. Samples without user ratings also contain multiple rounds of explicit input and the final generated text, but lack user ratings. In implementation, for example, all generation sessions within a past period can be extracted from system logs or a database; for each session, it is determined whether there are user feedback records, and these are stored in the sets with and without ratings respectively; the data is then organized into a structured format (such as JSON), with each sample containing an input sequence, output text, and a rating (if any).
[0066] A reward model is trained using user rating samples. Here, the reward model is an independent neural network, such as a Transformer-based regression model or preference prediction model, used to simulate user rating behavior on (input, output). In implementation, for example, the model can use (multi-round explicit input sequences, ultimately generating text) from the rating samples as input features, with user ratings as supervision labels; define a loss function such as mean squared error (MSE) or ranking loss; train the reward model using gradient descent to make its output predicted ratings as close as possible to the actual user ratings; and finally, save the weights of the trained reward model.
[0067] For samples carrying user ratings, the corresponding user rating data is used as the reward signal data. Here, the reward signal is a scalar value used in reinforcement learning to evaluate the quality of the generative model's output. For samples not carrying user ratings, the reward model generates a predicted rating, which is used as the reward signal data. In practice, the (multi-round explicit input sequence, ultimately generating text) from each sample not carrying ratings can be concatenated or encoded and input into the pre-trained reward model; the reward model outputs a scalar prediction value during forward propagation; this prediction value is used as the reward signal for that sample.
[0068] Next, the preset generation model is used as the policy network, and the weight update gradient of the preset generation model is calculated based on the reward signal data. In implementation, a reinforcement learning algorithm can be used. For each sample, the user's explicit input sequence is fed into the current generation model to obtain the log probability of the generated text; the reward signal is used as the reward value; the policy gradient loss is calculated; the gradients of all samples are accumulated and averaged to obtain the final weight update gradient data.
[0069] Finally, based on the original weight data and weight update gradient data of the preset generated model, an optimized generated model is generated. During implementation, first, all trainable parameters of the current generated model are obtained; an optimizer such as Adam is used to apply the weight update gradient to the original weights: new weight = old weight - learning rate × gradient; after one or more update steps, the new model parameters are saved, resulting in the optimized generated model; the optimized generated model file or memory object is loaded into the production environment; the system configuration is updated so that all subsequent generation requests call the new model; the old model can be archived or deleted. This replacement process is typically performed during offline periodic maintenance.
[0070] This embodiment utilizes user review samples to train a reward model, enabling the model to fully learn users' evaluation criteria and preferences for AI-generated text. For samples with user reviews, user rating data is directly used as the reward signal, ensuring that the reward signal aligns with real user subjective feedback. For samples without user reviews, the reward model processes and generates predicted ratings, which are then used as reward signals. This effectively utilizes massive amounts of conversation data without human rating and labeling, avoiding data resource idleness and waste. By using a pre-defined generation model as a policy network and calculating weights and updating gradient data based on various reward signals, the direction for optimizing and adjusting model parameters can be accurately determined. Combining the original weights of the pre-defined generation model with the weight update gradient data generates an optimized model and completes model replacement, continuously adapting to users' real content needs and preferences. Ultimately, this embodiment achieves text generation quality that better meets user needs and more efficient offline model optimization by fully utilizing existing data.
[0071] In some embodiments, the method further includes: Based on the user input data and system output data of the current round, intent nodes, entity nodes, and behavior nodes are extracted to generate the original node set of the current round; wherein, if the user input data is the first explicit input data, then the system output data is the initial AI-generated text; if the user input data is the second explicit input data, then the system output data is the optimized AI-generated text. Obtain existing context graph data and calculate the similarity between nodes in the existing context graph data and nodes in the original node set; Based on the aforementioned similarities, the existing context graph data is updated according to the nodes in the original node set to generate merged context graph data. Construct a set of associated edges corresponding to the new nodes in the merged context graph data; the set of associated edges includes temporal associated edges, logical associated edges, and sentiment associated edges. For the merged context graph data after constructing the associated edges of the new nodes, the time decay weight of each edge is calculated based on the difference between the timestamp of the edge corresponding to each edge and the current time, using a preset time decay function. The pre-defined large language model is invoked to process the behavior nodes associated with each edge and their corresponding user input data and system output data, generating corresponding user behavior importance weights. The comprehensive weight of each edge is calculated based on the time decay weight of each edge and the importance weight of user behavior. Using a pre-defined temporal graph neural network, the node features of each node and the comprehensive weights of the corresponding edges are processed to generate node feature representations; The node feature representation of each node is stored in the merged context graph data to generate the final context graph data; the final context graph data is used as the first context data or the second context data.
[0072] In this embodiment, the real-time updated context graph is used as context data. Specifically, based on the user input data and system output data of the current round, intent nodes, entity nodes, and behavior nodes are extracted to generate the original node set for the current round. User input data refers to the explicit input provided by the user in the current round; system output data refers to the response text generated by the system (initial AI text or optimized AI text). Intent nodes represent the user's core purpose, such as "generate a report"; entity nodes represent specific objects or attributes, such as "market" or "report"; behavior nodes represent user or system actions, such as "write" or "generate". In practice, for example, a pre-trained intent classification model, named entity recognition model, and dependency parsing model are invoked to parse the user input and system output respectively; intent category labels, entity words and their types, and action keywords are extracted; each extraction result creates a node containing a unique ID, type, text description, and current round timestamp; these nodes are then stored in the original node set.
[0073] Next, acquire existing context graph data and calculate the similarity between nodes in the existing graph and nodes in the original node set. The existing context graph data is a knowledge graph constructed from historical dialogue rounds. Similarity refers to the proximity of two nodes in the semantic space. In implementation, this involves loading the existing graph from a database or cache, obtaining the embedding vectors of all nodes (e.g., pre-compiling using SentenceBERT), calculating the cosine similarity between the embedding vector of each node in the original node set and the vector of each node in the existing graph for each node in the original node set, and recording node pairs with similarity scores higher than a preset threshold (e.g., 0.8) as candidates for merging.
[0074] Based on similarity scores, the existing context graph data is updated according to the nodes in the original node set to generate merged context graph data. Node updates involve two operations: if the original node and an existing node are highly similar, they are merged, and the existing node's occurrence time, cumulative frequency, and other attributes are updated; otherwise, the original node is added to the graph as a new node. Specifically, for example, each node in the original node set can be traversed. If an existing node with a similarity exceeding a threshold is found, the attributes of that original node (such as the latest round and text description) are added to the existing node, and the timestamp is updated; if no matching existing node is found, the original node is added as a new node; this generates an updated node set, forming the merged context graph data.
[0075] Next, a set of associated edges corresponding to the new nodes in the merged context graph data is constructed. These edges include temporal, logical, and sentiment edges. Temporal edges represent the sequential dependence of nodes on the dialogue timeline; logical edges represent semantic connections such as causality, transition, and parallelism; and sentiment edges represent the consistency or transmission of sentiment in the associated text of the nodes. In a specific implementation, for example... Temporal Edges: Read the round timestamps of new nodes and existing nodes, and establish directed edges between the new node and the nodes that appeared in the previous round, in the order of first to last. Logical Edges: Extract causal / contrast relationships from user input and system output text (using a preset large language model), identify the logical bindings between new nodes and existing nodes, add edges, and label the relationship type (e.g., cause, contrast). Sentiment Edges: Call the sentiment analysis model to obtain the positive and negative scores of the text associated with each node. If two nodes have the same sentiment polarity and the sentiment intensity change is within a preset range, then an undirected sentiment edge is established.
[0076] Then, for the merged context graph data with newly constructed nodes and associated edges, the time decay weight of each edge is calculated based on the difference between the edge construction timestamp and the current time, using a preset time decay function. Here, the edge construction timestamp is the absolute time when the edge was created; the current time is the time when the system performed the calculation; and the preset time decay function is, for example, exponential decay. In implementation, for example, the creation timestamp of each edge can be obtained, and the time difference between the current time and the creation time can be calculated; this time difference Δt can be substituted into the decay function, for example, weight = exp(α·Δt)), where α is a preset decay coefficient; the calculation result is used as the time decay weight of that edge.
[0077] It also invokes a pre-defined large language model to process the behavioral nodes associated with each edge, the corresponding user input data, and the system output data to generate corresponding user behavior importance weights. These user behavior importance weights represent the criticality of the behavioral node in completing the core task; for example, "confirm payment" is more important than "browse the page." In implementation, for each edge, its associated behavioral nodes, along with the corresponding user input text and system output text, are extracted. Prompt words are constructed, such as "Evaluate the importance of the following behaviors in the dialogue, outputting only numbers from 0 to 1." A large language model (such as GPT4) is invoked for inference to obtain the output value; this value is then used as the user behavior importance weight associated with that edge.
[0078] Then, based on the time decay weight and the user behavior importance weight of each edge, the comprehensive weight of each edge is calculated. For example, for each edge, its time decay weight and behavior importance weight can be weighted and summed to obtain the comprehensive weight.
[0079] Finally, using a pre-defined temporal graph neural network, the node features and corresponding edge weights of each node are processed to generate node feature representations. These representations are then stored in the merged context graph data to generate the final context graph data. This final context graph data is used as either the first or second context data. In implementation, for example, all node features and edges (including weights) in the merged graph can be input into the temporal graph neural network. The graph neural network performs message passing in chronological order: each node collects features from its neighbors, multiplying them by the edge weights during aggregation as an attention coefficient. After multiple propagations, each node outputs a fixed-dimensional feature vector as its new feature representation. Each node feature vector is written back into the graph data structure, overwriting the old node feature fields. The complete graph is serialized and stored in a database or memory cache. In step S201 or S203 of the next round of dialogue, this graph is read in as either the first context data (when processing the first explicit input) or the second context data (when processing the second explicit input).
[0080] This embodiment extracts multiple types of nodes from user input data and system output data to form an original node set. Then, it calculates the similarity between historical graph nodes and new nodes and completes node update and merging, which can achieve organic integration of historical context and current round information, avoiding graph expansion. Next, it builds a set of multiple types of related edges for the new nodes of the merged graph, which can fully characterize the relationship between nodes from three dimensions: time, logic, and sentiment. Based on the edges, it constructs timestamps and time decay functions to solve the time decay weight, which can reasonably represent the change in the effectiveness of related edges over time. Through the analysis of related behaviors and corresponding dialogue texts by a large language model, it generates user behavior importance weights, which can objectively distinguish the priority of different user interaction behaviors. By integrating the time decay weight and the user behavior importance weight, it obtains the comprehensive weight of the edge, which can realize multi-dimensional quantification of the value of related edges. Then, it uses a temporal graph neural network to combine the basic features of nodes and the comprehensive weight of edges to generate node feature representations, and stores the node feature representations in the merged graph to complete the final generation. This enables the graph nodes to have semantic vector attributes that can be computed by machines. Finally, this embodiment can obtain context data in the form of a graph with complete related dimensions, reasonable temporal representation, accurate semantic quantification, and iterative reusability.
[0081] In some embodiments, prior to the step of acquiring existing context graph data, the method further includes: Calculate the intent similarity data between the user input data and the historical session data; The system invokes a preset large language model to process the user input data and the historical conversation data, generating logical conflict degree data. The intent migration detection result is determined based on the intent similarity data and the logical conflict degree data; If the intent migration detection result indicates that intent migration has occurred, then a preset large language model is invoked to calculate the positive logical association strength between each node in the existing context graph data and the user input data. Based on the strength of each positive logical association, nodes with a strength higher than a preset retention threshold are marked as retained nodes; The existing context graph data is updated based on each of the reserved nodes.
[0082] In this embodiment, firstly, intent similarity data between user input data and historical dialogue data is calculated. Historical dialogue data refers to the complete dialogue text data composed of all user input content and AI responses prior to the current interaction in the current session, such as previous user inquiries about the product's functions and corresponding system function descriptions. Intent similarity data refers to a numerical value used to quantify the semantic similarity between the core needs carried by the current user input and those carried by the historical dialogue. Specifically, for example, a pre-trained semantic embedding model can be invoked to extract and vectorize the intent from the current user input data and historical dialogue data, generating fixed-dimensional current intent semantic vectors and historical intent semantic vectors. Then, a cosine similarity algorithm is used to calculate the vector space similarity between the current and historical intent semantic vectors. Finally, the calculated similarity results are normalized and mapped to a range of 0 to 1, ultimately outputting the intent similarity data. A preset large language model is also invoked to generate logical conflict level data for the user input data and the historical dialogue data. The preset large language model is an existing large language model, such as chat-gpt or doubao. Logical conflict level data refers to numerical values used to quantify the degree of logical opposition and scenario fragmentation between the core intent of the current user input and the core intent of the historical dialogue. In practice, for example, user input data and historical dialogue data can be preprocessed to extract textual semantic descriptions of the core intent of the current round and the core intent of the historical dialogue, respectively. Then, the extracted semantic descriptions of the current and historical intents are input into a pre-defined large language model. This model then performs cross-round logical relationship reasoning on the input content, identifying the types of logical relationships corresponding to the preceding and following intents. Specifically, these include four categories: sequential progression, parallel supplementation, contradictory opposition, and scenario fragmentation. Finally, the pre-defined large language model quantifies and scores the identified logical relationships, mapping the scores to a range of 0 to 1 to generate logical conflict level data. Contradictory opposition and scenario fragmentation logical relationships correspond to high values, while sequential progression and parallel supplementation logical relationships correspond to low values.
[0083] Then, based on intent similarity data and logical conflict data, the intent migration detection result is determined. The intent migration detection result refers to a binary judgment result used to identify whether the core needs of the current user have fundamentally switched or jumped from the core needs of the previous dialogue. Specifically, it is divided into two types: intent migration occurred and intent migration did not occur. In practice, for example, intent similarity judgment thresholds and logical conflict judgment thresholds can be preset in advance, such as a similarity threshold of 0.4 and a conflict threshold of 0.7. Then, the calculated intent similarity data is compared with the preset similarity thresholds, and the logical conflict data is compared with the preset conflict thresholds. Finally, when the intent similarity data is lower than the preset similarity threshold and the logical conflict data is higher than the preset conflict threshold, it is determined that intent migration has occurred; all other cases are determined that intent migration has not occurred, and the final intent migration detection result is output.
[0084] If the intent migration detection result indicates intent migration has occurred, a pre-defined large language model is invoked to calculate the strength of the positive logical association between each node in the existing context graph data and the user input data. The strength of the positive logical association refers to a comprehensive value used to quantify the semantic fit and the degree of positive logical association between a single historical node in the context graph and the current user input intent. In practice, for example, all independent nodes in the existing context graph data can be extracted first, and the node feature vector and semantic description text corresponding to each node can be retrieved. Then, a pre-trained semantic embedding model is invoked to vectorize the current user input data, generating a semantic vector for the current new intent. Next, for each node in the context graph, a cosine similarity algorithm is used to calculate the similarity between the node feature vector and the semantic vector of the current new intent, obtaining a semantic association score. This score is normalized to the range of 0 to 1. Finally, the semantic description text of each node is compared with the current user input... Input data is fed into a pre-defined large language model. The model determines the logical relationship between the two, assigning high positive scores to logical relationships that are continuation, supplementation, or extension of the same scene, and low positive scores to logical relationships that are irrelevant, contradictory, or fragmented. The model outputs a logical positive score, which is also normalized to the range of 0 to 1. Finally, a fixed weighting ratio is set, and the semantic association score and logical positive score of each node are weighted and summed. The summation result is then normalized to the range, and the positive logical association strength corresponding to the node is finally obtained, completing the strength calculation of all nodes in the graph.
[0085] Next, based on the strength of each positive logical association, nodes with a strength higher than a preset retention threshold are marked as retained nodes. The preset retention threshold is a pre-set critical value used to filter nodes in the context graph; only nodes with a positive logical association strength higher than this value are considered valuable for the current new intent and are retained. In practice, for example, the retention threshold can be set to 0.5. Then, the positive logical association strength of all nodes in the context graph is traversed, and the strength value of each node is compared with the preset retention threshold one by one. Finally, nodes with a positive logical association strength higher than the preset retention threshold are marked as retained nodes, and nodes with a positive logical association strength equal to or lower than the preset retention threshold are marked as nodes to be removed.
[0086] Finally, based on each retained node, the existing context graph data is updated. In practice, for example, all marked retained nodes and the original valid relationships between them are first extracted. Then, all nodes that were not marked as retained nodes and all relationships related to the nodes to be removed are removed from the existing context graph data. Finally, the retained nodes and their corresponding relationships are integrated to generate the updated context graph data, completing the iterative update of the existing context graph.
[0087] This embodiment calculates the intent similarity data between user input data and historical dialogue data, enabling the semantic quantification of the correlation between preceding and following dialogues. It then uses a pre-defined large language model to generate logical conflict data between the two, allowing for the assessment of the degree of deviation in dialogue content from a logical perspective. By integrating intent similarity data and logical conflict data, the embodiment comprehensively determines the intent migration detection results, achieving accurate identification of user needs switching changes from both semantic and logical dimensions. Upon determining intent migration, the embodiment quantifies the positive logical correlation strength between each node in the existing context graph and the user input data using the pre-defined large language model. Combined with a pre-defined retention threshold, valid nodes are selected for updating and simplifying the existing context graph, eliminating irrelevant and redundant node content and retaining graph information strongly correlated with the current user needs. Ultimately, this embodiment yields simplified context graph data with higher correlation, less redundant information, and a better fit to the current user's actual needs.
[0088] In some embodiments, the method further includes: Obtain the initial text template library; Retrieve template modification data from multiple users; The large language model is invoked, and the templates in the initial text template library are modified using the template modification data to generate a candidate variant template set; Based on the candidate variant template set and the corresponding initial text template in the initial text template library, satisfaction data for each template is generated by random grouping and user satisfaction comparison test. Based on the satisfaction data of each template, templates with scores below a preset threshold are eliminated, and candidate variant templates with higher satisfaction scores are added to the template library to generate an updated text template library. Obtain the current user's text preference feature data; Based on the text preference feature data, template matching is performed in the updated text template library to obtain the personalized text template for the current user. The personalized text template for the current user is stored in the updated text template library; The step of determining the target base template from the pre-built text template library based on the text type information includes: Based on the text type information and the current user's user identifier, the target base template is determined from the pre-built text template library.
[0089] In this embodiment, to obtain the personalized text template for the current user, the initial text template library is first acquired. Here, the initial text template library refers to a batch of blank text templates that are pre-built manually or collected from existing data. Each template corresponds to a content type (such as a report or email) and has a specific structure, style, and length. For example, a concise template for a report includes three slots: title, core conclusion, and data table. In practice, the template library file can be read from a local database or a remote configuration center. Each template is parsed into a structured object containing fields such as template identifier, content type, structure fields (slot list), and default style tags, and loaded into memory for subsequent operations.
[0090] Next, obtain template modification data from multiple users. Here, template modification data refers to the records of user editing operations performed on the content generated by the system based on the template during interaction. This includes the specific location of the modification (e.g., paragraph two, ending sentence), the text fragments before and after the modification, the modification type (addition, deletion, modification), and the corresponding template identifier. For example, a user changes the salutation generated by the email template from "Dear Customer" to "Dear Friend." In practice, for example, all records of type "template content modification" can be filtered from the user behavior log table or feedback database by time range or user group. Each record is then cleaned (invalid or empty modifications are removed), and the modification location is mapped to the slot or paragraph number of the original template using a text alignment algorithm, ultimately forming a structured list of modification records.
[0091] Then, the large language model is invoked, and template modification data is used to modify the templates in the initial text template library, generating a candidate variant template set. Here, the candidate variant template set refers to multiple new template versions generated after applying different high-frequency modification patterns to the same initial template. Each version adds or replaces a certain pattern at a specific position (such as the end of the second paragraph) (such as adding an example). In specific implementation, for example, the template modification data can first be aggregated according to the template identifier, and the modification frequency of each position (paragraph, sentence, slot) on each template can be counted to extract the high-frequency modification positions and the corresponding modified text patterns (such as users often inserting the words "please note" at this position); then, a prompt word is constructed for each high-frequency pattern, in the format of "based on the following template: {initial template content}, {modification pattern description} is performed at {position}, generating a template variant"; the prompt word is sent to the application programming interface of the large language model to receive the returned text; finally, the returned text is validated for legality (ensuring the integrity of the slot structure), and legal variants are added to the candidate set.
[0092] Based on the candidate variant template set and the corresponding initial text templates in the initial text template library, user satisfaction data for each template is generated through random grouping and comparative user satisfaction testing. Random grouping involves randomly dividing participating users into several groups, with each group seeing only one template version (the original template or a candidate variant). The comparative user satisfaction test involves displaying the actual content generated by the template to users and collecting their satisfaction ratings (e.g., a five-point scale) or implicit feedback (e.g., likes, number of edits). Satisfaction data is a numerical metric, such as average rating or Net Promoter Score (NPS). In practice, for example, firstly, a test user pool is determined. For each template, the original template and all candidate variations are used as versions to be tested, and a fixed proportion of traffic is allocated to each version (e.g., the original template accounts for 20%, and each variation accounts for 20%). Then, when a user requests content generation, the template version is assigned based on the hash value of the user identifier modulo the number of groups, and the content generated using that version is displayed to the user. Next, the user's explicit rating or behavioral indicators for the content (such as whether it was copied, edited, or the duration of the session) are recorded and normalized to obtain a satisfaction score. Finally, the satisfaction scores of all users are aggregated by template version, and the satisfaction data for each template is output.
[0093] Based on the satisfaction data of each template, templates with scores below a preset threshold are eliminated, and candidate variant templates with higher satisfaction scores are added to the template library, generating an updated text template library. The preset threshold is a configurable value, such as 0.6. Higher satisfaction scores than the original template means that the average satisfaction score of the candidate variant is statistically significantly higher than the average score of the original template. The updated text template library is a new set of templates formed by deleting low-scoring templates and adding winning candidate variants based on the initial text template library. In specific implementation, for example, firstly, for each initial template, its original template score is compared with the preset threshold. If the original template score is lower than the threshold, it is marked as to be deleted; then, for its candidate variants, hypothesis testing (such as a two-sample t-test) is used to determine whether its satisfaction score is significantly higher than the original template. If it is higher, the variant is marked as to be added; next, the corresponding template is deleted from the current template library according to the marked list, and the winning variant is inserted into the template library, while updating the metadata of each template (creation time, source, historical satisfaction records); finally, the updated template library is persisted, overwriting the original file or writing a new version.
[0094] Retrieve the current user's text preference feature data. Text preference feature data refers to vectors or key-value pairs describing the user's personalized tendencies in text generation, such as level of detail preference (concise, moderate, detailed), tone formality (formal, casual), and chart usage preference (like, dislike). In practice, this can be achieved by querying the current user's preference feature records from a user profile storage system (such as a distributed key-value store or relational database) based on the user's unique identifier (anonymized user ID); if the user is new, a set of default preference features (such as moderate detail, formal tone) is returned; the query results are then parsed into a dictionary or feature vector format for subsequent matching.
[0095] Based on text preference feature data, template matching is performed in the updated text template library to obtain a personalized text template for the current user. A personalized text template refers to a blank template selected from the template library that best matches the user's preference features. For example, a user who prefers a lighthearted tone and short texts will be matched with a social media copywriting template with emoji slots. In practice, for example, firstly, for each template in the updated text template library, its style tags (such as formality score, length level, and detail level) can be converted into a feature vector of the same dimension as the user's preference features; then, the similarity between the user preference feature vector and the feature vector of each template (e.g., cosine similarity or Euclidean distance) can be calculated; finally, the template with the highest similarity is selected as the personalized text template output; if multiple templates have the same similarity, they are then sorted a second time by template usage frequency or creation time.
[0096] The personalized text template for the current user is stored in the updated text template library. This storage doesn't mean simply storing the template again, but rather establishing a relationship between the user and the template for quick subsequent retrieval. Specifically, for example, a record can be inserted into the user template mapping table (e.g., the relationship table `user_template_mapping`) containing the user identifier, template identifier, matching timestamp, and matching confidence score. Simultaneously, a counter for the usage count of this template under this user can be incremented to support subsequent personalized adjustments. Finally, ensure that this mapping information is persisted to the database to avoid repeatedly performing matching calculations in each request.
[0097] Based on text type information and the current user's identifier, the target base template is determined from a pre-built text template library. Text type information refers to the content category the user expects to generate, such as reports, emails, or popular science articles. The pre-built text template library is equivalent to the updated text template library. The user identifier is a unique anonymized code used to distinguish different users. In specific implementation, for example, firstly, the updated text template library can be filtered based on text type information (e.g., "email"), retaining only templates with that content type label; then, the user template mapping relationship stored in step eight is queried based on the user identifier. If a corresponding historical matching record exists and the template has not been eliminated, that template is directly returned as the target base template; if no historical record exists, the matching process reverts to matching based on preference features, but the matching scope is limited to a subset of templates corresponding to the current text type.
[0098] This embodiment first establishes a basic initial text template library and collects massive amounts of user template modification behavior data. Using a large language model, it learns users' real editing habits to derive and adjust existing templates, generating candidate variant templates adapted to different usage habits in batches. Then, it conducts user satisfaction comparison tests through random grouping and distribution, quantifying and statistically analyzing the actual usage feedback data of various templates. Based on set evaluation thresholds, it eliminates inefficient templates and incorporates high-quality candidate variant templates, achieving dynamic selection and continuous optimization of the text template library. Simultaneously, it collects current user-specific text preference feature data, performs feature matching in the updated template library to generate personalized text templates, and archives them. Subsequently, it can quickly locate and match the corresponding target basic template by combining text type information and user identity identifiers. Ultimately, this embodiment yields an intelligent text template library that better fits user editing habits, has higher adaptation accuracy, and can be autonomously iteratively optimized.
[0099] Those skilled in the art will understand that in the above-described method of the specific embodiments, the order in which the steps are written does not imply a strict execution order, but constitutes no limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0100] It should be noted that in practical applications, all the above-described possible implementation methods can be combined in any way to form possible embodiments of this application, and will not be described in detail here. The information (including but not limited to device information, user information, etc.) and data (including but not limited to data used for analysis, storage, and display) involved in this application are all information and data authorized by the user or fully authorized by all parties. The software tools or components appearing in the embodiments of this application are merely illustrative examples and do not represent actual use.
[0101] Based on the same concept, this application also provides a text generation device, which corresponds one-to-one with the text generation method in the above embodiments. Figure 3 A schematic diagram of the structure of the text generation apparatus provided in an embodiment of this application is shown. See also: Figure 3 As shown, the text generation apparatus 300 provided in this application embodiment includes: The first intent recognition module 301 is used to process the acquired first explicit input data, first context data, first interface operation behavior trajectory data, and first implicit input data to generate a first intent feature vector; wherein, the first explicit input data includes at least one of the following: text data, voice data, structured selection data, image data, and file data; the first implicit input data includes at least one of the following: voice feature data, image attention data, and click heatmap data; the first intent feature vector contains at least one of the following label information: text type, text audience, and text language style. The first generation module 302 is used to determine a target basic template from a pre-built text template library based on the text type information, and modify the target basic template using the first explicit input data and the first context data to generate initial AI-generated text. The second intent recognition module 303 is used to process the acquired second explicit input data, second context data, second interface operation behavior trajectory data and second implicit input data to generate a second intent feature vector. The control parameter generation module 304 is used to generate text control parameters based on the second intention feature vector; the text control parameters include: text modification prompt words and model decoding hyperparameters; The second generation module 305 is used to call a preset generation model and optimize the initial AI-generated text using the text control parameters to generate optimized AI-generated text.
[0102] In some embodiments, in the above-described apparatus, the first intent recognition module 301 is specifically used for: Obtain the previous round weight data for each modality data and the first interface operation behavior trajectory data in the first explicit input data; perform intent recognition on each modality data and the first interface operation behavior trajectory data in the first explicit input data to obtain the corresponding confidence data; perform calculation processing on each modality data and the first interface operation behavior trajectory data in the first explicit input data to obtain the corresponding information entropy data; calculate the historical recognition accuracy data for each modality data and the first interface operation behavior trajectory data in the first explicit input data based on historical user satisfaction data; calculate the current round weight data for each modality data and the first interface operation behavior trajectory data in the first explicit input data based on the previous round weight data, the confidence data, the information entropy data, and the historical recognition accuracy data; use the current round weight data to process the first explicit input data, the first context data, the first interface operation behavior trajectory data, and the first implicit input data to generate the first intent feature vector.
[0103] In some embodiments, in the above-described apparatus, the first explicit input data includes the text data; the first intent feature vector further includes classification confidence data of the label information; the apparatus further includes a follow-up questioning module, used for: Calculate the text feature data of the text data, the text feature data including at least one of the following: text length, number of entities, number of words, and syntactic tree depth; and generate a first determination result based on the text feature data and at least one preset threshold; the first determination result is used to indicate whether the text data of the first explicit input data is too simple; generate a second determination result based on the classification confidence data of various labels in the first intent feature vector and a preset first confidence threshold; the second determination result is used to indicate whether the user intent is ambiguous; generate a third determination result based on the first preset number of confidence values of the text type labels and a preset confidence difference threshold; the third determination result is used to indicate whether there is an intent conflict; generate a fourth determination result based on the first determination result, the second determination result, and the third determination result; the fourth determination result is used to indicate whether it is necessary to actively ask follow-up questions; if the If the fourth determination result indicates that follow-up questions are needed, then based on the classification confidence data of various tags and a preset second confidence threshold, the missing tags are determined; based on preset importance data, the target missing tag is determined among the missing tags; the follow-up question template corresponding to the target missing tag is obtained from a preset question template library, and a follow-up question is generated and output according to the follow-up question template; the device also includes an iteration module, which, after the step of generating and outputting the follow-up question: receives third explicit input data from the user, the third explicit input data including text data; returns to the step of calculating the text feature data of the text data, iterates until a preset termination condition is met, generates a third intent feature vector based on all explicit input data from the user, uses the third intent feature vector as a new first intent feature vector, and continues to execute the step of determining the target basic template from a pre-built text template library according to the text type information.
[0104] In some embodiments, in the above-described apparatus, the first intent feature vector includes the text language style tag; the first generation module 302, when modifying the target base template using the first explicit input data and the first context data to generate initial AI-generated text, is specifically used for: Based on the first explicit input data and the first context data, generate a set of intent parameter key-value pairs; use the set of intent parameter key-value pairs to replace replaceable elements in the target base template to generate a replaced template; call a preset large language model, use the text language style tags and a pre-built style lexicon to perform style conversion on the replaced template to generate the initial AI-generated text.
[0105] In some embodiments, the above-described apparatus further includes a model optimization module, used for: Obtain a historical session dataset; the historical session dataset includes samples with and without user evaluations, the samples with user evaluations including: explicit input data from multiple rounds of sessions, final AI-generated text, and user rating data; train a reward model using each of the samples with user evaluations; for each sample with user evaluations, use the corresponding user rating data as reward signal data; for each sample without user evaluations, use the reward model to process the explicit input data from multiple rounds of sessions and the final AI-generated text to generate predicted rating data, and determine the predicted rating data as reward signal data; use the preset generation model as a policy network, and use each of the reward signal data to calculate the weight update gradient data of the preset generation model; generate an optimized generation model based on the original weight data of the preset generation model and the weight update gradient data; replace the preset generation model with the optimized generation model.
[0106] In some embodiments, the apparatus further includes a map generation module for: Based on the user input data and system output data of the current round, intent nodes, entity nodes, and behavior nodes are extracted to generate the original node set of the current round. Wherein, if the user input data is the first explicit input data, the system output data is the initial AI-generated text; if the user input data is the second explicit input data, the system output data is the optimized AI-generated text. Existing context graph data is acquired, and the similarity between nodes in the existing context graph data and nodes in the original node set is calculated. Based on each similarity, nodes in the existing context graph data are updated according to the nodes in the original node set to generate merged context graph data. A set of associated edges corresponding to the new nodes in the merged context graph data is constructed; the set of associated edges includes temporal associated edges and logical associated edges. The process involves several steps: First, considering the constructed edges and sentiment-related edges, the merged context graph data is analyzed. This involves calculating the time decay weight of each edge based on the difference between its timestamp and the current time, using a pre-defined time decay function. A pre-defined large language model is then invoked to process the behavioral nodes associated with each edge and their corresponding user input and system output data, generating corresponding user behavior importance weights. Based on the time decay weights and user behavior importance weights, a comprehensive weight for each edge is calculated. A pre-defined temporal graph neural network is used to process the node features of each node and the comprehensive weights of its corresponding edges, generating node feature representations. These node feature representations are stored in the merged context graph data to generate the final context graph data. This final context graph data is then used as either the first context data or the second context data.
[0107] In some embodiments, the apparatus further includes a context reset module, used before the step of acquiring existing context graph data, for: The process involves: calculating intent similarity data between the user input data and historical session data; invoking a preset large language model to process the user input data and historical session data to generate logical conflict data; determining intent migration detection results based on the intent similarity data and the logical conflict data; if the intent migration detection result indicates that intent migration has occurred, invoking the preset large language model to calculate the positive logical association strength between each node in the existing context graph data and the user input data; marking nodes with a strength higher than a preset retention threshold as retained nodes based on each of the retained nodes; and updating the existing context graph data based on each of the retained nodes.
[0108] In some embodiments, the apparatus further includes a template generation module for: The process involves: acquiring an initial text template library; acquiring template modification data from multiple users; calling a large language model and using the template modification data to modify the templates in the initial text template library, generating a candidate variant template set; based on the candidate variant template set and the corresponding initial text templates in the initial text template library, generating satisfaction data for each template through random grouping and user satisfaction comparison testing; based on the satisfaction data of each template, eliminating templates with scores below a preset threshold and adding candidate variant templates with satisfaction scores higher than the original templates to the template library, generating an updated text template library; acquiring the text preference feature data of the current user; performing template matching in the updated text template library according to the text preference feature data to obtain the personalized text template for the current user; and storing the personalized text template for the current user in the updated text template library. Specifically, when determining the target basic template from the pre-built text template library based on the text type information, the first generation module is used to: determine the target basic template from the pre-built text template library based on the text type information and the user identifier of the current user.
[0109] This invention provides a text generation device that integrates multiple types of explicit input data, contextual data, interface operation behavior trajectory data, and implicit input data to generate intent feature vectors. This effectively compensates for the ambiguity of intent inherent in single input forms, comprehensively mining the core intent, language style, and usage scenario information of user creation, significantly improving the overall accuracy of intent recognition. Based on the text type information carried by the intent feature vector, a suitable pre-built target template is matched, and then the template is adjusted and reconstructed in combination with effective input and contextual information. This efficiently generates initial text that meets basic creative requirements, avoiding structurally scattered and logically disjointed generated content. Subsequently, multi-dimensional interactive data is integrated again to generate a new intent feature vector, which is then converted into text control parameters containing modification prompts and decoding hyperparameters. Based on a preset generation model, the initial text is deeply optimized and refined according to the control parameters. Finally, this embodiment can obtain AI-generated text that is more closely aligned with the user's true creative intent and style, with higher adaptability and stronger content integrity.
[0110] For specific limitations regarding the text generation device, please refer to the limitations on the text generation method above, which will not be repeated here. Each module in the aforementioned text generation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0111] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Figure 4 As shown, at the hardware level, this electronic device includes a processor, and optionally also includes an internal bus, a network interface, and memory. The memory may include main memory, such as high-speed random-access memory (RAM), or it may include non-volatile memory, such as at least one disk drive. Of course, this electronic device may also include other hardware required for other business operations.
[0112] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0113] Memory is used to store programs. Specifically, programs may include program code, which includes computer operation instructions. Memory may include main memory and non-volatile memory, and provides instructions and data to the processor.
[0114] The processor reads the corresponding computer program from non-volatile memory into main memory and then runs it, forming a text generation device at the logical level. The processor executes the program stored in memory and specifically performs the aforementioned methods.
[0115] The processor may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in the memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above method.
[0116] The electronic device can execute the text generation methods provided in several embodiments of this application, and is implemented as a text generation device. Figure 3 The functions of the embodiments shown are not described in detail here.
[0117] This application also proposes a computer-readable storage medium that stores one or more programs, the programs including instructions that, when executed by an electronic device including multiple applications, enable the electronic device to perform the text generation methods provided in various embodiments of this application.
[0118] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0119] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0120] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0121] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0122] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0123] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0124] Computer-readable media include both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0125] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0126] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0127] It should be noted that any AI models, software tools, or components not belonging to this company appearing in the embodiments of this application are merely illustrative examples and do not represent actual use. All user personal information involved in the embodiments of this application has been authorized (with the knowledge and consent) by the relevant parties or has been fully authorized by all parties, and the executing entity may obtain it through various legal and compliant means. The collection, storage, use, processing, transmission, provision, and disclosure of the information, data, and signals involved all comply with relevant laws and regulations and do not violate public order and good morals.
[0128] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A text generation method, characterized in that, The method includes: The first explicit input data, first context data, first interface operation behavior trajectory data, and first implicit input data are processed to generate a first intent feature vector; wherein, the first explicit input data includes at least one of the following: text data, voice data, structured selection data, image data, and file data, and the first implicit input data includes at least one of the following: voice feature data, image attention data, and click heatmap data; the first intent feature vector contains at least one of the following label information: text type, text audience, and text language style; Based on the text type information, a target base template is determined from a pre-built text template library, and the target base template is modified using the first explicit input data and the first context data to generate initial AI-generated text. The acquired second explicit input data, second context data, second interface operation behavior trajectory data, and second implicit input data are processed to generate a second intent feature vector. Based on the second intent feature vector, text control parameters are generated; the text control parameters include: text modification prompt words and model decoding hyperparameters; The preset generation model is invoked, and the text control parameters are used to optimize the initial AI-generated text, thereby generating optimized AI-generated text.
2. The text generation method according to claim 1, characterized in that, The process of processing the acquired first explicit input data, first context data, first interface operation behavior trajectory data, and first implicit input data to generate a first intent feature vector includes: Obtain the previous round weight data of each modal data and the first interface operation behavior trajectory data in the first explicit input data; Intent recognition is performed on each modal data in the first explicit input data and the first interface operation behavior trajectory data to obtain the corresponding confidence data; Each modal data in the first explicit input data and the first interface operation behavior trajectory data are calculated and processed to obtain the corresponding information entropy data; Based on historical user satisfaction data, the historical recognition accuracy data of each modality data in the first explicit input data and the first interface operation behavior trajectory data are calculated respectively. Based on the weight data of the previous round, the confidence data, the information entropy data, and the historical recognition accuracy data, the current round weight data of each modal data in the first explicit input data and the first interface operation behavior trajectory data are calculated respectively. Using the weight data of each current round, the first explicit input data, the first context data, the first interface operation behavior trajectory data, and the first implicit input data are processed to generate the first intent feature vector.
3. The text generation method according to claim 1, characterized in that, The first explicit input data includes the text data; the first intent feature vector also includes classification confidence data of the label information; the method further includes: The text feature data of the text data is calculated, and the text feature data includes at least one of the following: text length, number of entities, number of words, and syntactic tree depth; and a first determination result is generated based on the text feature data and at least one preset threshold; the first determination result is used to indicate whether the text data of the first explicit input data is too simple; Based on the classification confidence data of various labels in the first intent feature vector and a preset first confidence threshold, a second determination result is generated; the second determination result is used to indicate whether the user's intent is ambiguous. A third determination result is generated based on a preset number of confidence values for the text type label and a preset confidence difference threshold; the third determination result is used to indicate whether there is an intent conflict. Based on the first determination result, the second determination result, and the third determination result, a fourth determination result is generated; the fourth determination result is used to indicate whether it is necessary to actively ask follow-up questions. If the fourth determination result indicates that further inquiry is required, then the missing label is determined based on the classification confidence data of various labels and the preset second confidence threshold. Based on preset importance data, target missing labels are determined from the missing labels; Obtain the follow-up question template corresponding to the target missing label from the preset question template library, generate follow-up questions based on the follow-up question template, and output them; After the step of generating and outputting follow-up questions, the method further includes: Receive third explicit input data from the user, the third explicit input data including text data; Return to the step of calculating the text feature data of the text data, iterate until the preset termination condition is met, generate a third intent feature vector based on all explicit input data of the user input, use the third intent feature vector as the new first intent feature vector, and continue to execute the step of determining the target base template from the pre-built text template library according to the text type information.
4. The text generation method according to claim 1, characterized in that, The first intent feature vector contains the text language style tag; the step of modifying the target base template using the first explicit input data and the first context data to generate initial AI-generated text includes: Based on the first explicit input data and the first context data, generate a set of intent parameter key-value pairs; Using the set of intent parameter key-value pairs, replaceable elements in the target base template to generate a replaced template; A preset large language model is invoked, and the style of the replaced template is transformed using the text language style tags and a pre-built style lexicon to generate the initial AI-generated text.
5. The text generation method according to claim 1, characterized in that, The method further includes: Obtain a historical conversation dataset; the historical conversation dataset includes samples with and without user evaluations, the samples with user evaluations include: explicit input data from multiple rounds of conversations, final AI-generated text, and user rating data; The reward model is trained using the user evaluation samples carried by each of the above methods; For the sample carrying user evaluations, the corresponding user rating data will be used as reward signal data; For the sample without user evaluation, the reward model is used to process the explicit input data of the multi-round conversations of the sample without user evaluation and the final AI-generated text to generate predicted rating data, and the predicted rating data is determined as reward signal data. Using the preset generation model as a policy network, the weight update gradient data of the preset generation model is calculated using the reward signal data. Based on the original weight data of the preset generation model and the weight update gradient data, an optimized generation model is generated. Replace the preset generation model with the optimized generation model.
6. The text generation method according to claim 1, characterized in that, The method further includes: Based on the user input data and system output data of the current round, intent nodes, entity nodes, and behavior nodes are extracted to generate the original node set of the current round; wherein, if the user input data is the first explicit input data, then the system output data is the initial AI-generated text; if the user input data is the second explicit input data, then the system output data is the optimized AI-generated text. Obtain existing context graph data and calculate the similarity between nodes in the existing context graph data and nodes in the original node set; Based on the aforementioned similarities, the existing context graph data is updated according to the nodes in the original node set to generate merged context graph data. Construct a set of associated edges corresponding to the new nodes in the merged context graph data; the set of associated edges includes temporal associated edges, logical associated edges, and sentiment associated edges. For the merged context graph data after constructing the associated edges of the new nodes, the time decay weight of each edge is calculated based on the difference between the timestamp of the edge corresponding to each edge and the current time, using a preset time decay function. The pre-defined large language model is invoked to process the behavior nodes associated with each edge and their corresponding user input data and system output data, generating corresponding user behavior importance weights. The comprehensive weight of each edge is calculated based on the time decay weight of each edge and the importance weight of user behavior. Using a pre-defined temporal graph neural network, the node features of each node and the comprehensive weights of the corresponding edges are processed to generate node feature representations; The node feature representation of each node is stored in the merged context graph data to generate the final context graph data; The final context graph data is used as either the first context data or the second context data.
7. The text generation method according to claim 6, characterized in that, Prior to the step of acquiring existing context graph data, the method further includes: Calculate the intent similarity data between the user input data and the historical session data; The system invokes a preset large language model to process the user input data and the historical conversation data, generating logical conflict degree data. The intent migration detection result is determined based on the intent similarity data and the logical conflict degree data; If the intent migration detection result indicates that intent migration has occurred, then a preset large language model is invoked to calculate the positive logical association strength between each node in the existing context graph data and the user input data. Based on the strength of each positive logical association, nodes with a strength higher than a preset retention threshold are marked as retained nodes; The existing context graph data is updated based on each of the reserved nodes.
8. The text generation method according to any one of claims 1-7, characterized in that, The method further includes: Obtain the initial text template library; Retrieve template modification data from multiple users; The large language model is invoked, and the templates in the initial text template library are modified using the template modification data to generate a candidate variant template set; Based on the candidate variant template set and the corresponding initial text template in the initial text template library, satisfaction data for each template is generated by random grouping and user satisfaction comparison test. Based on the satisfaction data of each template, templates with scores below a preset threshold are eliminated, and candidate variant templates with higher satisfaction scores are added to the template library to generate an updated text template library. Obtain the current user's text preference feature data; Based on the text preference feature data, template matching is performed in the updated text template library to obtain the personalized text template for the current user. The personalized text template for the current user is stored in the updated text template library; The step of determining the target base template from the pre-built text template library based on the text type information includes: Based on the text type information and the current user's user identifier, the target base template is determined from the pre-built text template library.
9. A text generation device, characterized in that, The device includes: The first intent recognition module is used to process the acquired first explicit input data, first context data, first interface operation behavior trajectory data, and first implicit input data to generate a first intent feature vector; wherein, the first explicit input data includes at least one of the following: text data, voice data, structured selection data, image data, and file data; the first implicit input data includes at least one of the following: voice feature data, image attention data, and click heatmap data; the first intent feature vector contains at least one of the following label information: text type, text audience, and text language style. The first generation module is used to determine a target base template from a pre-built text template library based on the text type information, and modify the target base template using the first explicit input data and the first context data to generate initial AI-generated text. The second intent recognition module is used to process the acquired second explicit input data, second context data, second interface operation behavior trajectory data and second implicit input data to generate a second intent feature vector. The control parameter generation module is used to generate text control parameters based on the second intent feature vector; the text control parameters include: text modification prompt words and model decoding hyperparameters; The second generation module is used to call a preset generation model and optimize the initial AI-generated text using the text control parameters to generate optimized AI-generated text.
10. An electronic device, comprising: processor; And a memory arranged to store computer-executable instructions, characterized in that, when executed, the executable instructions cause the processor to perform the steps of the text generation method as described in any one of claims 1-8.