Content reasoning and generation method, electronic device, storage medium, program product

By utilizing estimated value prediction and content generation model validation in the draft sequence, high-quality lexical units are selected to participate in the generation, thus solving the problem of wasted computational resources caused by the expansion of the draft lexical unit sequence and improving the performance and efficiency of content generation.

CN122433922APending Publication Date: 2026-07-21INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-23
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

In existing technologies, the expansion of draft lexical sequences adopts an indiscriminate word-by-word lexical accumulation mode, which leads to a waste of computing resources and poor content generation performance.

Method used

By acquiring target source words, reasoning about draft words and constructing a draft sequence, using estimated value to predict the effectiveness of the draft sequence, expanding draft words only when the value threshold is reached, and combining with the content generation model to verify the applicability of candidate words, high-quality words are selected to participate in the generation.

Benefits of technology

Reduce meaningless lexical expansions, improve the effectiveness of draft lexical expansions, enhance content generation performance, and optimize the use of computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122433922A_ABST
    Figure CN122433922A_ABST
Patent Text Reader

Abstract

The application discloses a content reasoning and generation method, an electronic device, a storage medium and a program product, relates to the technical field of artificial intelligence, and the content reasoning method comprises draft token expansion based on estimated value prediction and candidate token verification. That is, the content reasoning process generates an initial draft sequence from a target source token, quantifies the probability of each draft token in the draft sequence being adopted by a content generation model by predicting the estimated value of the draft sequence, expands a new draft token when the estimated value meets the standard, and can reduce meaningless token expansion to improve the effectiveness of draft token expansion. At the same time, the content generation model takes the draft tokens screened by the value as candidates, and screens high-quality tokens to participate in sentence construction through applicability verification, reduces the interference of invalid candidate tokens on the generation process, and improves the content generation performance. The technical problem of poor content generation performance is solved, and the technical effect of improving the effectiveness of draft token expansion to improve the content generation performance is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a content reasoning method, a content generation method, an electronic device, a computer-readable storage medium, and a computer program product. Background Technology

[0002] With the rapid development of artificial intelligence technology, large-model-driven content generation technology has been widely applied in many fields such as text creation, intelligent dialogue, and information summarization. To improve the logic and coherence of generated content, the method of constructing draft lexical sequences to assist the content generation process has emerged. However, the current expansion of draft lexical sequences mostly adopts a mode of indiscriminate lexical accumulation, which easily leads to an increased computational burden on the cumbersome content generation model to screen candidate lexical units, resulting in ineffective consumption of computing resources and even causing poor content generation performance. Summary of the Invention

[0003] This application provides a content reasoning method, a content generation method, an electronic device, a computer-readable storage medium, and a computer program product to at least solve the problem of poor content generation performance in related technologies.

[0004] This application provides a content reasoning method, which includes: obtaining target source words; reasoning draft words connected to the target source words to obtain a draft sequence; obtaining the terminal words of the draft sequence; using the word sequence before the terminal words as an evaluation sequence; predicting a first factor and a second factor; wherein the first factor represents the probability that the predicted content generation model adopts each evaluation sequence, and the second factor represents the probability that the predicted content generation model adopts the terminal words; fitting the first factor and the second factor to obtain an estimated value; and in response to the estimated value reaching a value threshold, expanding the draft sequence with new draft words to update the draft sequence.

[0005] This application also provides a content generation method, which includes: a content generation model obtaining draft lexical units generated by a content draft model as candidate lexical units; wherein the draft lexical units are generated by the content draft model using the above-mentioned content reasoning method; the content generation model verifying whether the candidate lexical units are suitable for generating sentences; and in response to determining that the candidate lexical units are suitable for generating sentences, using the candidate lexical units to participate in the construction of the generated sentences.

[0006] This application also provides an electronic device, which includes: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of any of the above-described content reasoning methods, or to implement the steps of the above-described content generation method.

[0007] This application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of any of the above-described content reasoning methods, or implements the steps of the above-described content generation method.

[0008] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described content reasoning methods, or the steps of the above-described content generation methods.

[0009] This application addresses the issue of content inference methods that include draft lexical expansion based on estimated value prediction and candidate lexical verification. Specifically, the content inference process generates an initial draft sequence using target source lexicals. By predicting the estimated value of the draft sequence, the probability of each draft lexical being adopted by the content generation model is quantified. New draft lexicals are expanded when the estimated value meets the target, reducing meaningless lexical expansion and improving its effectiveness. Simultaneously, the content generation model uses value-screened draft lexicals as candidates and selects high-quality lexicals for sentence construction through applicability verification, reducing interference from invalid candidate lexicals and improving content generation performance. Therefore, this approach solves the technical problem of poor content generation performance, achieving the goal of improving the effectiveness of draft lexical expansion and thus enhancing content generation performance. Attached Figure Description

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

[0011] Figure 1 A schematic diagram of the structure of an embodiment of the system for generating content of this application; Figure 2 This is a flowchart illustrating an embodiment of the reasoning method for the content of this application; Figure 3 This is a flowchart illustrating another embodiment of the reasoning method for the content of this application; Figure 4 A flowchart illustrating an embodiment of the method for generating content for this application; Figure 5 This is a schematic diagram of the structure of an embodiment of the electronic device of this application. Detailed Implementation

[0012] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0013] It should be noted that, in the description of this application, 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. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.

[0014] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0015] The specific application environment architecture or specific hardware architecture on which the execution of the content reasoning method depends is described here.

[0016] Please see Figure 1 , Figure 1 A schematic diagram of the structure of an embodiment of the system for generating the content of this application.

[0017] In one embodiment, the content generation system may include a content draft model 11 and a content generation model 12.

[0018] In the field of large model inference optimization, speculative inference is a promising technical approach. Speculative inference can quickly predict several tokens that a target model (TargetModel) may generate in the future by introducing a lightweight "draft model" or external knowledge data.

[0019] The target large model can be equivalent to the content generation model 12 in this embodiment, and the lightweight draft model can be equivalent to the content draft model 11 in this embodiment.

[0020] The target large model performs parallel verification of candidate tokens. If a candidate token passes verification, the target large model can accept multiple tokens in one step, significantly improving the effective throughput. For example, the draft model can be used as a speculative layer in MTP (Multi-Token Prediction) to implement speculative inference technology. In simpler terms, a small model (i.e., the draft model) quickly guesses which tokens the large model (i.e., the target large model) will generate next, and then the large model verifies these guesses in parallel. If the guess is correct, multiple tokens can be generated in one step, thus significantly improving throughput.

[0021] In this embodiment, the content reasoning model can obtain target source words; reason the draft words connected to the target source words to obtain a draft sequence; predict the estimated value of the draft sequence using the content generation model 12; and in response to the estimated value reaching a value threshold, expand the draft sequence with new draft words to update the draft sequence.

[0022] Thus, the content generation model 12 can obtain the draft words generated by the content draft model 11 as candidate words; wherein, the draft words are generated by the content draft model 11 using the above-mentioned content reasoning method; the content generation model 12 verifies whether the candidate words are suitable for generating sentences; in response to determining that the candidate words are suitable for generating sentences, the candidate words are used to participate in the construction of the generated sentences.

[0023] The embodiments of this application provide a content reasoning method, and the method is described in detail in conjunction with the execution flow of the content reasoning method.

[0024] Please see Figure 2 , Figure 2 This is a flowchart illustrating an embodiment of the reasoning method for the content of this application.

[0025] S101: Obtain the target source word element.

[0026] In this embodiment, target source lexical units are obtained. Target source lexical units can be considered the basic units for content reasoning and subsequent content generation. They can be the core topic words, keywords, initial input lexical units, user-specified core semantic lexical units, or lexical units within a self-constructed generation statement. Obtaining target source lexical units provides a starting point and direction for the reasoning of subsequent draft lexical units, reducing the risk that the construction of subsequent draft sequences deviates from the content generation requirements.

[0027] S102: The draft word sequence is obtained by connecting the source word of the reasoning target word.

[0028] In this embodiment, based on preset semantic association rules, contextual logical connection models, or the word association capabilities of a large model pre-trained on a draft basis, draft words that are semantically matched and logically coherent with the target source words can be inferred. These inferred draft words are then arranged and combined according to semantic connection order to form an initial draft sequence. It is easy to understand that the draft sequence is the prototype carrier of content generation, capable of carrying the initial semantic framework for content generation. Through accurate inference based on the target source words, the relevance between the initial draft sequence and the content generation requirements can be guaranteed.

[0029] S103: Obtain the terminal words of the draft sequence; use the sequence of words before the terminal words as the evaluation sequence; predict the first factor and the second factor; wherein, the first factor represents the probability that the predicted content generation model adopts each evaluation sequence, and the second factor represents the probability that the predicted content generation model adopts the terminal words; fit the first factor and the second factor to obtain the estimated value.

[0030] In this embodiment, the estimated value of the initial draft sequence can be quantitatively predicted by using a preset value assessment algorithm, a trained value prediction sub-model, a value assessment formula, or the adoption probability of the content draft model assessment.

[0031] Therefore, in this embodiment, the terminal words of the draft sequence are obtained, and the sequence of words preceding the terminal words is used as the evaluation sequence. A first factor and a second factor are predicted respectively. The first factor represents the probability that the content generation model will use each evaluation sequence, and the second factor represents the probability that the content generation model will use the terminal words. The estimated value is obtained by fitting the first and second factors to predict the estimated value of the draft sequence used by the content generation model.

[0032] The evaluation dimensions for estimating value can include, but are not limited to, the semantic completeness, logical rationality, fit with the target generated content, and support for subsequent content expansion of the draft sequence. Predicting the estimated value of the draft sequence can provide a quantitative basis for subsequent draft sequence expansion decisions, reduce ineffective expansion of draft sequences with no or little value, and thus reduce the consumption of computing resources.

[0033] S104: In response to the estimated value reaching the value threshold, expand the draft sequence with new draft terms to update the draft sequence.

[0034] In this embodiment, a pre-set value threshold is used as the benchmark for determining whether a draft sequence has expansion value. After obtaining the estimated value of the draft sequence, the estimated value is compared with the value threshold. If the estimated value reaches the value threshold, the current draft sequence is determined to have further expansion value. Based on the semantic logic and content generation requirements of the existing draft sequence, new matching draft lexical units are inferred and added to the existing draft sequence, completing the iterative update of the draft sequence. If the estimated value does not reach the value threshold, the current draft sequence is determined not to have expansion value, and no further lexical unit expansion operation is performed. By making expansion decisions based on the value threshold, the accumulation of low-value lexical units can be reduced from the source, improving the overall quality of the draft sequence and providing relatively high-quality candidate lexical units for the subsequent content generation model.

[0035] The following explains the terms that appear in this embodiment.

[0036] Target source lexical units generally refer to the core basic language units in content reasoning and subsequent content generation processes. They serve as the initial anchor points for initiating draft lexical reasoning and sequence construction. Their sources include, but are not limited to, the core topic words and keywords of the content to be generated, initial lexical units manually input by the user, core semantic lexical units automatically extracted by the system, and can also be obtained by filtering from historical text based on user needs and scenarios. Essentially, target source lexical units can be considered to carry the core semantic information of the preset generation target. By accurately acquiring target source lexical units, a clear direction can be provided for subsequent draft lexical reasoning based on semantic association rules and pre-trained models, effectively preventing subsequent draft sequence construction from deviating from the topic and ensuring the relevance of the entire content reasoning process. They serve as a key carrier connecting user needs and the initial form of content generation.

[0037] Draft lexical units refer to language units that are highly semantically matched, logically coherent, and meet the content generation requirements. These units are derived from target source lexical units, relying on pre-defined semantic association rules such as synonym expansion and contextual dependency rules, contextual logical connection models, or the lexical association capabilities learned by large-scale models after pre-training on large-scale corpora. Unlike ordinary random lexical units, draft lexical units have undergone preliminary semantic screening and already possess relevance to the target topic. They are the basic units constituting the draft sequence, and their quality directly determines the semantic completeness and logical rationality of the initial draft sequence. Simultaneously, draft lexical units need to serve as candidate lexical sources for the content generation model. Through subsequent value assessment and applicability verification, they can provide relatively accurate materials for high-quality content generation, minimizing the interference of unrelated lexical units on the generation process.

[0038] Estimated value refers to the result obtained by quantitatively evaluating a draft sequence from multiple dimensions using a pre-defined value assessment algorithm (such as a semantic similarity scoring algorithm or a logical consistency verification algorithm) or a value prediction sub-model trained on a labeled dataset. It is used to accurately characterize the sequence's contribution, adaptability, and scalability to subsequent content generation. For example, the evaluation dimensions of estimated value may include one or more of semantic completeness, logical rationality, thematic fit, and extensibility support. Estimated value can be presented in the form of quantitative scores or grades, providing an objective quantitative basis for the expansion decision of the draft sequence. This can effectively reduce ineffective expansion of low-value, unrelated sequences, reduce waste of computational resources, and ensure the consistency of subsequent expanded lexical units with the initial semantic framework. For example, semantic completeness can be quantitatively evaluated by whether it covers the core semantics of the target generated content; logical rationality can be quantitatively evaluated by whether the connection of lexical units within the sequence conforms to natural language logic; thematic fit can be quantitatively evaluated by the degree of matching with the pre-defined generation target; and extensibility support can be quantitatively evaluated by whether it can derive coherent and valuable subsequent lexical units.

[0039] A draft sequence refers to an initial language sequence formed by arranging and combining several draft words obtained from target source word inference according to the semantic connection logic of natural language, the syntactic coherence order, and the preliminary framework of content generation. It serves as the rudimentary semantic carrier and core transition unit for content generation. The draft sequence carries the initial logical framework and semantic structure of content generation, and its construction quality may affect the accuracy of subsequent value assessment, the effectiveness of word expansion, and the efficiency and accuracy of the final content generation. The draft sequence is not necessarily a fixed, static sequence; in other words, it can be iteratively updated through subsequent high-value expansions, gradually improving its semantic hierarchy and logical structure. As a transitional stage connecting target source words and the final generated sentence, it can retain the initial required semantics and provide optimizable basic materials for the content generation model, reducing the computational cost of directly generating content.

[0040] The value threshold represents a pre-set benchmark value for the adaptation requirements of content generation tasks. It can be dynamically adjusted or fixedly set according to actual application scenarios such as text creation and intelligent dialogue, serving as the core quantitative standard for determining whether a draft sequence has the potential for further expansion. Setting the value threshold balances content generation quality and computational efficiency, preventing excessively high thresholds from leading to the misjudgment and discarding of effective sequences, or excessively low thresholds from causing the accumulation of low-value words. A clear decision-making logic is formed by comparing the estimated value of the draft sequence with the value threshold. If the estimated value reaches or exceeds the value threshold, the sequence is deemed to have expansion value, triggering the inference of new draft words and sequence updates; if the estimated value does not reach the value threshold, the expansion operation can be immediately terminated, preventing the accumulation of low-value words. This quantitative screening ensures the overall quality of the draft sequence, providing a foundation of high-quality candidate words for subsequent content generation models, while optimizing the rational allocation of computational resources.

[0041] As can be seen, the content reasoning method in this embodiment includes draft word expansion based on estimated value prediction and candidate word verification. Specifically, the content reasoning process generates an initial draft sequence using target source words. By predicting the estimated value of the draft sequence, the probability of each draft word being adopted by the content generation model is quantified. When the estimated value meets the target, new draft words are expanded, reducing meaningless word expansion and improving the effectiveness of draft word expansion. Simultaneously, the content generation model uses value-filtered draft words as candidates and selects high-quality words for sentence construction through applicability verification, reducing the interference of invalid candidate words on the generation process and improving content generation performance. In other words, by constructing an initial draft sequence starting with target source words, and achieving accurate expansion of the draft sequence through quantitative prediction of estimated value and threshold judgment, the matching degree between the draft sequence and content generation requirements can be ensured while reducing the computational waste caused by invalid expansion, thereby improving the effectiveness of draft word expansion and ultimately improving content generation performance.

[0042] Please see Figure 3 , Figure 3 This is a flowchart illustrating another embodiment of the reasoning method for the content of this application.

[0043] The following provides examples illustrating the detailed working principle of constructing dynamic lexical topology to filter scalable draft sequences and draft lexical units.

[0044] Speculative reasoning can accelerate inference by leveraging the collaborative work of a content draft model and a content generation model. Specifically, draft lexical units and / or draft sequences can be obtained through rapid draft reasoning using a lightweight model, namely the content draft model. The content draft model, as a lightweight inference carrier, can undertake draft reasoning tasks, continuously generating candidate lexical sequences at a high efficiency, which serve as candidate sequences in this embodiment and are used as the reasoning drafts to be verified.

[0045] The content generation model can perform batch validation of candidate terms output by the draft model, and adopt the validated candidate terms and incorporate them into the final generated content. The content draft model can then perform further reasoning based on the newly generated content from the content generation model, thus realizing a back-and-forth working process between the content draft model and the content generation model.

[0046] In this embodiment, the generated sentences already generated by the content generation model can be obtained. The last lexical unit of the generated sentence is extracted as the target source lexical unit to obtain the target source lexical unit. The generated sentence can be constructed by the content generation model based on candidate lexical units that have undergone prior applicability verification. It can adapt to various content generation scenarios such as text continuation, intelligent dialogue, and information summarization. The target source lexical unit can be considered to carry the semantic expression, contextual logic, and linguistic style features of the completed portion. Extracting the last lexical unit of the generated sentence as the target source lexical unit ensures accurate acquisition of the target source lexical unit; the last lexical unit in the sentence is extracted as the target source lexical unit. Simultaneously, the target source lexical unit can also be used along with historical information as input to the content draft model, allowing the content draft model to integrate the target source lexical unit and historical information during the reasoning process of draft lexical units, thereby improving the reliability of the draft lexical units. For special cases such as polysemous words and ambiguous words, semantic disambiguation can be performed by combining the context of the generated sentences. This helps ensure that the target source word can accurately inherit the semantic context and expression direction of the existing sentences, providing a coherent and clear contextual anchor for the reasoning of subsequent draft word elements, and reducing the problem of semantic breaks and logical disconnects between subsequent extended content and existing sentences from the source.

[0047] Based on the extracted target source lexical units, the draft lexical units connected to the target source lexical units can be inferred to obtain the draft sequence.

[0048] Specifically, relying on pre-set multi-dimensional semantic association rules, contextual logic connection models, or the word association ability learned by large models pre-trained with large-scale general corpora and scenario-based corpora, one or more draft word units that are highly semantically matched, logically coherent, and conform to the pre-set generation target can be inferred.

[0049] Furthermore, the final word units of the draft sequence can be obtained, and the sequence of words preceding the final word unit is used as the evaluation sequence. The final word unit can be considered the last valid semantic word unit in the draft sequence, and the complete sequence formed by all the node words preceding the final word unit in their original semantic order is used as the evaluation sequence. By separately isolating the final word unit and focusing on the evaluation sequence for analysis, the stability, logical integrity, and fit with the preset generation target of the evaluation sequence itself can be accurately located. This effectively reduces the interference of semantic fluctuations or adaptation deviations of individual final word units on the overall value assessment, providing a standardized and targeted evaluation object for subsequent accurate two-factor prediction, thus improving the objectivity and accuracy of the value assessment.

[0050] Initiating a two-factor prediction process allows for the prediction of both the first and second factors. The first factor represents the probability that the content generation model will use each evaluation sequence, while the second factor represents the probability that the content generation model will use terminal words.

[0051] In other words, the first factor refers to the probability that the content generation model will adopt each evaluation sequence. Specifically, it reflects the degree to which the evaluation sequence meets the content generation model's generation preferences and the preset task requirements in terms of semantic completeness, logical rationality, and consistency of language style. For example, the first factor can be calculated by a preset probability prediction sub-model. This sub-model can be trained on a large-scale annotated corpus that covers text data of different scenarios and types. During training, it focuses on learning features such as the frequency of adoption, semantic fit, and syntactic rationality of similar semantic sequences. During prediction, it extracts the semantic and logical features of the evaluation sequence and compares them with the feature library obtained by the model training. Finally, it can output a probability value within a reasonable range. The higher the probability, the greater the likelihood that the evaluation sequence will be adopted by the content generation model, which can help improve the reference value of factor prediction.

[0052] The second factor refers to the probability of terminal words in the content generation model. Its core characterization is the semantic fit and syntactic coherence of the terminal words with the evaluation sequence, as well as the terminal words' support and compatibility for subsequent content expansion. For example, the second factor is also calculated using the aforementioned probability prediction sub-model. The calculation process focuses on combining word dependency analysis and contextual fit detection, while also referencing the semantic association strength between the terminal words and the evaluation sequence. It quantifies the overall semantic fluency formed after the terminal words are integrated into the evaluation sequence, and can also output probability values ​​within a reasonable range, providing accurate quantitative basis for subsequent value fitting.

[0053] Optionally, this embodiment can utilize the evaluation sequence and the adoption probability of the final term in the content draft model. The evaluation sequence and the adoption probability of the final term output by the content draft model are used as the first and second factors. That is, by utilizing the evaluation sequence and the adoption probability of the final term already evaluated by the content draft model, additional computational burden can be reduced, thus optimizing the allocation of computing resources. The content draft model can evaluate the adoption probability based on a multi-dimensional evaluation process including semantic association analysis, logical consistency verification, and context fit detection, outputting the adoption probability of the evaluation sequence and the fit probability of the final term. The adoption probability of the evaluation sequence can be directly used as the first factor, and the fit probability of the final term and the evaluation sequence can be used as the second factor. This approach not only reduces the number of model calls and redundant calculations, significantly controlling computing resource consumption and improving overall processing efficiency, but also ensures that the factor data and the evaluation logic of the content draft model remain highly consistent, reducing errors caused by cross-model calculations, further improving the accuracy and reliability of subsequent value fitting, and thus contributing to improved computational efficiency in the content draft generation process.

[0054] The estimated value is obtained by fitting the first and second factors to predict the estimated value of the content generation model using the draft sequence. In response to the estimated value reaching a value threshold, new draft terms can be added to the draft sequence to update it. In response to the estimated value not reaching the value threshold, adding new draft terms to the draft sequence can be stopped.

[0055] Optionally, when evaluating the adoption probability of the evaluation sequence and the terminal word element using the content draft model, historical information carried by the target source word element can be obtained. Based on at least one of the target source word element, historical information, and a preset probability evaluation function, a probability evaluation algorithm is formed, and the adoption probability of the evaluation sequence and the terminal word element is evaluated using the probability evaluation algorithm. The historical information may include the content draft model's historically generated draft word elements and the adoption status of historically generated draft word elements by the content generation model.

[0056] Thus, in the process of evaluating the probability of content draft model adoption, the target source words and historical information can be utilized. Simultaneously, at least one of the target source words, historical information, and preset probability evaluation functions can be flexibly combined to construct the probability evaluation algorithm in this embodiment. This improves the effectiveness of the evaluation information based on the probability of adoption of the evaluation sequence and terminal words, and also helps to improve the matching between the semantics and probabilistic decisions of actual reasoning. Therefore, it helps to improve the accuracy, rationality, and reliability of the evaluation results, and improves the efficiency of draft word reasoning and evaluation. Furthermore, the flexible selection of target source words, historical information, and preset probabilities gives the probability evaluation algorithm design flexibility. It can be flexibly constructed according to different draft models, target model application scenarios, and actual evaluation needs in actual application scenarios, further improving the generalizability of the content reasoning method in this embodiment, so as to adapt to diverse reasoning implementation scenarios.

[0057] Furthermore, this embodiment can construct a dynamic lexical topology. The semantic association paths, hierarchical relationships, and association strengths between lexical units can be visualized through the topological structure, effectively improving the logic, traceability, and manageability of draft sequence construction and iterative expansion. It also supports multi-path lexical expansion and facilitates lexical sequence control in complex semantic scenarios. In simpler terms, the lexical topology can be selectively visualized according to user needs, allowing users to clearly understand the reasoning process of the content draft model. Simultaneously, the estimated value of the draft sequence / draft lexical units can be displayed, enhancing the interpretability of the content reasoning model.

[0058] Specifically, it infers one or more draft words connected to the target source word. A dynamic word topology is constructed using the target source word as the root node and draft words as child nodes. Draft words that serve as terminal words are selected, and a draft sequence is constructed along the node words of the topological path from the target source word to the terminal word. The node words include both terminal words and draft words.

[0059] Thus, when expanding the draft sequence with new draft lexes to update the draft sequence, the current topological depth and the current number of nodes of the dynamic lexical topology can be obtained.

[0060] Determine if the estimated value of the draft sequence reaches the value threshold. Determine if the current topology depth reaches the depth threshold. Determine if the current number of nodes reaches the number threshold.

[0061] If the estimated value of the draft sequence fails to reach the value threshold and / or the current topology depth reaches the depth threshold and / or the current number of nodes reaches the number threshold, the dynamic lexical topology is determined not to meet the preset expansion conditions, and the expansion of draft lexical units is terminated. Otherwise, the dynamic lexical topology is determined to meet the preset expansion conditions, and the new draft lexical unit connected to the extended terminal lexical unit is used as a child node of the terminal lexical unit and updated to the dynamic lexical topology.

[0062] In other words, when expanding the draft sequence with new draft words to update the draft sequence, the current topological depth and current number of nodes of the dynamic word topology can be obtained simultaneously. Combined with the estimated value of the prediction mentioned above, a multi-judgment system can be constructed to achieve precise control over the topology expansion.

[0063] The current topology depth is the path length from the root node to the deepest child node. It can be considered to directly reflect the number of semantic expansion levels. It can be flexibly set according to the semantic depth requirements of content generation. A shallower depth can be set for short sentence continuation scenarios, while a deeper depth can be appropriately increased for long text creation scenarios. The current number of nodes is the total number of all root nodes and child nodes in the topology structure. It intuitively reflects the breadth of word association. It needs to be set comprehensively in combination with the computing power capacity and content generation efficiency requirements. This can reduce the risk of topology redundancy and a surge in computational complexity caused by too many nodes.

[0064] Simultaneously, the above three judgment operations are performed to determine whether the estimated value of the draft sequence reaches a preset value threshold, whether the current topology depth reaches a preset depth threshold, and whether the current number of nodes reaches a preset number threshold. The value threshold is derived from a large amount of experimental data and optimized in combination with the performance indicators of different content generation tasks; the depth threshold can be dynamically adjusted according to the length of the target generated content and the semantic level requirements, and can also be fine-tuned in combination with the real-time semantic expansion effect to reduce the situation where the semantics gradually deviate from the core target due to excessive topology depth; the number threshold needs to be adapted to the real-time load of computing resources. When the computing load is high, the threshold can be appropriately reduced to prioritize processing efficiency, and when computing power is sufficient, the threshold can be increased to pursue the richness of semantic expansion.

[0065] If any one of the following conditions is met—that is, the estimated value does not reach the value threshold, the current topology depth reaches the depth threshold, or the current number of nodes reaches the quantity threshold—the dynamic lexical topology is determined not to meet the preset expansion conditions, and the expansion operation of draft lexical units is immediately stopped. After stopping, the draft sequence in the current topology structure can be retained as input material for subsequent content generation models, reducing the consumption of computing resources or semantic deviation caused by valueless expansion. If none of the three conditions are met, the dynamic lexical topology is determined to meet the preset expansion conditions. Based on the semantic features and contextual logic of the current terminal lexical unit, multiple new draft lexical units connected to it are generated through semantic reasoning. After preliminary screening using the estimated value, new draft lexical units with sufficient semantic association strength and no duplication or redundancy are selected as child nodes of the current terminal lexical unit and added to the dynamic lexical topology. After addition, the topology depth and number of nodes are updated synchronously, and the draft sequence is reconstructed along the topological path from the target source lexical unit to the new terminal lexical unit, completing the iterative optimization of the draft sequence. This provides a high-quality semantic material foundation for subsequent content generation, which helps improve the quality and efficiency of the final content generation.

[0066] Taking a dynamic token topology as a tree structure as an example, the dynamic token topology can be a dynamic token tree. The token tree is a tree-like data structure, where the root node corresponds to the last token in the currently generated context, i.e., the target source token. Each non-root node represents a candidate token that may be generated, and the path from the root node to any node constitutes a sequence of candidate tokens. To quantify each node, this embodiment defines its estimated value V(u). The estimated value of a draft token represents the expected value of the number of adopted tokens that can be contributed to the entire tree from that draft node.

[0067] For a node term u, its probability Pv(u) of being validated by the content generation model depends on the probability ∏Pt(ai) that all its ancestor nodes ai, i.e., the evaluation sequences, are adopted, and the conditional probability Pt(u) that node term u itself is adopted. It should be noted that "adoption" here can refer to the content generation model using the draft terms corresponding to the node term to construct the generated sentence, or it can refer to the content generation model accepting the draft terms as candidate terms for validation when validating them; no strict limitation is imposed here.

[0068] Since the target model probability Pt(·) is difficult to obtain during the construction phase, this embodiment uses the draft model output probability Pd(·) for approximation, i.e., Pt(x) / Pd(x)≈1; where x represents the variable, i.e., the node word u. Therefore, the contribution of the node word u to the total expectation, i.e., the estimated value V(u), is: V(u)=∏Pd(ai)×Pd(u) Equation 1-1 Where ∏Pd(ai) represents the adoption probability of the evaluation sequence in the content draft model evaluation; Pd(u) represents the adoption probability of the terminal word, i.e., the node word u, in the content draft model evaluation.

[0069] In other words, the estimated value of the draft sequence and draft resources can be calculated recursively, and the estimated value of the selected node tokens monotonically decreases during the token tree expansion process. Meanwhile, this embodiment can constrain the token tree through a value threshold Ct to prevent it from expanding indefinitely.

[0070] The value threshold Ct can be used to dynamically construct hierarchical and batch token trees.

[0071] In detail, for all scalable node tokens in the current layer of the token tree—that is, node tokens whose estimated value reaches the value threshold Ct—the complete probability distribution of their next token can be obtained all at once. The estimated value of potential child nodes can be calculated to retain node tokens with an estimated value greater than or equal to Ct, forming the next layer. Furthermore, the construction process is value-driven; it can be set to continue until the estimated value of all node tokens is less than Ct, or the depth of the token tree exceeds the depth threshold D, or the total number of nodes in the tree reaches the quantity threshold m. Thus, the hierarchical batch strategy in this embodiment can significantly improve engineering efficiency, reducing the number of times the draft model is called compared to traditional node-by-node expansion, significantly reducing computational overhead, and fully utilizing parallel computing capabilities.

[0072] The following example illustrates the working principle of dynamic assessment value thresholds.

[0073] In this embodiment, a value baseline can be obtained. The value gain associated with the quality of the draft lexical units is dynamically evaluated, and a dynamic value threshold is obtained by fitting the value baseline and the value gain.

[0074] The value baseline can be considered a pre-set benchmark value based on historical high-quality draft sequences and the performance requirements of different content generation tasks. It provides a stable reference basis for generating dynamic value thresholds, and its value can be iteratively optimized based on historical data from different scenarios such as text continuation and intelligent dialogue. The value gain associated with the quality of draft words can be dynamically evaluated. Value gain is a dynamic variable reflecting the degree to which the quality of real-time draft words affects the sequence value. Its evaluation dimensions can cover at least one of the semantic adaptability, logical coherence, and extensibility support of words. A pre-set weighted fitting algorithm can be used to fit the value baseline and value gain to obtain a dynamic value threshold. The dynamic value threshold can adapt to the evaluation needs of draft words of different qualities, offering greater flexibility than a fixed threshold and improving the accuracy of draft sequence expansion decisions.

[0075] Optionally, the value gain may include a first gain and / or a second gain. The first gain focuses on reflecting the impact of the structural features of the dynamic lexical topology on the sequence value, while the second gain focuses on reflecting the impact of the real-time adoption probability of draft lexical units on the sequence value. The two can be used alone or in combination for the dynamic adjustment of the value threshold.

[0076] The following provides examples illustrating the detailed evaluation principles of the first and second gains.

[0077] When evaluating the first gain, a dynamic lexical topology constructed from the target source lexical and draft lexical can be obtained. The current topology depth and current branch density of the dynamic lexical topology are identified. The first gain is generated using the current topology depth and current branch density. The first gain is negatively correlated with the current topology depth and positively correlated with the current branch density.

[0078] In other words, as described above, dynamic lexical topology can be a structural carrier that holds semantic association paths and hierarchical relationships among lexical units. The current topological depth and current branch density of the dynamic lexical topology can be identified. The current topological depth is the path length from the root node to the deepest child node, intuitively reflecting the number of semantic expansion levels. The current branch density is the distribution of the number of nodes at the same level in the topological structure, intuitively reflecting the richness of lexical expansion directions. The current topological depth and current branch density can be used to generate a first gain. The first gain is negatively correlated with the current topological depth; a larger topological depth indicates more semantic expansion levels and a higher probability of semantic deviation from the core objective, corresponding to a lower first gain. The first gain is positively correlated with the current branch density; a larger branch density indicates richer lexical expansion directions and a wider selection space for subsequent content generation, corresponding to a higher first gain.

[0079] Thus, by quantifying the first gain based on the structural features of dynamic lexical topology, the influence of topological depth and branch density on the value of the draft sequence can be fully utilized, exhibiting significant technical advantages. On one hand, setting the current topological depth and the first gain to a negative correlation can suppress semantic deviation caused by excessive extension of the topological structure, avoiding the disconnect between the draft sequence and the target generated content due to excessive depth, and ensuring the stability of the sequence's semantic framework. Simultaneously, setting the current branch density and the first gain to a positive correlation can incentivize the topological structure to form multi-directional lexical expansion paths, enriching the semantic dimension of the draft sequence and expanding the selection space provided for subsequent content generation. Furthermore, compared to the subjective experience-based judgment mode of traditional gain generation, this embodiment can achieve accurate quantification of the first gain based on the objective parameters of the topological structure, providing scientific and reliable parameter support for fitting the dynamic value threshold, thereby improving the rationality and accuracy of draft sequence expansion decisions, reducing the waste of computational resources caused by valueless expansion, and ensuring the overall quality of the draft sequence from a structural perspective.

[0080] Optionally, the current branch density can include the current number of branches. The current number of branches can be the total number of child nodes under the same parent node in the dynamic lexical topology, which can be used as a quantitative indicator to measure branch density.

[0081] If so, the branch adjustment coefficient and depth adjustment coefficient can be obtained. The branch factor is obtained by fitting the branch adjustment coefficient to the current number of branches. The depth factor is obtained by fitting the depth adjustment coefficient to the current topology depth. The first gain is obtained by superimposing the preset standard value with the branch factor and subtracting the depth factor, thus utilizing the current topology depth and current branch density to generate the first gain.

[0082] In this embodiment, two types of adjustment coefficients—branch adjustment coefficient and depth adjustment coefficient—are preset calibration parameters based on the performance requirements of different content generation scenarios. These coefficients can be dynamically adjusted according to factors such as text length and semantic complexity to balance the influence weights of topology depth and branch number on the first gain. A branch factor can be obtained by fitting the branch adjustment coefficient and the current branch number using a linear fitting algorithm. The branch factor quantifies the positive contribution of the branch number to the first gain. Similarly, a depth factor can be obtained by fitting the depth adjustment coefficient and the current topology depth using a linear fitting algorithm. The depth factor quantifies the negative influence of topology depth on the first gain. The first gain can be obtained by superimposing the branch factor on a preset standard value and subtracting the depth factor, thus generating the first gain using the current topology depth and current branch density. The preset standard value is a benchmark reference value calibrated based on a large amount of experimental data, ensuring that the quantitative evaluation of the first gain is within a reasonable range and improving the matching degree between the first gain and the topological structure features.

[0083] When evaluating the second gain, the adoption probability of draft terms can be assessed. The second gain is then dynamically updated using the adoption probability. Specifically, the second gain is reduced when the adoption probability increases and increased when the adoption probability decreases.

[0084] The adoption probability can be used as an indicator of the likelihood that draft words will be included in the final generated sentence, based on semantic adaptability detection output by the content generation model or content draft model. Its evaluation process combines dimensions such as the fit between words and the target generated content, and the coherence of the contextual logic. The adoption probability can be used to dynamically update the second gain, adjusting the filtering intensity of the balance threshold. A high adoption probability indicates high-quality words; reducing the gain can prevent the threshold from being too high, leading to the misjudgment and rejection of high-quality words. A low adoption probability indicates that word quality needs optimization; increasing the gain can raise the threshold to achieve stricter filtering.

[0085] For example, the target probability of adopting the draft term can be obtained. The ratio of the adoption probability to the target probability is used as the adoption factor. The difference between the doubled standard value and the adoption factor is used as the second gain.

[0086] The target probability serves as a pre-defined benchmark for draft lexical adoption across different content generation tasks, providing a reference for evaluating deviations in adoption probability. The ratio of the adoption probability to the target probability can be used as an adoption factor, quantifying the deviation between the actual and target probabilities and directly reflecting the quality of the draft lexical units. The difference between double the standard value and the adoption factor can be used as a second gain. This double standard value is a calibration benchmark proportional to the pre-defined standard value, ensuring consistency with the evaluation benchmark of the first gain. This difference calculation method allows the second gain to dynamically adjust with changes in the adoption factor, enhancing its sensitivity to changes in draft lexical quality.

[0087] Optionally, the standard value in this embodiment can be 1. Taking this as an example, the specific calculation formula for the value threshold Ct in this embodiment can be represented by the following formula: Ct = Cb × fs × fa Equation 2-1 Where Cb represents the value base value, which can be considered as a basic threshold. For example, Cb can be set to 1 / m; fs represents the first gain, which can be considered as a structure-aware factor that can dynamically adjust the threshold according to the current token tree depth and branch density; fa represents the second gain, which can be considered as an acceptance rate-aware factor that adjusts the threshold based on the historical acceptance rate within the sliding window, i.e., the probability rt (such as the average of the last 3-10 steps) and the target acceptance rate, i.e., the target probability rf (such as 0.65).

[0088] For example, adjusting the value threshold using fs can be manifested as follows: when the token tree is shallow and densely branched, the threshold can be increased to focus on high-quality paths; when the token tree is deep but sparsely branched, the threshold can be decreased to encourage depth continuation. The specific calculation formula for fs can be represented by the following example: fs=1+β*B-γ*D Equation 2-2 B represents the current number of branches, D represents the current topology depth, β represents the branch adjustment coefficient, and γ represents the depth adjustment coefficient.

[0089] Adjusting the value threshold using fs can be manifested as follows: when the acceptance rate is high (rt > rf), set fa < 1 to lower the threshold and actively expand the token tree; when the acceptance rate is low (rt < rf), set fa > 1 to raise the threshold and conservatively shrink the expansion of the token tree. The specific formula for calculating fa can be illustrated by the following example: fa = 2 - rt / rf (Equation 2-3) In this embodiment, the content generation system is better equipped to have context-aware capabilities. For example, in code completion tasks, the language is highly structured, the draft model has high prediction accuracy, and the historical acceptance rate (rt) often exceeds 0.8. At this point, fa ≈ 0.77, and Ct is significantly lower than Cb. The content generation system tends to expand the tree to be deeper and wider to capture long-range dependencies. However, in open-ended story generation, if the acceptance rate drops below 0.4 for several consecutive steps, fa rises above 1.38, and Ct automatically increases, the content generation system quickly shrinks the search space, reducing the waste of computing power on low-quality branches. This helps to adapt to the variance of acceptance rates between different tasks and improves the robustness of the system.

[0090] The following example illustrates the detailed working principle of the balance processing in this embodiment.

[0091] In this embodiment, a probability base value can be obtained. The draft gain, which matches the probability of the draft lexicon, is evaluated. The draft gain, assigned to the probability base value, is used to obtain the exploration probability.

[0092] The probability baseline value can be considered as a preset benchmark probability parameter based on historical exploration data and the characteristics of content generation tasks. It provides a stable foundation for generating exploration probabilities, and its value can be dynamically calibrated according to the exploration needs of different scenarios, balancing the need to explore new nodes with ensuring sequence quality. The draft gain, which matches the adoption probability with the draft lexicon, can be evaluated. The draft gain is a dynamically adjustable variable for the draft lexicon, capable of adapting to real-time changes in adoption probability for precise control and dynamic optimization of the exploration probability. The exploration probability is obtained by assigning the probability baseline value and draft gain through a preset algorithm. Using this exploration probability helps to dynamically adapt the quality of draft lexicons, reasonably optimize the exploration frequency of high-quality potential nodes, and improve the reliability of exploration decisions.

[0093] You can also filter draft words as candidate nodes according to preset filtering conditions.

[0094] Optionally, the screening process can be performed simultaneously with the structural features of the dynamic lexical topology and the lexical quality assessment results to ensure the suitability of the candidate nodes. For example, preset screening conditions may include the estimated value of a draft lexical being higher than the estimated value of other draft lexicals of the target number, and the estimated value of a draft lexical being lower than a value threshold. This helps ensure that candidate nodes have a certain basic value and advantage, reducing the inclusion of meaningless low-quality lexicals; limiting the exploration scope by restricting the estimated value of draft lexicals to below the value threshold reduces repeated exploration of lexicals that have already reached high-value standards, focusing on nodes with improvement potential but not yet meeting the standard, which is conducive to the precise allocation of resources.

[0095] This allows for the selection of a candidate node as an exploration node based on an exploration probability, thus identifying draft terms for the exploration node. In other words, a candidate node can be randomly selected from the candidate nodes based on the generated exploration probability, thereby determining the draft terms for the exploration node. By balancing the randomness and specificity of the exploration through probabilistic control, the limitations of fixed selection can be overcome, potential high-quality expansion directions can be discovered, and the probability of low-value nodes being selected can be reduced by dynamically adjusting the exploration probability, thus balancing the exploratory nature and stability of the technical solution.

[0096] Furthermore, the estimated value of the exploration node can be taken as the draft sequence value of the terminal word, and then used as the estimated value of the exploration node. A positive gain is assigned to the estimated value of the exploration node. In other words, the estimated value of the draft sequence corresponding to the terminal word can be directly used as the initial estimated value of the exploration node, ensuring that the value assessment of the exploration node is consistent with the value of the corresponding sequence, and guaranteeing the uniformity of the assessment benchmark. At the same time, assigning a positive gain to the estimated value of the exploration node strengthens the value weight of high-quality exploration nodes through positive incentives, encouraging further expansion and optimization of such nodes, and guiding the model to more accurately identify potential exploration directions, thereby improving the efficiency and quality of the overall sequence iteration.

[0097] For example, the estimated value of an exploration node can be obtained as the value to be adjusted. This value is then superimposed on a preset gain value to update the estimated value of the exploration node. The preset gain value is a fixed or dynamic value based on content generation scenario requirements and historical exploration effect statistical calibration, adaptable to gain requirements in different scenarios. Superimposing the value to be adjusted on the preset gain value to update the estimated value of the exploration node improves the simplicity and traceability of the positive gain operation of the exploration node's estimated value, enabling rapid positive adjustment of the exploration node's value while ensuring the controllability of the adjustment process.

[0098] Optionally, the adoption probability of draft words within the current sliding period can be obtained. Here, the current sliding period represents the time between the current moment and its adjacent forward preset duration.

[0099] It can also obtain the target probability of the expected adoption of draft words and obtain the probability adjustment coefficient. The difference between the adoption probability and the target probability is fitted with the probability adjustment coefficient to obtain the draft gain, so as to evaluate the draft gain that matches the adoption probability of the draft words.

[0100] In other words, the adoption probability of draft words within the current sliding period can be obtained, reflecting the actual adoption of draft words in recent times and reducing the interference of probability fluctuations at a single moment on the evaluation results. The current sliding period represents the time interval between the current moment and its adjacent forward preset duration. The preset duration can be dynamically set according to the real-time requirements of content generation and data update frequency, ensuring sufficient sample data to guarantee evaluation reliability while avoiding evaluation bias caused by historical data lag. Simultaneously, the target probability of expected draft words is obtained. The target probability is a preset ideal adoption probability benchmark for the current task scenario, providing a reference for bias calculation. The probability adjustment coefficient can be considered a calibration parameter preset based on scenario characteristics and probability fluctuation sensitivity, which can adjust the impact of probability deviation on draft gain, reducing the risk of gain imbalance caused by excessive or insufficient deviation. By using preset algorithms such as linear fitting, the difference between the adoption probability and the target probability can be fitted and calculated with the probability adjustment coefficient to obtain the draft gain that accurately matches the current adoption probability. This allows for the evaluation of the draft gain that matches the adoption probability of the draft words, ensuring that the draft gain can accurately reflect the deviation of the adoption probability, and serving as a basis for exploring the dynamic optimization of the probability.

[0101] It can be seen that traditional operational expansion strategies may miss paths with high long-term returns due to short-sightedness. This embodiment introduces controlled exploration. When selecting a node, a node is randomly selected as an exploration node from the top K% (e.g., top 30%) of nodes in the queue with probability e. The exploration node is not restricted by the value threshold Ct, and the estimated value of the exploration node is always less than Ct. To prevent exploration nodes from having no children, a reward can be assigned to the exploration node: Va = Vo + t (Equation 3-1) Where Va represents the estimated value of the exploration node after adjustment; Vo represents the estimated value of the exploration node before adjustment, which is the initial predicted estimated value, i.e., the value to be adjusted; and t represents the gain value, which can be considered as the reward value of the exploration node. Meanwhile, to reduce the possibility of unlimited expansion of exploration nodes, subsequent child nodes of an exploration node can be prevented from becoming exploration nodes again.

[0102] The exploration probability e can be a fixed value that is preset or pre-evaluated; or it can be adaptively adjusted according to the current decoding state, as illustrated below.

[0103] When the recent acceptance rate (rf) is lower than the target response rate (rt), increase e to encourage further exploration to find new effective paths. When rt is high, decrease e so that the content generation system can focus on utilizing the current optimal path. The specific formula for calculating e can be illustrated by the following example: e = eb + λ × (rt - rf) Equation 3-2 Where eb represents the probability base value; λ×(rt-rf) represents the draft gain; and λ represents the probability adjustment coefficient. This effectively mitigates the problem of early misjudgment. For example, the draft probability of the first two tokens of a certain path may be slightly lower than that of other branches, but there is a high possibility of strong subsequent semantic coherence. If they are abandoned too early, it may affect the efficiency of content generation. Through the exploration mechanism, the path can still be tried with a probability of about 5%-10%. Once it is successfully verified, it can bring multiple consecutive highly acceptable tokens, significantly improving the performance of content generation.

[0104] Therefore, this embodiment considers that in traditional speculative reasoning, guessing a fixed number of one or more tokens at each position results in a limited acceptance rate, making it difficult to demonstrate an acceleration effect. To address this, in this embodiment, the content draft model, during the draft reasoning stage, can dynamically decide, for example, to guess multiple possible branches each time to dynamically update the tree structure, prioritizing the expansion of high-probability branches, based on the probability distribution output by the draft model. At each node of the tree, all possible expansion branches (i.e., the next possible token) can be evaluated, and one or more paths with the highest probability and the greatest likelihood of acceptance are selected for priority expansion, and computational resources are allocated to generate branches. Furthermore, dynamic thresholds ensure the algorithm remains efficient under different text types and generation lengths, and an exploration mechanism ensures the discovery of potential high-value generation paths, reducing the risk of local optima. Tree optimization can ensure that computational resources are concentrated in the relatively existing and desirable search space, thereby improving the performance of the content generation system during the decoding stage.

[0105] In summary, this embodiment transforms speculative decoding from a passive and static guessing and verification process into an active and dynamic planning, exploration, and utilization process. By reducing reliance on fixed token chains or pre-defined static tree structures, each round of decoding can be viewed as an optimal action sequence planning problem with limited resources. Within the given computational resources of the content draft model, candidate tokens are selectively generated, increasing the expected number of tokens accepted by the content generation model. A continuously evolving dynamic token tree construction mechanism, guided by the adoption probability evaluated by the content draft model, allows the dynamic token tree to adjust its topology in real time during content generation based on the expected returns of each path, prioritizing computational resources for semantic paths with a higher probability of generating high acceptance rates.

[0106] The embodiments of this application provide a content generation method, and the method is described in detail below in conjunction with the execution flow of the content generation method.

[0107] Please see Figure 4 , Figure 4 This is a flowchart illustrating an embodiment of the method for generating content for this application.

[0108] S201: The content generation model obtains draft lexical units generated by the content draft model as candidate lexical units; wherein, the draft lexical units are generated by the content draft model using the content reasoning method.

[0109] In this embodiment, the content generation model can receive the draft word data stream output by the content draft model through a preset data interaction interface. Draft words are not randomly generated ordinary language units, but rather high-quality words obtained by the content draft model using the content reasoning method described above. These words undergo processes such as target source word extraction and disambiguation, draft sequence construction and iteration, multi-dimensional value assessment and screening, and dynamic word topology optimization and expansion. They can be considered semantically coherent and relatively consistent with the target generated content. Furthermore, through screening methods such as the value threshold and topological structure described in the previous embodiment, relatively low-value and irrelevant redundant words can be considered to have been eliminated. By acquiring the screened draft words as candidate words, the content generation model can reduce the initial filtering process of massive words, effectively reducing the data processing pressure and computational consumption of the content generation model. Simultaneously, it ensures the matching degree between candidate words and content generation requirements from the source, which is conducive to the efficient advancement of subsequent sentence construction work and lays a high-quality material foundation for the output of high-quality generated sentences.

[0110] Optionally, the content generation model can also filter invalid or formatted data that occurs during transmission based on a data verification mechanism, ensuring the integrity and validity of candidate lexical units, and determining the draft lexical units that pass the verification as candidate lexical units for content generation.

[0111] S202: The content generation model verifies whether candidate terms are suitable for generating sentences.

[0112] In this embodiment, the content generation model verifies whether the candidate lexical units match the lexical units it infers and generates.

[0113] S203: In response to determining that candidate nominatives are suitable for generating sentences, candidate nominatives are used to participate in the construction of generating sentences.

[0114] In this embodiment, after the content generation model completes the applicability verification of candidate lexical units, if it determines that the candidate lexical unit is suitable for generating sentences, then the candidate lexical unit is formally included in the sentence construction process.

[0115] Optionally, when generating draft lexical units or draft sequences using the draft model as described above, the draft model may include one or more draft models. That is, a single draft model can be used to infer draft lexical units and draft sequences, or multiple draft models can be used for content inference to obtain draft lexical units and draft sequences. The following section elaborates on the specific working principle of using multiple draft models for assisted content inference.

[0116] In this embodiment, the current word sequence can be obtained; wherein, the current word sequence originates from the generated statement, and the generated statement is the generated statement generated by the content generation model.

[0117] The current word sequence is input into a label classifier, which identifies the preset scene label to which the current word sequence belongs. For example, the label classifier can use a fast text embedding model or a simple multilayer perceptron to reduce the computational cost of selecting preset scene labels.

[0118] Optionally, the number of preset scene tags to which the current word sequence belongs can be one or more. It is possible to default that the current word sequence belongs to one preset scene tag; or it is possible to allow the current word sequence to have multiple preset scene tags; or it is possible to adaptively determine the number of preset scene tags to which the current word sequence belongs by combining the probability of the current word sequence belonging to each preset scene tag, which is not limited here.

[0119] Taking the number of preset scene tags to which the current word sequence belongs as one as an example, the preset scene tags to which it belongs are used as the target scene tags of the current word sequence; wherein, the preset scene tags include at least one of the following: code generation tag, mathematical reasoning tag, general dialogue tag, creative writing tag, and knowledge question answering tag.

[0120] The self-inference model library calls the preset draft model corresponding to the target scene label as the target draft model, inputs the target source words into the target draft model, and uses the target draft model to infer a draft sequence. Each preset draft model can be considered as an "expert" model with advantages in a specific domain. This can improve the matching degree between the formed draft sequence and the draft words with the specific scene, further improving the inference accuracy and adoption probability of the draft words.

[0121] In response to the number of consecutive rejections of the draft sequence generated by the target draft model reaching a threshold, a new target scene label is re-evaluated, and a new target draft model matching the new target scene label is invoked to infer the draft sequence.

[0122] For example, when the target scene label is a code generation label, a small code model that has been fine-tuned with code corpus is preferred, and its output distribution is highly aligned with the target large model in the code completion task; when the target scene label is a general dialogue label, a general dialogue small model can be selected to match the diverse needs of open domain chat; when the target scene label is a mathematical reasoning label, a dedicated model with numerical calculation and symbolic reasoning capabilities can be selected.

[0123] Furthermore, the target draft model selection does not need to be determined all at once at the start of decoding; it can support dynamic switching. In simpler terms, during long text generation, if the historical acceptance rate within the sliding window is lower than a preset acceptance rate threshold (e.g., 0.4) for three consecutive steps, it can be considered that the number of consecutive rejections of the draft sequence generated by the target draft model has reached a threshold. Therefore, the target scene label can be re-evaluated, and an attempt can be made to switch to another preset draft model as the target draft model. Furthermore, to reduce the overhead of frequent switching, an interval of at least 5 decoding steps can be maintained between two switches.

[0124] Optionally, when there are multiple preset scene tags to which the current word sequence belongs, that is, in response to the fact that there are multiple preset scene tags to which the current word sequence belongs, the multiple preset scene tags are used as a joint scene tag.

[0125] In this way, the pre-set draft model corresponding to the joint scene label can be used as the joint draft model. The joint draft model is used to generate draft candidate words and predict the probability distribution of the draft candidate words. The probability of the draft candidate words is weighted and fused with the weight of the joint draft model that predicts them. A dynamic draft word topology is constructed based on the weighted fusion result. A draft sequence is formed according to the draft word topology. By using multiple pre-set inference models, relatively optimal draft words and draft sequences that are suitable for multiple scenarios can be obtained, which can help to further improve the acceptance rate of draft words.

[0126] In simple terms, multiple joint draft models can generate their respective candidate token (lexical) probability distributions in parallel, and then merge them into a single joint distribution through weighted fusion, which serves as the basis for constructing the dynamic token tree. Multiple draft models simultaneously generate candidate token trees, and the probability distributions of each joint draft model are fused using weighted fusion. The specific formula for weighted fusion can be illustrated as follows: Pd_sum(x)=Σwi×Pd_i(x) Formula 4-1 Where wi is the weight of the i-th joint draft model, which can be dynamically adjusted according to the historical acceptance rate; i is a positive integer; Pd_i is the probability of the i-th joint draft model generating draft candidate words; Pd_sum is the probability after weighted summation of the joint draft models.

[0127] Through the above description of the embodiments, those skilled in the art can clearly understand that the content reasoning method and / or content generation method according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platform, and of course, it can also be implemented by hardware, which is not strictly limited here.

[0128] For a description of the features in the corresponding embodiments of the content generation system, please refer to the relevant descriptions of the content reasoning method and the corresponding embodiments of content generation, which will not be repeated here.

[0129] Embodiments of this application also provide an electronic device. See also... Figure 5 , Figure 5 This is a schematic diagram of the structure of an embodiment of the electronic device of this application.

[0130] In one embodiment, the electronic device includes a memory 21 and a processor 22. The memory 21 stores a computer program, and the processor 22 is configured to execute the computer program to implement the steps in any of the above-described content reasoning method embodiments, or to implement the steps in any of the above-described content generation method embodiments.

[0131] In other words, processor 22 is configured to execute a computer program that can at least achieve the following: acquiring target source lexical units; inferring draft lexical units connected to the target source lexical units to obtain a draft sequence; predicting the estimated value of the draft sequence used by the content generation model; and, in response to the estimated value reaching a value threshold, expanding the draft sequence with new draft lexical units to update the draft sequence. Alternatively, processor 22 is configured to execute a computer program that can at least achieve the following: the content generation model acquires draft lexical units generated by the content draft model as candidate lexical units; wherein the draft lexical units are generated by the content draft model using the content inference method as described in any of the above embodiments; the content generation model verifies whether the candidate lexical units are suitable for generating sentences; and, in response to determining that the candidate lexical units are suitable for generating sentences, uses the candidate lexical units to participate in the construction of the generated sentences.

[0132] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to implement the steps in any of the above-described content reasoning method embodiments, or to implement the steps in any of the above-described content generation method embodiments, when executed.

[0133] In other words, the computer program is configured to, upon execution, at least achieve the following: acquire target source lexical units; infer draft lexical units connecting the target source lexical units to obtain a draft sequence; predict the estimated value of the draft sequence using the content generation model; and, in response to the estimated value reaching a value threshold, expand the draft sequence with new draft lexical units to update the draft sequence. Alternatively, the computer program is configured to, upon execution, at least achieve the following: the content generation model acquires draft lexical units generated by the content draft model as candidate lexical units; wherein the draft lexical units are generated by the content draft model using the content inference method as described in any of the above embodiments; the content generation model verifies whether the candidate lexical units are suitable for generating sentences; and, in response to determining that the candidate lexical units are suitable for generating sentences, utilize the candidate lexical units to participate in the construction of the generated sentences.

[0134] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0135] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described content reasoning method embodiments, or implements the steps in any of the above-described content generation method embodiments.

[0136] In other words, when a computer program is executed by a processor, it can at least achieve the following: acquiring target source lexical units; reasoning about the draft lexical units connected to the target source lexical units to obtain a draft sequence; predicting the estimated value of the content generation model using the draft sequence; and, in response to the estimated value reaching a value threshold, expanding the draft sequence with new draft lexical units to update the draft sequence. Alternatively, when a computer program is executed by a processor, it can at least achieve the following: the content generation model acquires draft lexical units generated by the content draft model as candidate lexical units; wherein the draft lexical units are generated by the content draft model using the content reasoning method as described in any of the above embodiments; the content generation model verifies whether the candidate lexical units are suitable for generating sentences; and, in response to determining that the candidate lexical units are suitable for generating sentences, using the candidate lexical units to participate in the construction of the generated sentences.

[0137] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the steps in any of the above-described content reasoning method embodiments, or implements the steps in any of the above-described content generation method embodiments.

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

[0139] The foregoing has provided a detailed description of the content reasoning method, content generation method, electronic device, computer-readable storage medium, and computer program product provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only intended to help understand the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of this application.

Claims

1. A content reasoning method, characterized in that, The content reasoning method includes: Obtain the target source word elements; The draft sequence is obtained by reasoning through the connection of the target source lexical units with the draft lexical units. Obtain the terminal words of the draft sequence; use the word sequence before the terminal words as the evaluation sequence; predict a first factor and a second factor; wherein, the first factor represents the probability that the content generation model adopts each of the evaluation sequences, and the second factor represents the probability that the content generation model adopts the terminal words; fit the first factor and the second factor to obtain the estimated value; In response to the estimated value reaching a value threshold, new draft terms are added to the draft sequence to update the draft sequence.

2. The content reasoning method according to claim 1, characterized in that, The prediction first factor and the second factor include: The evaluation sequence and the adoption probability of the terminal word are evaluated using a content draft model; The evaluation sequence output by the content draft model and the adoption probability of the terminal word are used as the first factor and the second factor.

3. The content reasoning method according to claim 2, characterized in that, The evaluation of the evaluation sequence and the adoption probability of the terminal word using the content draft model includes: Obtain the historical information carried by the target source word; A probability evaluation algorithm is formed based on at least one of the target source word, the historical information, and a preset probability evaluation function; The probability evaluation algorithm is used to evaluate the evaluation sequence and the adoption probability of the terminal word.

4. The content reasoning method according to claim 1, characterized in that, The draft sequence obtained by inferring the target source lexical units includes: Infer one or more draft lexical units that connect to the target source lexical unit; A dynamic word topology is constructed using the target source word as the root node and the draft word as the child node. The draft word is selected as the terminal word, and the node word along the topological path from the target source word to the terminal word is used to construct the draft sequence; wherein the node word includes the terminal word and the draft word.

5. The content reasoning method according to claim 4, characterized in that, The step of expanding the draft sequence with new draft terms to update the draft sequence includes: Obtain the current topology depth and the current number of nodes of the dynamic word topology; Determine whether the estimated value of the draft sequence reaches the value threshold; determine whether the current topology depth reaches the depth threshold; determine whether the current number of nodes reaches the number threshold; If the estimated value of the draft sequence does not reach the value threshold and / or the current topology depth reaches the depth threshold and / or the current number of nodes reaches the number threshold, it is determined that the dynamic lexical topology does not meet the preset expansion conditions, and the expansion of the draft lexical is stopped; otherwise, it is determined that the dynamic lexical topology meets the preset expansion conditions, and the new draft lexical connected to the end lexical is expanded as a child node of the end lexical and updated to the dynamic lexical topology.

6. The content reasoning method according to claim 1, characterized in that, The content reasoning method also includes: Select the draft lexical units as exploration nodes; The estimated value of the draft sequence with the exploration node as the terminal word is used as the estimated value of the exploration node; The estimated value of the exploration node is given a positive gain.

7. The content reasoning method according to claim 6, characterized in that, The draft terms selected as exploration nodes include: Obtain the exploration probability; The draft words are selected as candidate nodes according to preset filtering conditions; The candidate node is selected as the exploration node based on the exploration probability.

8. The content reasoning method according to claim 7, characterized in that, The probability of obtaining exploration includes: Obtain a probability base value; evaluate the draft gain that matches the probability of the draft lexicon; assign the draft gain to the probability base value to obtain the exploration probability; and / or, Assigning a positive gain to the estimated value of the exploration node includes: obtaining the estimated value of the exploration node as a value to be adjusted; superimposing the value to be adjusted with a preset gain value to update the estimated value of the exploration node; and / or, The preset filtering conditions include: the estimated value of the draft word is higher than the estimated value of the target number of other draft words; the estimated value of the draft word is lower than the value threshold.

9. The content reasoning method according to claim 8, characterized in that, The evaluation of the draft gain, which is probability-matched with the draft lexical units, includes: Obtain the adoption probability of the draft word within the current sliding period; wherein, the current sliding period represents the time between the current moment and its adjacent forward preset duration; Obtain the target probability of using the draft lexical units; Obtain the probability adjustment coefficient; The draft gain is obtained by fitting the difference between the adoption probability and the target probability to the probability adjustment coefficient.

10. The content reasoning method according to claim 1, characterized in that, The response before the estimated value reaches the value threshold includes: Obtain the base value; Dynamically evaluate the value gain associated with the lexical quality of the draft lexical units; The value threshold is obtained by fitting the value base value and the value gain.

11. The content reasoning method according to claim 10, characterized in that, The value gain includes a first gain; the value gain of dynamically evaluating the correlation between the lexical quality of the draft lexical includes: Obtain the dynamic lexical topology constructed from the target source lexical and the draft lexical; Identify the current topology depth and current branch density of the dynamic lexical topology; The first gain is generated using the current topology depth and the current branch density; wherein the first gain is negatively correlated with the current topology depth and positively correlated with the current branch density.

12. The content reasoning method according to claim 11, characterized in that, The current branch density includes the current number of branches; generating the first gain using the current topology depth and the current branch density includes: Obtain the branch adjustment coefficient and the depth adjustment coefficient; The branch factor is obtained by fitting the branch adjustment coefficient to the current number of branches; The depth factor is obtained by fitting the depth adjustment coefficient to the current topological depth; The first gain is obtained by superimposing the preset standard value with the branch factor and subtracting the depth factor.

13. The content reasoning method according to claim 10, characterized in that, The value gain includes a second gain; the value gain associated with the dynamic evaluation of the lexical quality of the draft lexical includes: Evaluate the probability of adoption of the draft terms; The second gain is dynamically updated using the adoption probability; wherein, the second gain is reduced when the adoption probability increases, and the second gain is increased when the adoption probability decreases.

14. The content reasoning method according to claim 13, characterized in that, The step of dynamically updating the second gain using the probability includes: Obtain the target probability of using the draft lexical units; The ratio of the adoption probability to the target probability is used as the adoption factor; The difference between the doubled standard value and the adopted factor is taken as the second gain.

15. The content reasoning method according to claim 1, characterized in that, The acquisition of target source lexical units includes: acquiring the generated sentences already generated by the content generation model; extracting the end lexical units of the generated sentences as the target source lexical units; and / or, The draft sequence obtained by inferring the target source lexical units includes: Obtain the current word sequence; wherein the current word sequence originates from the generated statement; The current word sequence is input into a label classifier, and the label classifier is used to identify the preset scene label to which the current word sequence belongs, so as to serve as the target scene label of the current word sequence; wherein, the preset scene label includes at least one of code generation label, mathematical reasoning label, general dialogue label, creative writing label, and knowledge question answering label; The system calls the preset draft model corresponding to the target scene label from the draft model library as the target draft model, inputs the target source word into the target draft model, and uses the target draft model to infer the draft sequence. In response to the number of consecutive rejections of the draft sequence generated by the target draft model reaching a threshold, a new target scene label is re-evaluated, and a new target draft model matching the new target scene label is invoked to infer the draft sequence.

16. The content reasoning method according to claim 15, characterized in that, After identifying the preset scene label to which the current word sequence belongs using the label classifier, the method further includes: In response to the fact that there are multiple preset scene tags to which the current word sequence belongs, the multiple preset scene tags are used as a joint scene tag; The preset draft model corresponding to the joint scene label is used as the joint draft model. Draft candidate words are generated using the joint draft model, and the probability distribution of the draft candidate words is predicted. The probability of the draft candidate words is weighted and fused with the weight of the joint draft model that predicted them. A dynamic draft word topology is constructed based on the weighted fusion result. The draft sequence is formed according to the draft word topology.

17. A content generation method, characterized in that, The content generation method includes: The content generation model obtains draft lexical units generated by the content draft model as candidate lexical units; wherein, the draft lexical units are generated by the content draft model using the content reasoning method as described in any one of claims 1 to 16; The content generation model verifies whether the candidate nouns are suitable for generating sentences; In response to determining that the candidate lexical is suitable for the generated statement, the candidate lexical is used to participate in the construction of the generated statement.

18. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the content reasoning method as described in any one of claims 1 to 16 when executing the computer program; or, to implement the steps of the content generation method as described in claim 17.

19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, it implements the steps of the content reasoning method as described in any one of claims 1 to 16; or implements the steps of the content generation method as described in claim 17.

20. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the content reasoning method according to any one of claims 1 to 16; or, implements the steps of the content generation method according to claim 17.