Illusion interception-based large model streaming generation of character efficiency optimization method, device, equipment and medium

CN123031069APending Publication Date: 2026-11-03HUNAN ZHITONG STAR TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611545531.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-08
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

Large models suffer from illusion problems during generation, resulting in low lexical utilization efficiency. Existing technologies cannot stop the continuous generation of invalid lexical units from the source, and the cost of lexical units already consumed cannot be recovered.

Method used

By acquiring user business requests and a contextualized factual benchmark knowledge base, Bayesian probabilistic alignment modeling is performed to establish a three-dimensional benchmark association matrix and prior weights. During the streaming generation of the large model, the alignment degree of word fragments is calculated, and information entropy and Kalman filtering are used for temporal estimation to identify hallucinatory content in real time. Based on the optimal alignment degree and the expected loss function, a dynamic truncation threshold is determined to block the generation of invalid words.

Benefits of technology

It enables real-time identification of hallucinatory content during the generation process, blocking the continuous generation of invalid tokens from the source, preventing hallucinatory content from continuing to be charged, improving the token utilization efficiency of large-scale streaming generation, and recovering the token cost loss that is unavoidable under the post-generation governance model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123031069A_ABST
    Figure CN123031069A_ABST
Patent Text Reader

Abstract

The application discloses a hallucination interception-based large model streaming generation word element efficiency optimization method and device, equipment and medium, the method comprises the following steps: obtaining a user service request and a scenario fact benchmark knowledge base; based on the user service request and the scenario fact benchmark knowledge base, a Bayesian probability alignment modeling is performed to obtain a three-dimensional benchmark correlation matrix and prior weights of each dimension; during the streaming generation of the large model in response to the user service request, the optimal alignment degree at each moment is obtained; if the optimal alignment degree at the target moment is less than the dynamic truncation threshold at the target moment, the streaming generation of the large model is truncated, and the effective word element quantity and the invalid word element quantity are counted; based on the effective word element quantity, the invalid word element quantity and the business value parameter, the word element efficiency value is calculated in a nonlinear value mapping mode. The application can improve the word element utilization efficiency of the large model streaming generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and in particular to a method, apparatus, device and medium for optimizing the efficiency of large-scale streaming generation of lexical units based on illusion interception. Background Technology

[0002] Large Language Models (LLMs) have been implemented at scale in various industries, including cross-border e-commerce product selection, intelligent customer service, content generation, and decision support. Tokens serve as the core unit of pricing and resource measurement for LLM services. Currently, most mainstream LLM service providers adopt a business model based on token consumption, charging for the total number of tokens input and generated during the call process.

[0003] However, large models inherently suffer from the illusion problem, generating false facts, incorrect conclusions, redundant statements, and even prohibited content. Illusory outputs are invalid content with no business value, but their generation process already incurs corresponding lexical costs. Furthermore, erroneous outputs require users to initiate multiple rounds of error correction and repeated model calls, further increasing lexical consumption.

[0004] In related technologies, hallucination mitigation solutions mainly include model fine-tuning, retrieval enhancement generation, and post-generation content review. These solutions all belong to the post-generation governance model, which means waiting for the large model to fully output all content before verifying and correcting the output content. Since verification and correction occur after complete generation, the generation process of hallucination content has already been billed, and the consumed lexical costs cannot be recovered, making it impossible to stop the continuous generation of invalid lexicals from the source.

[0005] In summary, current large-scale streaming generation suffers from low lexical utilization efficiency. Summary of the Invention

[0006] This application aims to propose a method, apparatus, device, and medium for optimizing the efficiency of large-scale streaming lexical generation based on illusion interception, which can improve the lexical utilization efficiency of large-scale streaming generation.

[0007] In a first aspect, embodiments of this application provide a method for optimizing the efficiency of streaming word generation in a large model based on illusion interception, comprising the following steps: Obtain user business requests and a contextualized fact benchmark knowledge base. The user business requests include business request text and business value parameters, and the contextualized fact benchmark knowledge base includes multiple benchmark entries. Based on the user business request and the contextualized fact benchmark knowledge base, Bayesian probabilistic alignment modeling is performed to obtain a three-dimensional benchmark association matrix and prior weights for each dimension. The three-dimensional benchmark association matrix includes benchmark entries corresponding to the fact dimension, logic dimension and compliance dimension, respectively. During the process of the large model responding to the user's business request and generating data in a streaming manner, the word fragments generated by the large model at each time step are obtained. For each word fragment at each time step, the alignment degree between the word fragment and the three-dimensional baseline association matrix in the three dimensions is calculated. Based on the information entropy of the alignment degree in the three dimensions, the prior weights of each dimension are corrected to obtain the adaptive weights at each time step. Based on the adaptive weights, the alignment degree in the three dimensions is weighted and calculated to obtain the alignment degree observation value at each time step. Finally, based on Kalman filtering, the alignment degree observation value at each time step is temporally estimated to obtain the optimal alignment degree at each time step. Based on the optimal alignment at each time point and the preset expected loss function, the dynamic truncation threshold at each time point is determined according to the optimal stopping rule. If the optimal alignment at the target time point is less than the dynamic truncation threshold at the target time point, the streaming generation of the large model is truncated, and the effective word count and invalid word count are counted. The target time point is any time point among the aforementioned time points. Based on the number of effective lexical units, the number of invalid lexical units, and the business value parameters, the lexical efficiency value is calculated using a non-linear value mapping method.

[0008] According to some embodiments of this application, the step of performing Bayesian probabilistic alignment modeling based on the user business request and the contextualized fact benchmark knowledge base to obtain a three-dimensional benchmark association matrix and prior weights for each dimension includes: Construct a Bayesian network, which includes a request feature node, a baseline association node corresponding one-to-one with multiple baseline entries, and an illusion risk node. The request feature node is the parent node of the baseline association node, and the baseline association node is the parent node of the illusion risk node. Using the request features extracted from the business request text as evidence, belief propagation reasoning is performed through the Bayesian network to obtain the posterior association probability between each benchmark item and the user's business request; From multiple benchmark entries, benchmark entries with a posterior association probability greater than a preset probability threshold are selected. The three-dimensional benchmark association matrix is ​​constructed according to the fact dimension, the logic dimension, and the compliance dimension. The prior weight of each dimension is determined based on the scenario type of the user's business request.

[0009] According to some embodiments of this application, calculating the alignment of the lexical fragment with the three-dimensional baseline association matrix in the three dimensions includes: The alignment of the fact dimension is calculated based on the deviation rate between the fact information in the lexical fragment and the benchmark entry corresponding to the fact dimension. The logical consistency probability between the lexical fragment and the benchmark entry corresponding to the logical dimension is calculated based on the semantic entailment model to obtain the alignment degree of the logical dimension. Based on rule matching and risk semantic recognition, the compliance matching degree between the lexical fragment and the benchmark item corresponding to the compliance dimension is calculated to obtain the alignment degree of the compliance dimension; The user service request further includes a maximum output error tolerance, and the calculation of the alignment of the fact dimension based on the deviation rate between the fact information in the lexical fragment and the benchmark entry corresponding to the fact dimension includes: If the deviation rate is less than or equal to the maximum output error tolerance, the alignment of the fact dimension is determined to be 1. If the deviation rate is greater than the maximum output error tolerance, the alignment of the fact dimension is reduced by the proportion by which the deviation rate exceeds the maximum output error tolerance.

[0010] According to some embodiments of this application, the step of correcting the prior weights of each of the three dimensions based on the information entropy of the alignment of the three dimensions to obtain the adaptive weights at each of the three time points includes: For each dimension, the information entropy of the dimension is calculated based on the normalized proportion of the alignment of the dimension at each time up to the target time, and the entropy weight coefficient of each dimension is calculated based on the information entropy of each dimension. For each dimension, the prior weights and entropy weights of the dimension are weighted according to a preset balance factor to obtain the intermediate weights of the dimension. The intermediate weights of the three dimensions are normalized to obtain the adaptive weights at the target time, and the sum of the adaptive weights is 1.

[0011] According to some embodiments of this application, the step of performing time-series estimation on the alignment observations at each of the stated times based on Kalman filtering to obtain the optimal alignment at each of the stated times includes: Using the actual alignment at each stated time as the state variable and the observed alignment at each stated time as the observation variable, a state equation and an observation equation are constructed. For the target time, prediction is made based on the optimal alignment and error covariance of the previous time to obtain the prior state estimate and prior error covariance of the target time. The Kalman gain is calculated based on the prior error covariance and the observation noise covariance, and the prior state estimate is updated based on the Kalman gain and the alignment observation at the target time to obtain the optimal alignment at the target time. Based on the variance of the observation residuals at recent times, the process noise covariance and the observation noise covariance are adaptively adjusted, wherein the initial values ​​of the process noise covariance and the observation noise covariance are preset initial noise parameters.

[0012] According to some embodiments of this application, determining the dynamic truncation threshold for each of the stated times based on the optimal alignment and a preset expected loss function, according to the optimal stopping rule, includes: Based on the optimal alignment, cumulative word count, unit word cost, truncation loss coefficient, illusion omission loss coefficient, and unit business result benchmark value at each time point, an expected loss function is constructed, which includes invalid word cost loss, truncation business loss, and illusion omission loss. The expected loss function is solved based on the optimal stopping rule to obtain the baseline truncation threshold at each time point. The baseline truncation threshold is then corrected based on the changing trends of the error covariance and optimal alignment at each time point to obtain the dynamic truncation threshold at each time point. The statistical analysis of valid and invalid lexical units includes: counting the number of lexical units generated before the truncation instruction takes effect and determined to be hallucination content as the invalid lexical units, and counting the number of lexical units determined to be believable output as the valid lexical units; The method further includes: when the streaming generation of the large model is truncated, extracting the corresponding benchmark entries from the three-dimensional benchmark correlation matrix based on the dimension corresponding to the optimal alignment at the target time to generate correction prompts, and guiding the large model to be regenerated based on the correction prompts.

[0013] According to some embodiments of this application, the step of calculating the lexical efficiency value based on the effective lexical quantity, the invalid lexical quantity, and the business value parameter using a non-linear value mapping method includes: Based on the ratio of the effective word units to the total word units, the output accuracy correction coefficient, and the unit business result benchmark value in the business value parameter, the verifiable business value is calculated according to the saturated growth model. The total word units are the sum of the effective word units and the invalid word units. The output accuracy correction coefficient is determined based on the mean of the optimal alignment at each time point and the entropy of the full-process illusion uncertainty. Based on the total time consumed throughout the entire process, the time value decay coefficient is calculated according to the exponential decay model, and the comprehensive cost is calculated based on the total number of lexical units, the unit cost of lexical units, and the time value decay coefficient. The ratio of the verifiable business value to the overall cost is determined as the lexical efficiency value.

[0014] Secondly, embodiments of this application provide a large-scale streaming lexical generation efficiency optimization device based on illusion interception, comprising: The data acquisition module is used to acquire user business requests and a scenario-based fact benchmark knowledge base. The user business request includes business request text and business value parameters, and the scenario-based fact benchmark knowledge base includes multiple benchmark entries. The alignment modeling module is used to perform Bayesian probabilistic alignment modeling based on the user business request and the contextualized fact benchmark knowledge base to obtain a three-dimensional benchmark association matrix and prior weights for each dimension. The three-dimensional benchmark association matrix includes benchmark entries corresponding to the fact dimension, logic dimension and compliance dimension, respectively. The alignment estimation module is used to obtain the word fragments generated by the large model at each time step during the streaming generation process of the large model in response to the user's business request; for each word fragment at each time step, the alignment degree between the word fragment and the three-dimensional baseline association matrix in the three dimensions is calculated; the prior weights of each dimension are corrected based on the information entropy of the alignment degree in the three dimensions to obtain the adaptive weights at each time step; the alignment degree in the three dimensions is weighted based on the adaptive weights to obtain the alignment degree observation value at each time step; and the alignment degree observation value at each time step is temporally estimated based on Kalman filtering to obtain the optimal alignment degree at each time step. The truncation decision module is used to determine the dynamic truncation threshold for each time step based on the optimal alignment degree and the preset expected loss function according to the optimal stopping rule, and to truncate the streaming generation of the large model when the optimal alignment degree at the target time is less than the dynamic truncation threshold at the target time, and to count the number of effective and invalid lexical units, wherein the target time step is any time step among the time steps. The efficiency measurement module is used to calculate the lexical efficiency value based on the number of effective lexical units, the number of invalid lexical units, and the business value parameters, according to a non-linear value mapping method.

[0015] Thirdly, embodiments of this application provide an electronic device, the device comprising: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the large-model streaming lexical generation efficiency optimization method based on illusion interception as described in the first aspect.

[0016] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the large-model streaming lexical generation efficiency optimization method based on illusion interception as described in the first aspect.

[0017] The method, apparatus, device, and medium for optimizing the efficiency of large-scale streaming word generation based on illusion interception in this application have at least the following beneficial effects: By acquiring user business requests and a contextualized factual benchmark knowledge base, Bayesian probabilistic alignment modeling is performed to obtain a three-dimensional benchmark association matrix and prior weights for each dimension. This establishes a detection benchmark that matches business needs before the large model is generated in a streaming manner. During the streaming generation of the large model, the alignment degree of word fragments in the factual, logical, and compliance dimensions is calculated time-by-time. Weights are corrected based on information entropy, and time-series estimation is performed based on Kalman filtering to obtain a smooth and stable optimal alignment degree. This allows for real-time identification of hallucinatory content during the generation process. Furthermore, based on the optimal alignment degree and the expected loss function, a dynamic truncation threshold is determined according to the optimal stopping rule. When the optimal alignment degree is less than the dynamic truncation threshold, the streaming generation of the large model is immediately truncated. This eliminates the need to wait for the large model to output all content completely, thus blocking the continuous generation of invalid words at the source when hallucinations are identified, preventing the continued billing of hallucinatory content, and reducing the consumption of invalid words. At the same time, word efficiency values ​​are calculated according to a non-linear value mapping method to provide a quantitative basis for word input and output. In this way, the shift from post-generation governance to pre-generation interception is realized, which can make up for the unavoidable loss of lexical costs under the post-generation governance mode and thus improve the lexical utilization efficiency of large-scale streaming generation.

[0018] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0019] The present application will be further described below with reference to the accompanying drawings and embodiments, wherein: Figure 1 A flowchart illustrating an embodiment of the large-model streaming lexical generation efficiency optimization method based on illusion interception provided in this application; Figure 2 A schematic diagram of the structure of the large-scale streaming generation lexical efficiency optimization device based on illusion interception provided in this application; Figure 3 A schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation

[0020] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0021] In this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, without necessarily requiring or implying any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0022] Large language models have been implemented on a large scale in various industries such as cross-border e-commerce product selection, intelligent customer service, content generation, and decision support. As the core unit of pricing and resource measurement for large model services, lexical units are currently the primary business model for mainstream large model service providers, which generally adopts a billing model based on lexical unit consumption. However, large models suffer from an inherent illusion problem. The illusion mitigation solutions in related technologies are all post-generation governance models, meaning that verification and correction are only performed after the large model has completely output all content. By this time, all lexical units have been consumed, making it impossible to stop the continuous generation of invalid lexical units at the source. The lexical unit cost already incurred is irrecoverable, resulting in low lexical unit utilization efficiency in the streaming generation of large models.

[0023] To address the problems of existing technologies, embodiments of this application provide a method, apparatus, device, and medium for optimizing the efficiency of large-scale streaming lexical generation based on illusion interception. The method for optimizing the efficiency of large-scale streaming lexical generation based on illusion interception provided in this application embodiment is described below.

[0024] The method for optimizing the efficiency of large-model streaming lexical generation based on illusion interception provided in this application can be applied to electronic devices, such as servers, terminal devices, or cloud computing platforms, etc., and is not limited thereto. For example, the electronic device can be a server that deploys business systems such as cross-border e-commerce intelligent product selection systems, financial risk control systems, government Q&A systems, or medical assistance systems. This server connects to the streaming output interface of the large model and executes the method for optimizing the efficiency of large-model streaming lexical generation based on illusion interception in this application during the streaming generation of the large model.

[0025] Before implementing the large-model streaming lexical generation efficiency optimization method based on illusion interception in this application embodiment, the electronic device can pre-acquire or configure the following four types of basic input data. The calculations of each subsequent step can be traced back to these four types of basic input data to ensure a strong binding relationship between input and output.

[0026] The first type of basic input data consists of user business requests and a set of value parameters. These user business requests can be requests submitted by users through a business system that require the large model to generate corresponding business content. They can include the business request text, scenario type identifier, business objective dimension, benchmark value per unit of business outcome, and the acceptable maximum output error tolerance. The business request text can be natural language text describing business requirements; the scenario type identifier can indicate the business scenario to which the request belongs; the business objective dimension can be the analytical dimension that the business request focuses on; the benchmark value per unit of business outcome can be the quantifiable value corresponding to a unit of qualified business outcome; and the maximum output error tolerance can be the upper limit of the factual deviation acceptable to the user's business side.

[0027] For example, in the intelligent product selection scenario of cross-border e-commerce, the business request text of a user's business request can be an analysis of the best-selling storage products in the home furnishing category of a certain platform in 2026. The scenario type identifier can be a cross-border product selection scenario identifier. The business target dimensions can include dimensions such as category growth rate, price range, and sales volume. The benchmark value of a unit business result can be the benchmark business value of 2,000 yuan corresponding to a single qualified product selection report. The maximum output error tolerance can be the upper limit of the numerical deviation of sales volume, price, etc. that the user can accept.

[0028] The second type of basic input data is a scenario-based fact benchmark knowledge base. This scenario-based fact benchmark knowledge base can be a set of fact benchmarks with prior confidence levels constructed for a specific business scenario. It can include multiple benchmark entries, each of which can include a factual truth value, prior confidence level, a set of business logic rules, a set of compliance risk rules, and the scenario-related prior probability of each entry. These benchmark entries can be fact entries, business logic rule entries, or compliance risk rule entries.

[0029] The core data sources of the aforementioned scenario-based factual benchmark knowledge base can be divided into four categories: First, authoritative third-party structured data, such as official interface data from e-commerce platforms, industry reports, and publicly available standards and specifications, especially the core source of high-confidence factual truth values; second, internal business data accumulated by enterprises, such as historical business cases, decision-making logic, and operational specifications, which ensure that the knowledge base aligns with actual business practices; third, publicly available compliance and regulatory texts, such as industry regulations, platform rules, and prohibited sales lists, which constitute a set of compliance risk rules; and fourth, historical verification and feedback data, such as previously intercepted and confirmed illusion samples and manual error correction results, which support the self-evolution of the knowledge base.

[0030] The aforementioned scenario-based fact benchmark knowledge base can be constructed using a five-step standardized process: First, multi-source data collection and normalization: Data from multiple sources is acquired through API integration and text extraction to achieve entity alignment and disambiguation, outputting standardized entries containing unique identifiers, truth values, and data source labels. Second, prior confidence quantification: Weighted calculations are performed based on data source authority level, data timeliness, and cross-validation degree to obtain the prior confidence of each fact, providing prior parameters for Bayesian inference. Third, rule formalization modeling: Business logic and compliance rules are transformed into computable mathematical expressions and predicate logic rules to support automated consistency verification. Fourth, scenario association mapping: A scenario label system is built, the co-occurrence probability of entries and scenarios is statistically analyzed, and associated prior indexes are generated to achieve accurate matching between requests and benchmarks. Fifth, closed-loop dynamic iteration: Authoritative data source increments are periodically synchronized, illusion interception and manual review results are fed back, and the truth values ​​and confidence of entries are continuously corrected.

[0031] The third type of basic input data is the temporal lexical sequence of the large model's streaming output. This temporal lexical sequence can include a sequence of lexical fragments arranged in the order of generation, with each fragment potentially accompanied by a generation timestamp and a cumulative lexical count. These lexical fragments can be text segments composed of one or more lexical units streamed by the large model at a specific moment; for example, they could be a sentence or a paragraph of text.

[0032] The fourth type of basic input data consists of a set of system parameters and cost coefficients. This set may include unit cost per word, time decay coefficient, truncation loss coefficient, illusion omission loss coefficient, and initial noise parameters for the Kalman filter. The unit cost per word can be the pricing price charged by the large model service provider for a single word; the truncation loss coefficient can be used to quantify the business loss caused by truncation errors; the illusion omission loss coefficient can be used to quantify the business loss caused by illusions not being intercepted and flowing out of the system; and the initial noise parameters for the Kalman filter may include the initial process noise covariance and the initial observation noise covariance.

[0033] Figure 1This diagram illustrates a flowchart of a method for optimizing the efficiency of streaming lexical generation based on illusion interception, as provided in an embodiment of this application. This method is applied to electronic devices, such as… Figure 1 As shown, the method for optimizing the efficiency of large-scale streaming generation of lexical units based on illusion interception includes the following steps: Step S101: Obtain user business requests and a scenario-based fact benchmark knowledge base. The user business request includes the business request text and business value parameters, and the scenario-based fact benchmark knowledge base includes multiple benchmark entries.

[0034] In this step, the electronic device can receive user business requests submitted by the user through the business system and read benchmark entries matching the scenario type of the user business request from a pre-built scenario-based fact benchmark knowledge base. The specific content of the aforementioned user business requests and scenario-based fact benchmark knowledge base can be found in the relevant descriptions of the four types of basic input data mentioned above, and will not be repeated here.

[0035] Step S102: Based on user business requests and a scenario-based fact benchmark knowledge base, perform Bayesian probabilistic alignment modeling to obtain a three-dimensional benchmark association matrix and prior weights for each dimension. The three-dimensional benchmark association matrix includes benchmark entries corresponding to the fact dimension, logic dimension, and compliance dimension, respectively.

[0036] In this step, after the electronic device obtains the user's business request and the contextualized fact benchmark knowledge base, it can perform semantic parsing and feature extraction on the user's business request before the large model starts to be generated. This yields the request features, and then Bayesian probabilistic alignment modeling is used to probabilistically quantify the dependency relationship between the user's business request and each benchmark item. This allows the selection of benchmark items related to the current user's business request, generating benchmarks for subsequent consistency detection, and achieving pre-probabilistic alignment between input requirements and detection standards.

[0037] The aforementioned three-dimensional benchmark correlation matrix can be a set of benchmark entries organized according to three verification dimensions: factual dimension, logical dimension, and compliance dimension. Specifically, the benchmark entries corresponding to the factual dimension can be factual items, such as verifiable data like product sales volume, price, and category growth rate; the benchmark entries corresponding to the logical dimension can be business logic rule items, such as best-selling product calculation formulas and product selection frameworks; and the benchmark entries corresponding to the compliance dimension can be compliance risk rule items, such as prohibited sales lists and infringement avoidance rules.

[0038] The prior weights for each of the above dimensions can be preset based on the scenario type of the user's business request, representing the initial weight proportion of each dimension in the overall illusion verification. For example, in cross-border product selection scenarios, where data accuracy is required to a high degree, the prior weight of the fact dimension can be set to the highest.

[0039] Step S103: During the process of the large model responding to user business requests and generating in a streaming manner, obtain the word fragments generated by the large model at each time step; for the word fragments at each time step, calculate the alignment degree between the word fragments and the three-dimensional baseline association matrix in three dimensions; correct the prior weights of each dimension based on the information entropy of the alignment degree in the three dimensions to obtain the adaptive weights at each time step; perform weighted calculation on the alignment degree in the three dimensions based on the adaptive weights to obtain the alignment degree observation value at each time step; and perform time-series estimation on the alignment degree observation value at each time step based on Kalman filtering to obtain the optimal alignment degree at each time step.

[0040] In this step, after the large model responds to the user's business request and starts streaming generation, the electronic device can obtain the word fragments generated by the large model in parallel with the generation process of the large model, and perform three-dimensional verification and time-series smoothing calculations on the word fragments at each time point in real time.

[0041] The alignment degree mentioned above can be used to characterize the degree of matching between the word fragment and the benchmark entry in the three-dimensional benchmark association matrix. Its value range can be from 0 to 1. The higher the value, the higher the degree of matching between the word fragment and the benchmark entry, and the lower the probability that the word fragment is hallucination content.

[0042] The aforementioned method of modifying the prior weights of each dimension based on the information entropy of the three-dimensional alignment can objectively quantify the discriminative power of each dimension's alignment through information entropy, replacing subjective weighting methods and thus providing an objective basis for setting the weights of each dimension. The aforementioned method of temporally estimating the alignment observations at each time step based on Kalman filtering can treat alignment as a temporal state variable, using an iterative process of prediction and updating to optimally estimate the true alignment at each time step. This eliminates noise fluctuations in single segments of streaming media and addresses the problems of misjudgment or missed judgment caused by insufficient contextual information of single-segment lexical units and large fluctuations in alignment scores.

[0043] Step S104: Based on the optimal alignment at each time step and the preset expected loss function, determine the dynamic truncation threshold at each time step according to the optimal stopping rule, and truncate the streaming generation of the large model when the optimal alignment at the target time step is less than the dynamic truncation threshold at the target time step, and count the number of effective and invalid lexical units. The target time step is any time step among the time steps.

[0044] In this step, the electronic device can transform the problem of when to truncate the phantom output into an optimal stopping problem that minimizes the expected loss. That is, it can adaptively solve the optimal truncation time by weighing the cost loss of invalid tokens caused by continuing to generate in real time against the loss of business value caused by premature truncation, thereby replacing the fixed threshold interception strategy in related technologies.

[0045] The aforementioned dynamic truncation threshold can be a truncation determination threshold that changes dynamically with the accumulation of lexical consumption and the dynamic changes in business value, rather than a fixed value. If the optimal alignment at the target time is greater than or equal to the dynamic truncation threshold at the target time, the electronic device can determine that the current output is a reliable output and continue receiving lexical fragments from the next time step. If the optimal alignment at the target time is less than the dynamic truncation threshold at the target time, the electronic device can determine that the current output is a phantom output, immediately send a truncation command to the large model, and terminate generation.

[0046] Step S105: Calculate the lexical efficiency value based on the number of effective lexical units, the number of invalid lexical units, and the business value parameters, using a non-linear value mapping method.

[0047] In this step, the electronic device can incorporate the real-world laws of diminishing marginal returns and non-linear time decay in business value, establishing a verifiable quantitative mapping relationship between business value and the overall cost of lexical units. It then outputs lexical efficiency quantification results that align with actual business needs, completing a closed-loop calculation from input to final value. The aforementioned lexical efficiency value can be used to characterize the verifiable business value corresponding to a unit cost investment; a higher value indicates better lexical utilization efficiency.

[0048] In this embodiment, by acquiring user business requests and a contextualized factual benchmark knowledge base, Bayesian probabilistic alignment modeling is performed to obtain a three-dimensional benchmark association matrix and prior weights for each dimension. This establishes a detection benchmark that matches business requirements before the large model is generated in a streaming manner. During the streaming generation of the large model, the alignment degree of word fragments in the three dimensions is calculated time-by-time. The weights are corrected based on information entropy, and time-series estimation is performed based on Kalman filtering to obtain a smooth and stable optimal alignment degree. This allows for real-time identification of hallucinatory content during the generation process. Furthermore, based on the optimal alignment degree and the expected loss function, a dynamic truncation threshold is determined according to the optimal stopping rule. When the optimal alignment degree is less than the dynamic truncation threshold, the streaming generation of the large model is immediately truncated. This eliminates the need to wait for the large model to output all content completely, thus blocking the continuous generation of invalid words from the source when hallucinations are identified. This prevents the continued billing of hallucinatory content and reduces the consumption of invalid words. At the same time, the word efficiency value is calculated according to a nonlinear value mapping method to provide a quantitative basis for word input and output. In this way, the shift from post-generation governance to pre-generation interception is realized, which can make up for the unavoidable loss of lexical costs under the post-generation governance mode and thus improve the lexical utilization efficiency of large-scale streaming generation.

[0049] In some implementations, step S102 above, which involves performing Bayesian probabilistic alignment modeling based on user business requests and a contextualized factual benchmark knowledge base to obtain a three-dimensional benchmark association matrix and prior weights for each dimension, may include steps 1) to 3). Step 1) Construct a Bayesian network. The Bayesian network includes request feature nodes, baseline association nodes that correspond one-to-one with multiple baseline entries, and illusion risk nodes. Request feature nodes are the parent nodes of baseline association nodes, and baseline association nodes are the parent nodes of illusion risk nodes.

[0050] Step 2) Using the request features extracted from the business request text as evidence, perform belief propagation inference through a Bayesian network to obtain the posterior association probability between each baseline item and the user's business request.

[0051] Step 3) Select benchmark items from multiple benchmark items whose posterior association probability is greater than a preset probability threshold, construct a three-dimensional benchmark association matrix according to the factual dimension, logical dimension and compliance dimension, and determine the prior weight of each dimension based on the scenario type of the user's business request.

[0052] In this embodiment, by constructing a three-layer Bayesian network and performing belief propagation reasoning, the dependency relationship between user business requests, benchmark items, and illusion risks can be probabilistically quantified, replacing the simple keyword matching method in related technologies. This generates an accurate benchmark for subsequent consistency detection, thereby improving the matching accuracy between the detection benchmark and user business requests, providing a reliable benchmark for subsequent streaming alignment calculation, and reducing the misjudgment rate caused by mismatched detection benchmarks.

[0053] The aforementioned request feature nodes can be parent nodes of a Bayesian network, representing a set of semantic features that characterize the user's business request. These features serve as input evidence variables for probabilistic inference. The request features can be entities, business dimensions, constraints, and other characteristics extracted from the business request text.

[0054] The aforementioned benchmark association nodes can be intermediate nodes of a Bayesian network, each corresponding one-to-one with a benchmark entry in the contextualized fact benchmark knowledge base, used to characterize the association status between the corresponding benchmark entry and the current user's business request.

[0055] The aforementioned hallucination risk nodes can be child nodes of a Bayesian network, which can be binary random variables used to characterize the risk state of hallucinations generated by the content generated by the large model.

[0056] After constructing the Bayesian network, the electronic device can initialize the probability table of the Bayesian network. This probability table may include: the prior probability P(Q) of the requested feature nodes, which can be calculated based on the Term Frequency-Inverse Document Frequency (TF-IDF) of the requested features, used to characterize the probability of occurrence of each requested feature; and the conditional probability table P(B). i|Q), which can be trained based on historical samples, is used to characterize the association probability between the requested feature and the baseline item; the conditional probability table P(h|B) i It can be derived backward from the prior confidence of the benchmark item, and is used to characterize when the content generated by the large model involves the i-th benchmark item B. i When the output content represents the conditional prior probability of hallucination, the lower the prior confidence of the baseline item, the easier it is for the large model to generate hallucination content, P(h|B i The higher the value of ), the better.

[0057] Where Q represents the requested feature node, B i Let h represent the baseline associated node corresponding to the i-th baseline entry, h represent the illusion risk node, and i is a positive integer.

[0058] The aforementioned belief propagation inference can be based on actual request features extracted from the business request text as evidence, and belief propagation can be performed using the Sum-Product Algorithm to infer the posterior association probability P(B) between each baseline item and the current user's business request. i |Q=q), and the corresponding illusory prior risk value. Here, q represents the specific feature value of the current user's business request, that is, the specific feature instance extracted from the user's actual business request text, P(B i |Q=q) represents the posterior probability of the i-th baseline entry being associated with the user's business request when the user's business request has feature q.

[0059] The aforementioned preset probability threshold can be a pre-set filtering threshold for the posterior association probability; for example, the preset probability threshold could be 0.7. The electronic device can filter benchmark items with a posterior association probability greater than 0.7, construct a three-dimensional benchmark association matrix according to the factual, logical, and compliance dimensions, and simultaneously output the prior weight vectors for the three dimensions. .

[0060] in, This represents the prior weight of the fact dimension, corresponding to the weight percentage of the fact-based benchmark items in the overall illusion verification. This represents the prior weight of the logical dimension, corresponding to the weight ratio of the baseline item of the business logic rule class in the overall illusion verification; The prior weights of the compliance dimension correspond to the weight percentage of the compliance risk rule benchmark items in the overall illusion verification. The three satisfy the following formula (1): Formula (1) Wherein, the initial prior weight vector Risk characteristics can be preset based on business scenarios, and can be dynamically corrected later by combining entropy weight method with real-time generated data.

[0061] For example, in a cross-border e-commerce intelligent product selection scenario, electronic devices perform semantic parsing and feature extraction on user business requests to obtain a core request feature set: the category is home storage, the website is a specific website, the time period is 2026, and the task objective is to select and analyze potential best-selling products. This feature set is used as evidence input into a pre-trained Bayesian network, and inference is completed through a sum-product belief propagation algorithm. Benchmark items with a posterior association probability greater than 0.7 are selected, resulting in 86 factual benchmarks (e.g., monthly average growth rate of 12.3% for the storage category, price range of the top 10 products from $25 to $45, and real monthly sales data of benchmark products), 12 business logic rules (e.g., best-selling product calculation formula, product selection dimension framework), and 8 compliance risk rules (e.g., prohibition of selling magnetic storage products, avoidance of infringing patterns), and outputting a priori weight vector of dimensions. =[0.6, 0.25, 0.15], which aligns with the business characteristic of prioritizing data accuracy in product selection scenarios.

[0062] In some implementations, step S103 above, calculating the alignment degree between the lexical fragment and the three-dimensional benchmark association matrix in three dimensions, may include: calculating the alignment degree of the fact dimension based on the deviation rate between the factual information in the lexical fragment and the benchmark item corresponding to the fact dimension; calculating the logical consistency probability between the lexical fragment and the benchmark item corresponding to the logical dimension based on the semantic implication model to obtain the alignment degree of the logical dimension; and calculating the compliance matching degree between the lexical fragment and the benchmark item corresponding to the compliance dimension based on rule matching and risk semantic recognition to obtain the alignment degree of the compliance dimension.

[0063] In this implementation, the alignment degree between the word fragment and the benchmark entry is calculated through three dimensions: fact, logic, and compliance. This can fully characterize the degree of deviation between the output content and the business benchmark, break through the coverage blind spot of single-dimensional detection, and thus improve the recall capability of illusion recognition, so that logical implicit illusions and high-confidence factual illusions can be effectively identified.

[0064] The alignment of the aforementioned fact dimension can be calculated by weighting the deviation rate between entities and values ​​in the lexical fragments and the posterior association probability of fact entries in the three-dimensional benchmark association matrix. Its value ranges from 0 to 1, and the higher the value, the higher the matching degree between the lexical fragments and the fact benchmark.

[0065] The alignment degree of the aforementioned logical dimension can be obtained by calculating the logical consistency probability between the current lexical fragment and the business rule based on the semantic entailment model, and its value can range from 0 to 1. The aforementioned semantic entailment model can be a pre-trained model used to determine whether there is a semantic entailment relationship between two text segments.

[0066] The alignment degree of the above compliance dimensions can be obtained by calculating the compliance matching degree between the current word segment and the compliance risk rule based on rule matching and risk semantic recognition, and its value range can be 0 to 1.

[0067] The user service request may also include the maximum output error tolerance. The above calculation of the alignment of the fact dimension based on the deviation rate between the fact information in the lexical fragment and the benchmark entry corresponding to the fact dimension may include: determining the alignment of the fact dimension as 1 when the deviation rate is less than or equal to the maximum output error tolerance; and deducting the alignment of the fact dimension according to the proportion by which the deviation rate exceeds the maximum output error tolerance when the deviation rate is greater than the maximum output error tolerance.

[0068] The aforementioned maximum output error tolerance can be considered as the upper limit of acceptable factual deviation for the user's business side. It defines the boundary between tolerable normal errors and factual illusions, replacing the generalized deviation threshold and strongly binding the verification standard to the user's business needs. The aforementioned deviation rate can be the absolute value of the relative error between the factual value in the lexical segment and the true value in the benchmark entry.

[0069] Specifically, the alignment of the factual dimension The calculation can include the following two scenarios: Scenario 1: If the factual numerical deviation rate Δ of the lexical segment is less than or equal to the maximum output error tolerance δ, the deviation is determined to be a normal error acceptable to the user, and the alignment of the factual dimension is given full marks. =1; In the second scenario, when the deviation rate Δ is greater than the maximum output error tolerance δ, the alignment is linearly reduced according to the proportion exceeding the tolerance. Specifically, refer to the following formula (2): Formula (2) in, Δ represents the alignment of the fact dimension at time t; Δ represents the fact value deviation rate of the lexical segment, which is the absolute value of the relative error between the output value in the lexical segment and the fact truth value in the benchmark entry; δ represents the maximum output error tolerance; max represents the maximum value operation. The smaller δ is, the higher the user's requirement for fact accuracy, and even a small deviation will trigger a decrease in alignment.

[0070] For example, in a cross-border e-commerce intelligent product selection scenario, assuming the maximum output error tolerance δ is 0.1, if a product's monthly sales in the word segment generated by the large model are 11,500, while the actual monthly sales of the same product in the benchmark entry are 12,000, then the deviation rate Δ is 0.042, which is less than the maximum output error tolerance of 0.1. This is considered a normal error acceptable to the user, representing the alignment of the factual dimension. Take 1; if the monthly sales of the product in the word segment are 120,000, then the deviation rate Δ is 9, which is much greater than the maximum output error tolerance of 0.1. The alignment of the fact dimension is calculated according to formula (2). A value of 0 indicates that the morpheme fragment exhibits severe factual illusion. Thus, by embedding the upper limit of acceptable factual deviation from the user's business side into the calculation process of factual dimension alignment, the boundary of illusion judgment can be strongly bound to user business needs, avoiding overly strict or lenient verification issues caused by generalized deviation thresholds, and improving the adaptability of factual illusion judgment to business scenarios.

[0071] In some implementations, step S103 above, which modifies the prior weights of each dimension based on the information entropy of the alignment of the three dimensions to obtain the adaptive weights at each time step, may include steps 1) to 3). Step 1) For each dimension, calculate the information entropy of the dimension based on the normalized proportion of the alignment of the dimension at each time up to the target time, and calculate the entropy weight coefficient of each dimension based on the information entropy of each dimension.

[0072] Step 2) For each dimension, the prior weights and entropy weights of the dimension are weighted according to the preset balance factor to obtain the intermediate weights of the dimension.

[0073] Step 3) Normalize the intermediate weights of the three dimensions to obtain the adaptive weights at the target time. The sum of the adaptive weights is 1.

[0074] In this embodiment, the uncertainty of the alignment of each dimension is objectively quantified by information entropy, and the prior weights are dynamically corrected. This can replace the subjective weighting method in related technologies and solve the problem of weight setting without a basis. At the same time, by balancing the inherent dimension priority of the business scenario and the objective distinguishability of the real-time generated data, the weights are both in line with the business characteristics and can be dynamically adapted with the generation process, thereby improving the objectivity and accuracy of the overall alignment calculation.

[0075] The aforementioned information entropy can be used to quantify the uncertainty of alignment in each dimension. The smaller the entropy value, the higher the discriminative power of the alignment in that dimension, and the greater the weight of that dimension should be. Specifically, the information entropy of the j-th dimension can be calculated using the following formula (3): Formula (3); in, Let represent the information entropy of the j-th dimension, where j takes the value 1, 2, or 3, corresponding to the factual dimension, logical dimension, and compliance dimension, respectively; t represents the current time; Σi represents the summation of i from 1 to t; The normalized proportion of the alignment of the j-th dimension at time i can be the proportion of the alignment of the j-th dimension at time i to the sum of the alignments of the three dimensions at time i; ln represents the natural logarithm operation.

[0076] After calculating the information entropy of each dimension, the electronic device can calculate the entropy weight coefficient of each dimension based on the information entropy of each dimension, as shown in the following formula (4): Formula (4) in, Let represent the entropy weight coefficient of the j-th dimension; Σk represents the summation over k from 1 to 3; Let represent the information entropy of the k-th dimension.

[0077] The aforementioned balancing factor can be used to balance the proportion of prior business data and objective data, and its value can range from 0 to 1. The closer the balancing factor is to 1, the more the weight is biased towards prior business data, which is suitable for professional scenarios with strict rule requirements; the closer the balancing factor is to 0, the more the weight is biased towards real-time data features, which is suitable for open domain generation scenarios. For example, the default balancing factor for business scenarios can be 0.6, which means that prior weights are the main factor, and entropy weights are used for dynamic adjustment.

[0078] Specifically, for each dimension, the electronic device can perform weighted calculations on the prior weights and entropy weights of the dimension according to a preset balance factor to obtain the unnormalized intermediate weights, as shown in the following formula (5): Formula (5) in, α represents the intermediate weight of the j-th dimension; α represents the balance factor. This represents the prior weight of the j-th dimension; This represents the entropy weight coefficient of the j-th dimension.

[0079] Furthermore, the electronic device can normalize the intermediate weights of the three dimensions to ensure that the sum of the weights of the three dimensions is 1, thereby obtaining the final adaptive weight vector at the target time. Specifically, refer to the following formula (6): Formula (6) in, Let w1′ represent the adaptive weight of the j-th dimension at time t; w1′, w2′, and w3′ represent the intermediate weights of the first, second, and third dimensions, respectively. The final output is the adaptive weight vector. It can be used as the weight for calculating the overall alignment at the current moment.

[0080] For example, in the intelligent product selection scenario of cross-border e-commerce, the first 8 word fragments generated by the large model are an overview of industry background and category trends. The alignment of the factual dimension is stable in the range of 0.90 to 0.94, the alignment of the logical dimension is stable in the range of 0.87 to 0.91, and the alignment of the compliance dimension is 1.0. Based on the fluctuation characteristics of the alignment of the first 8 segments, the electronic device calculates the three-dimensional information entropy according to formula (3), then calculates the entropy weight coefficient of each dimension according to formula (4), and combines the entropy weight coefficient with the prior weight according to formula (5) and formula (6). The values ​​[0.6, 0.25, 0.15] are fused to obtain the adaptive weights after entropy weight correction. =[0.58, 0.27, 0.15], which has a small deviation from the prior weights and is consistent with the feature distribution of a normal generated scene.

[0081] In some implementations, step S103 above, which involves performing time-series estimation of the alignment observations at each time step based on Kalman filtering to obtain the optimal alignment at each time step, may include steps 1) to 4). Step 1) Construct state equations and observation equations using the true alignment at each time point as state variables and the alignment observation values ​​at each time point as observation variables.

[0082] Step 2) For the target time, make a prediction based on the optimal alignment and error covariance of the previous time to obtain the prior state estimate and prior error covariance of the target time.

[0083] Step 3) Calculate the Kalman gain based on the prior error covariance and the observation noise covariance, and update the prior state estimate based on the Kalman gain and the alignment observation at the target time to obtain the optimal alignment at the target time.

[0084] Step 4) Based on the variance of the observation residuals at recent times, adaptively adjust the process noise covariance and the observation noise covariance, wherein the initial values ​​of the process noise covariance and the initial values ​​of the observation noise covariance are preset initial noise parameters.

[0085] In this embodiment, the iterative prediction and update of the temporal streaming alignment score through Kalman filtering can make full use of the context-generated trajectory information, eliminate noise fluctuations in single streaming segments, effectively distinguish between normal semantic fluctuations caused by complex reasoning and abnormal alignment drops caused by factual deviations, thereby outputting a smooth and stable optimal alignment estimate and reducing the false alarm rate and false negative rate in streaming generation scenarios.

[0086] The alignment observations mentioned above can be the original alignment observations obtained by weighting the alignment of the three dimensions based on adaptive weights at the current time. For details, please refer to the following formula (7): Formula (7) in, Represents the alignment observation value at time t; , , These represent the adaptive weights of the factual dimension, logical dimension, and compliance dimension at time t, respectively. , , These represent the alignment of the factual dimension, logical dimension, and compliance dimension at time t, respectively.

[0087] The aforementioned state variable can be the true overall alignment at time t, which is a true value that cannot be directly observed. The aforementioned state equation and observation equation can be referred to as formulas (8) and (9) respectively: Formula (8) Formula (9) in, Let represent the true overall alignment at time t; A represents the state transition coefficient. Since the alignment is a stationary random process, A can be 1. This represents process noise, and its covariance is... H represents the observation coefficient, which can be 1. This represents the observation noise, and its covariance is... .

[0088] The above prediction steps can be based on the optimal estimate at time t-1, predicting the prior state estimate and prior error covariance at time t, as shown in the following formula (10): , Formula (10) in, This represents the prior state estimate at time t; This represents the optimal alignment at time t-1; Let represent the prior error covariance at time t; This represents the error covariance at time t-1; This represents the transpose of the state transition coefficients.

[0089] The above update steps can be combined with the alignment observations at the current time to calculate the Kalman gain and update to obtain the posterior optimal estimate, as shown in the following formula (11):

[0090] Formula (11)

[0091] in, Indicates the Kalman gain at time t; This represents the transpose of the observed coefficients; This represents the optimal alignment at time t; Let represent the error covariance at time t; I represents the identity matrix.

[0092] The aforementioned adaptive noise adjustment can adjust the process noise covariance in real time based on the variance of the observed residuals at recent times. Covariance of observation noise This is to adapt to the fluctuation characteristics of different generation speeds and different scenarios. The aforementioned observation residuals can be the difference between the alignment observations at each time point and the prior state estimates.

[0093] It should be noted that the above process noise covariance Initial values ​​and observation noise covariance The initial values ​​can be taken from the Kalman filter initial noise parameters in the aforementioned fourth type of basic input data. These parameters can be pre-configured based on the generation stability of the business scenario, providing a noise prior for the state estimation at the first time step; initial error covariance It can be based on initial noise parameters, for example, the initial error covariance can be set. Consistent with the initial observation noise covariance, this indicates that the initial estimation uncertainty is consistent with the observation noise level. In the subsequent adaptive adjustment phase, the algorithm iteratively updates the variance based on the observation residuals in real time. and The iteration starting point is the initial noise parameter passed in by the fourth type of basic input data. In this way, by pre-setting the initial noise parameter to provide an initial benchmark for the Kalman filter time-series iteration, the stability of filter convergence can be guaranteed, and the estimation divergence caused by the lack of prior noise in the initial stage can be avoided.

[0094] For example, in the intelligent product selection scenario of cross-border e-commerce, the estimated value of the initial state of electronic devices. The error covariance is 0.9. With a value of 0.01, prediction and update iterations are performed time-by-time. The optimal alignment of the first 8 word segments remains stable between 0.89 and 0.93, without abnormal fluctuations. When the 9th word segment is generated, the large model outputs content that a certain folding storage box has monthly sales of over 120,000 and ranks first in its category. The electronic device extracts this value and compares it with the corresponding factual benchmark (the actual monthly sales of this product are 12,000) in the three-dimensional benchmark association matrix. The alignment of the factual dimension is... The value dropped sharply to 0.22. The original alignment observation value was obtained by weighting according to formula (7). The value is 0.38. After being updated by Kalman filtering according to formulas (10) and (11), the optimal alignment at time 9 is obtained. The value was 0.42, showing a significant and precipitous drop, corresponding to a high-risk hallucination of factual value type.

[0095] In some implementations, step S104 above, which determines the dynamic truncation threshold at each time step based on the optimal alignment and the preset expected loss function according to the optimal stopping rule, may include the following steps 1) and 2). Step 1) Construct the expected loss function based on the optimal alignment at each time point, the cumulative number of lexical units, the cost per lexical unit, the truncation loss coefficient, the illusion omission loss coefficient, and the benchmark value of the unit business result. The expected loss function includes the cost loss of invalid lexical units, the truncation business loss, and the illusion omission loss.

[0096] Step 2) Solve the expected loss function based on the optimal stopping rule to obtain the baseline cutoff threshold at each time step. Then, based on the changing trends of the error covariance and optimal alignment at each time step, correct the baseline cutoff threshold to obtain the dynamic cutoff threshold at each time step.

[0097] In this embodiment, by transforming illusion truncation into an optimal stopping problem that minimizes expected loss, the fixed threshold interception strategy in related technologies can be replaced. The cost loss of continuing to generate invalid tokens and the business value loss of premature truncation are weighed in real time, and the optimal truncation threshold adapted to the current generation stage is dynamically generated. This avoids the continuous accumulation of invalid tokens caused by interception lag, and also eliminates the problems of excessive truncation destroying the semantic integrity of the output and increasing the regeneration overhead, thereby achieving a two-way optimization of interception accuracy and business smoothness.

[0098] The above expected loss function can be used to quantify the total expected loss of making a cutoff decision at time t, as shown in the following formula (12): Formula (12) in, This represents the total expected loss at time t; Indicates the cost loss of invalid terms; This indicates losses due to erroneous business interruption; This indicates a loss due to missed diagnosis of hallucinations.

[0099] The above-mentioned cost loss of invalid tokens can be the cost corresponding to the invalid tokens consumed up to time t. The lower the alignment, the higher the proportion of invalid tokens and the greater the loss. For details, please refer to the following formula (13): Formula (13) in, This represents the cumulative number of word elements up to time t; Indicates the cost per unit word.

[0100] The aforementioned loss due to erroneous truncation can be the loss of time spent on business process interruption and regeneration caused by the current truncation being erroneous (i.e., the subsequent content is actually credible content). It is positively correlated with the current alignment degree, and can be referred to in the following formula (14): Formula (14) in, Indicates the truncation loss coefficient; It represents the benchmark value of a unit's business results.

[0101] The aforementioned losses from missed detection of hallucinations can be used to quantify the business losses caused by the failure of hallucinations to be intercepted and leak out of the system, such as compliance penalties, decision-making errors, and business implementation failures. For details, please refer to the following formula (15): Formula (15) Where μ represents the hallucination omission loss coefficient, which represents the ratio of the loss caused by the outflow of hallucinations to the benchmark value of the unit business results; This represents the estimated probability of illusion in the output content at the current moment. The lower the optimal alignment, the higher the probability of illusion. Thus, by adding a loss term for missed illusions to the expected loss function, the truncation decision can simultaneously balance the three types of risks: cost loss of invalid tokens, business loss from incorrect truncation, and loss from missed illusions, thereby improving the accuracy of the truncation decision.

[0102] The above optimal stopping rule can be based on solving the stopping condition corresponding to the minimum expected loss using the Bellman dynamic programming equation: if the expected marginal loss of continuing to generate the next step is greater than or equal to the loss of immediate truncation, then truncation is triggered, as can be seen in the following formula (16): Formula (16) in, This indicates that the optimal alignment at time t is Under the condition that, the expected loss continues to be generated up to time t+1.

[0103] Combining the sequential probability ratio test, the above stopping condition can be transformed into a benchmark cutoff threshold for alignment, which can be referred to in the following formula (17): Formula (17) in, Represents the baseline cutoff threshold at time t; This represents the cumulative number of lexical units up to time t+1. The above-mentioned benchmark truncation threshold is a benchmark value derived from the expected balance between lexical unit cost and business loss. It changes dynamically with the accumulation of lexical unit consumption and business value, rather than being a fixed value.

[0104] Furthermore, based on the baseline truncation threshold, the electronic device can incorporate the changing trend of the error covariance and optimal alignment of the Kalman filter output as a correction term, and integrate it into the threshold calculation through a risk margin mechanism to obtain a complete dynamic truncation threshold. Specifically, refer to the following formula (18): Formula (18) in, This represents the dynamic cutoff threshold at time t; k represents the confidence coefficient, for example, k can be 1.96 at a 95% confidence level. Represents the error covariance The arithmetic square root of the error covariance indicates that the larger the alignment estimation is, the stronger the fluctuation and the higher the risk of misjudgment. The threshold needs to be raised to increase the safety margin and avoid false negatives. θ represents the trend sensitivity coefficient. The first-order difference representing the optimal alignment is... This is used to characterize the changing trend of the optimal alignment. If the optimal alignment is in a rapidly decreasing trend, that is... A negative value with a large absolute value indicates that the hallucination is evolving rapidly, requiring a tightening of the threshold to trigger truncation earlier. Thus, by using both error covariance and alignment trend to achieve dynamic adaptive calibration of the threshold, the accuracy of truncation decisions can be further improved.

[0105] After determining the dynamic truncation threshold at each time step, the electronic device can compare the optimal alignment with the dynamic truncation threshold sequentially: if the optimal alignment is greater than or equal to the dynamic truncation threshold, it is determined to be a reliable output, and the corresponding word is accumulated into the effective word quantity, and the device continues to receive word fragments at the next time step; if the optimal alignment is less than the dynamic truncation threshold, it is determined to be a phantom output, and a truncation command is immediately sent to the large model to terminate the generation.

[0106] The above-mentioned statistics on valid and invalid lexical units may include: counting the number of lexical units generated before the truncation instruction takes effect and determined to be hallucination content as invalid lexical units, and counting the number of lexical units determined to be believable output as valid lexical units.

[0107] It should be noted that two strict distinctions can be made in actual statistics: ungenerated lexical units are not included in the actual billing cost. The first distinction is the actual number of invalid lexical units, i.e., the cost accounting distinction. This only counts the number of lexical units generated before the truncation command takes effect and determined to be hallucination content. That is, the lexical units actually generated from the start of the hallucination fragment to the completion of the truncation response. This part has already incurred actual billing and is the real cost of invalid lexical units, which is included in the invalid lexical unit count for cost accounting. The second distinction is the number of invalid lexical units avoided, i.e., the effect evaluation distinction. This represents the additional number of invalid lexical units that would be generated if the truncation were not performed and the large model continued to generate complete erroneous content. It can usually be calculated by the average generated length in the same scenario and the expected total length of the current context. This value is only used to evaluate the cost-saving effect of the embodiments of this application and is not included in the actual cost consumption, nor is it involved in the cost calculation of the lexical unit efficiency value. In short, the actual number of invalid lexical units only counts the generated hallucination fragments. The ungenerated part is only used as a reference indicator for effect evaluation and is not included in the actual billing and cost statistics.

[0108] In addition, electronic devices can calculate the total time taken from the initiation of a request to the completion of the final trusted output based on the generation timestamps attached to each word fragment, and record the number of illusion interceptions and regenerations.

[0109] In some implementations, the above method may further include: when the streaming generation of the large model is truncated, extracting the corresponding benchmark entries from the three-dimensional benchmark correlation matrix based on the dimension corresponding to the optimal alignment at the target time to generate correction prompts, and guiding the large model to be regenerated based on the correction prompts.

[0110] In this implementation, by reverse-locating the illusion dimension after truncation, extracting the corresponding benchmark entries to generate correction prompts, guiding the large model to regenerate, and performing alignment verification on the regenerated content again, a complete closed loop of detection, interception, error correction, and re-correction can be formed. This ensures the integrity of business output while blocking the continuous generation of invalid tokens and avoids business process interruption caused by truncation.

[0111] The aforementioned correction prompts can be prompts carrying factual truth constraints from the baseline entries, used to guide the large model to regenerate corresponding content based on real data. For example, in a cross-border e-commerce intelligent product selection scenario, if an electronic device's location illusion based on optimal alignment is a factual numerical deviation, the corresponding real sales data is extracted from the three-dimensional baseline correlation matrix, and a correction prompt with factual constraints is automatically generated. The content of this correction prompt is: Please reanalyze this product based on the following real data: The average monthly sales of folding storage boxes on a certain site are 12,000. Please do not exaggerate sales data. The large model regenerates the corresponding content based on this correction prompt. The regeneration process repeatedly executes alignment verification and truncation decisions. Finally, the alignment of the regenerated content stabilizes above 0.9, and is judged as a reliable output.

[0112] Furthermore, the intercepted hallucination samples can be automatically fed back to the contextualized factual benchmark knowledge base to continuously optimize the Bayesian alignment model and Kalman filter parameters, thereby achieving self-evolutionary improvement in hallucination recognition capabilities and lexical efficiency.

[0113] In some implementations, step S105 above, which calculates the lexical efficiency value based on the number of effective lexical units, the number of invalid lexical units, and the business value parameter using a non-linear value mapping method, may include the following steps 1) to 3): Step 1) Based on the ratio of effective word units to total word units, the output accuracy correction coefficient, and the benchmark value of unit business results in the business value parameter, the verifiable business value is calculated according to the saturated growth model. The total word unit is the sum of effective word units and invalid word units. The output accuracy correction coefficient is determined based on the mean of the optimal alignment at each time point and the entropy of the illusion uncertainty throughout the entire process.

[0114] Step 2) Based on the total time consumed throughout the entire process, calculate the time value decay coefficient according to the exponential decay model, and calculate the comprehensive cost based on the total number of lexical units, the cost per lexical unit, and the time value decay coefficient.

[0115] Step 3) Determine the ratio of verifiable business value to overall cost as the lexical efficiency value.

[0116] In this implementation, by introducing the real laws of diminishing marginal value and nonlinear decay over time, and combining them with the illusion uncertainty entropy correction, a verifiable quantitative mapping relationship between business value and the comprehensive cost of lexical units is established. This can replace the linear efficiency formula in related technologies, outputting lexical unit efficiency quantification results that are more in line with business realities, thereby forming a unified lexical unit efficiency measurement standard. This enables an upgrade from pricing by volume to pricing by value, providing a core accounting basis for the commercial pricing of trustworthy artificial intelligence services.

[0117] The above output accuracy correction coefficient can be obtained from the average alignment degree. It is not simply equal to the average alignment degree, but rather incorporates the entropy of the illusion uncertainty throughout the entire process: first, the comprehensive information entropy is calculated based on the optimal alignment degree sequence for the entire time period, and then the average alignment degree is corrected by the entropy reduction method. For details, please refer to the following formula (19): Formula (19) Where η represents the output accuracy correction coefficient; This represents the mean of the optimal alignment at each time point, i.e., the average alignment. The entropy represents the uncertainty of the illusion throughout the entire process, which can be a comprehensive information entropy calculated based on the optimal alignment sequence across all time periods. The higher the entropy value, the greater the fluctuation in alignment, the stronger the uncertainty in the illusion judgment, the lower the overall credibility of the output content, the greater the reduction of η, and the lower the corresponding business value, thereby realizing the correction of the final value by the uncertainty of the illusion.

[0118] The verifiable business value mentioned above can be the quantifiable actual value that the credible output content corresponding to this large model call, after illusion interception and quality verification, can bring to the business scenario. Its value unit is consistent with the benchmark value of the unit business result. Based on the law of diminishing marginal utility, the business value brought by effective words grows non-linearly, which can be calculated using a saturated growth model. Specifically, it can be referred to the following formula (20): Formula (20) Where V represents verifiable business value; Indicates the benchmark value of a unit's business results; This represents the value saturation coefficient; the higher the proportion of effective keywords, the closer the value approaches its maximum value. Indicates the number of valid word elements; V represents the total number of lexical units, which is the sum of valid and invalid lexical units; e represents the natural constant. The higher the proportion of illusion and the stronger the output uncertainty, the greater the reduction of V, thus reflecting the value attribute of reliable output.

[0119] The aforementioned time value decay coefficient can be used to characterize the non-linear decay of time on business value. It can be calculated using an exponential decay model, as shown in the following formula (21): Formula (21) in, This represents the time value decay coefficient; γ represents the time decay coefficient, the longer the time, the faster the value decays. This indicates the total time taken for the entire process.

[0120] The above comprehensive cost may include direct cost of word elements and opportunity cost of time, as can be seen in the following formula (22): Formula (22) Where C represents the total cost; Indicates the cost per unit word; This represents the opportunity cost per unit of time.

[0121] Ultimately, electronic devices can determine the lexical efficiency value as the ratio of verifiable business value to overall cost, as shown in the following formula (23): Formula (23) Here, F represents the lexical efficiency value, which represents the verifiable business value corresponding to unit cost input. The higher the value, the better the lexical utilization efficiency. In addition, the electronic device can also output results such as the effective lexical percentage, business value per lexical, overall accuracy, and compliance risk rate. All calculation parameters of the above results can be traced back to the aforementioned four types of basic input data, and are transmitted through three layers of probability alignment, alignment estimation, and truncation decision, achieving a strong correlation between input and output.

[0122] For example, in a cross-border e-commerce intelligent product selection scenario, the number of effective keywords is 2260, the total number of keywords is 2460, the effective keyword ratio is approximately 91.9%, the average output alignment is 0.91, and the benchmark value per unit of business output is... The value saturation coefficient is 2000 yuan. Taking 1.2, substituting it into formula (20), the verifiable business value V is approximately 1214 yuan; taking the time decay coefficient γ as 0.005 per second, the total time of the entire process is 72 seconds, substituting it into formula (21), the time value decay coefficient is calculated. The cost is approximately 0.70; the direct cost of the word element is 2460 multiplied by 0.0001 yuan, which equals 0.246 yuan. The opportunity cost of time is calculated at 5 yuan per minute, and the opportunity cost of 72 seconds is 6 yuan. Substituting into formula (22), the comprehensive cost C is calculated to be 2.046 yuan. Finally, substituting into formula (23), the word element efficiency value F is approximately 593.4, which means that for every 1 yuan of comprehensive cost invested, approximately 593 yuan of verifiable business value can be generated.

[0123] The following is a specific application example to illustrate the overall optimization method for large-model streaming word generation based on illusion interception in this application. This application example is applied to a cross-border e-commerce intelligent product selection software as a service (SaaS) system. A user submits a business request to the system to analyze the best-selling storage products in the home furnishing category of a certain platform in 2026. The system connects to a general large-model streaming output interface and utilizes the large-model streaming word generation efficiency optimization method based on illusion interception in this application to intercept illusionary content in real time and improve the business value per word. The system's pre-built scenario-based factual benchmark knowledge base contains verifiable data such as product sales, prices, category growth rates, and compliance prohibition rules for the platform over the past 12 months; the unit word cost is preset. The benchmark value of a single qualified product selection report is 0.0001 yuan per keyword. The cost is 2000 yuan, and the truncation loss coefficient λ is 0.05.

[0124] First, Bayesian probabilistic alignment modeling is performed. The system performs semantic parsing and feature extraction on user business requests, obtaining a core request feature set: category is home organization, site is a specific site, time period is 2026, and task objective is popular product selection and potential analysis. This feature set is used as evidence input to a pre-trained Bayesian network, and inference is completed through the sum-product belief propagation algorithm. Benchmark items with a posterior association probability greater than 0.7 are selected, resulting in 86 factual benchmarks, 12 business logic rules, and 8 compliance risk rules, forming a three-dimensional benchmark association matrix, and outputting a dimensional prior weight vector. =[0.6, 0.25, 0.15], which aligns with the business characteristic of prioritizing data accuracy in product selection scenarios.

[0125] Then, dynamic alignment estimation is performed using streaming. The large model starts streaming to generate a product selection report. The system synchronously acquires word fragments by sentence segment and performs three-dimensional verification and time-series smoothing calculations at each time step. The word fragments in paragraphs 1 to 8 provide an overview of industry background and category trends, and the alignment is based on factual dimensions. Stable within the range of 0.90 to 0.94, logical dimension alignment. Stable within the range of 0.87 to 0.91, with alignment in compliance dimensions. All values ​​are 1.0; the three-dimensional information entropy is calculated based on the fluctuation characteristics of the alignment of the first 8 segments, and the adaptive weights after entropy weight correction are obtained. =[0.58, 0.27, 0.15], which has a small deviation from the prior weights and conforms to the feature distribution of a normal generated scene; initial state estimate values The error covariance is 0.9. With a value of 0.01, prediction and update iterations are performed time-by-time, and the optimal alignment of the first 8 segments is determined. The value remained stable within the 0.89 to 0.93 range, without any abnormal fluctuations. When the 9th word segment was generated, the large model output that a certain folding storage box had monthly sales of over 120,000 units, ranking first in its category. The system extracted this value and compared it with the corresponding factual benchmark (the actual monthly sales of this product were 12,000 units) in the three-dimensional benchmark association matrix to determine the alignment of the factual dimension. The value plummeted to 0.22, and the weighted calculation yielded the original alignment observation. The value is 0.38, and after Kalman filtering update, the optimal alignment at time 9 is... The value was 0.42, showing a significant and precipitous drop, corresponding to a high-risk hallucination of factual value type.

[0126] Next, dynamic illusion truncation decision-making and effective lexical statistics are performed. The system calculates the dynamic truncation threshold in real time based on optimal stopping theory. Up to time step 9, the cumulative number of lexical units... The value is 1280. Substituting this value into the expected loss function, we can derive the current dynamic cutoff threshold. The value is 0.55. This is compared to the current optimal alignment. The value is 0.42, which is less than the dynamic truncation threshold of 0.55, thus meeting the truncation condition. The system immediately sends a generation termination command to the large model, truncating the current output stream. Before this truncation, a total of 1320 tokens were generated, of which [the number of valid tokens is missing]. The number is 1120, representing the number of invalid word meta-quantity. The value is 200. The system identifies the illusion type as factual numerical deviation based on optimal alignment. It extracts corresponding real sales data from the three-dimensional baseline correlation matrix, automatically generates correction prompts with factual constraints, and guides the large model to regenerate the corresponding content. During the regeneration process, alignment verification and truncation decisions are repeatedly executed. Finally, the alignment of the regenerated content stabilizes above 0.9, and is deemed a reliable output. The overall statistical results are: total word / meta consumption. The effective number of words is 2460. The number is 2260, representing the number of invalid word meta-quantity. The total time for the entire process is 200. The duration is 72 seconds, with 1 instance of illusion interception and 1 instance of regeneration.

[0127] Finally, a comprehensive lexical efficiency measurement is performed. The percentage of effective lexical units is considered. Approximately 91.9%, with an average output alignment of 0.91, is substituted into the saturated growth model. The calculated verifiable business value V is approximately 1214 yuan; taking the time decay coefficient γ as 0.005 per second, the time value decay coefficient is... The cost per unit is approximately 0.70; the direct cost per unit is 0.246 yuan, the opportunity cost per minute is calculated at 5 yuan, the opportunity cost for 72 seconds is 6 yuan, and the comprehensive cost C is 2.046 yuan; the final calculated unit efficiency value F is approximately 593.4, that is, every 1 yuan of comprehensive cost invested can generate approximately 593 yuan of verifiable business value.

[0128] Implementation Results Comparison: For similar requests using the traditional method of manual review after generation, the average token consumption is approximately 6200, the entire process takes about 25 minutes, manual review takes about 30 minutes, the data accuracy is about 62%, and the business conversion rate is less than 5%, translating to a token efficiency value of approximately 186 yuan per yuan. Compared to the traditional method, this application example reduces token consumption by 60.3%, shortens the entire process time by 72%, improves data accuracy to over 97%, increases token efficiency by 219%, and increases the business conversion rate to over 18%, demonstrating significant optimization effects. It is evident that the large-model streaming generation token efficiency optimization method based on illusion interception in this application embodiment can identify and intercept illusion content in real time during the streaming generation process, reducing invalid token consumption at the source, and establishing a business value-oriented token efficiency quantitative optimization system, significantly improving the token utilization efficiency of large-model streaming generation.

[0129] Based on the above embodiments of the method for optimizing the efficiency of large-scale streaming word generation based on illusion interception, this application also provides a specific implementation of the device for optimizing the efficiency of large-scale streaming word generation based on illusion interception.

[0130] like Figure 2 As shown in the embodiments of this application, the large-model streaming lexical generation efficiency optimization device 200 based on illusion interception provided may include: Data acquisition module 201 is used to acquire user business requests and a scenario-based fact benchmark knowledge base. The user business request includes business request text and business value parameters, and the scenario-based fact benchmark knowledge base includes multiple benchmark entries. Alignment modeling module 202 is used to perform Bayesian probabilistic alignment modeling based on user business requests and a scenario-based fact benchmark knowledge base to obtain a three-dimensional benchmark association matrix and prior weights for each dimension. The three-dimensional benchmark association matrix includes benchmark entries corresponding to the fact dimension, logic dimension and compliance dimension, respectively. The alignment estimation module 203 is used to obtain the word fragments generated by the large model at each time step during the streaming generation process of the large model in response to user business requests; for the word fragments at each time step, the alignment degree between the word fragments and the three-dimensional baseline association matrix in three dimensions is calculated; the prior weights of each dimension are corrected based on the information entropy of the alignment degree in the three dimensions to obtain the adaptive weights at each time step; the alignment degree in the three dimensions is weighted based on the adaptive weights to obtain the alignment degree observation value at each time step; and the alignment degree observation value at each time step is temporally estimated based on Kalman filtering to obtain the optimal alignment degree at each time step. The truncation decision module 204 is used to determine the dynamic truncation threshold at each time step based on the optimal alignment degree at each time step and the preset expected loss function, according to the optimal stopping rule. When the optimal alignment degree at the target time step is less than the dynamic truncation threshold at the target time step, the streaming generation of the large model is truncated, and the effective word tokens and invalid word tokens are counted. The target time step is any time step. The efficiency measurement module 205 is used to calculate the lexical efficiency value based on the number of effective lexical units, the number of invalid lexical units, and business value parameters, according to a non-linear value mapping method.

[0131] The large-model streaming lexical generation efficiency optimization device 200 based on illusion interception in this application embodiment is used to execute the large-model streaming lexical generation efficiency optimization method based on illusion interception in the above embodiment. Its specific processing procedure is the same as that of the large-model streaming lexical generation efficiency optimization method based on illusion interception in the above embodiment, and will not be described in detail here.

[0132] Figure 3 A schematic diagram of the hardware structure of the electronic device provided in an embodiment of this application is shown.

[0133] The electronic device may include a processor 301 and a memory 302 storing computer program instructions.

[0134] Specifically, the processor 301 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0135] Memory 302 may include mass storage for data or instructions. For example, and not limitingly, memory 302 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 302 may include removable or non-removable (or fixed) media. Where appropriate, memory 302 may be internal or external to an electronic device. In a particular embodiment, memory 302 is a non-volatile solid-state memory.

[0136] In some embodiments, memory 302 may include read-only memory (ROM), random access memory (RAM), disk storage media device, optical storage media device, flash memory device, electrical, optical, or other physical / tangible memory storage device. Thus, generally, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of this disclosure.

[0137] The processor 301 reads and executes computer program instructions stored in the memory 302 to implement any of the above embodiments of the large-scale streaming generation lexical efficiency optimization method based on illusion interception.

[0138] In one example, the electronic device may also include a communication interface 303 and a bus 310. For example, Figure 3 As shown, the processor 301, memory 302, and communication interface 303 are connected through bus 310 and complete communication with each other.

[0139] The communication interface 303 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0140] Bus 310 may include hardware, software, or both. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 310 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.

[0141] Furthermore, in conjunction with the large-model streaming lexical generation efficiency optimization method based on illusion interception in the above embodiments, this application embodiment can provide a computer-readable storage medium for implementation. This computer-readable storage medium stores computer program instructions; when executed by a processor, these computer program instructions implement any of the large-model streaming lexical generation efficiency optimization methods based on illusion interception in the above embodiments.

[0142] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0143] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0144] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0145] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0146] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A method for optimizing the efficiency of large-scale streaming generation of lexical units based on illusion interception, characterized in that, Includes the following steps: Obtain user business requests and a contextualized fact benchmark knowledge base. The user business requests include business request text and business value parameters, and the contextualized fact benchmark knowledge base includes multiple benchmark entries. Based on the user business request and the contextualized fact benchmark knowledge base, Bayesian probabilistic alignment modeling is performed to obtain a three-dimensional benchmark association matrix and prior weights for each dimension. The three-dimensional benchmark association matrix includes benchmark entries corresponding to the fact dimension, logic dimension and compliance dimension, respectively. During the process of the large model responding to the user's business request and generating data in a streaming manner, the word fragments generated by the large model at each time step are obtained. For each word fragment at each time step, the alignment degree between the word fragment and the three-dimensional baseline association matrix in the three dimensions is calculated. Based on the information entropy of the alignment degree in the three dimensions, the prior weights of each dimension are corrected to obtain the adaptive weights at each time step. Based on the adaptive weights, the alignment degree in the three dimensions is weighted and calculated to obtain the alignment degree observation value at each time step. Finally, based on Kalman filtering, the alignment degree observation value at each time step is temporally estimated to obtain the optimal alignment degree at each time step. Based on the optimal alignment at each time point and the preset expected loss function, the dynamic truncation threshold at each time point is determined according to the optimal stopping rule. If the optimal alignment at the target time point is less than the dynamic truncation threshold at the target time point, the streaming generation of the large model is truncated, and the effective word count and invalid word count are counted. The target time point is any time point among the aforementioned time points. Based on the number of effective lexical units, the number of invalid lexical units, and the business value parameters, the lexical efficiency value is calculated using a non-linear value mapping method.

2. The method for optimizing the efficiency of large-scale streaming generation of lexical units based on illusion interception according to claim 1, characterized in that, The Bayesian probabilistic alignment modeling based on the user's business request and the contextualized factual benchmark knowledge base yields a three-dimensional benchmark association matrix and prior weights for each dimension, including: Construct a Bayesian network, which includes a request feature node, a baseline association node corresponding one-to-one with multiple baseline entries, and an illusion risk node. The request feature node is the parent node of the baseline association node, and the baseline association node is the parent node of the illusion risk node. Using the request features extracted from the business request text as evidence, belief propagation reasoning is performed through the Bayesian network to obtain the posterior association probability between each benchmark item and the user's business request; From multiple benchmark entries, benchmark entries with a posterior association probability greater than a preset probability threshold are selected. The three-dimensional benchmark association matrix is ​​constructed according to the fact dimension, the logic dimension, and the compliance dimension. The prior weight of each dimension is determined based on the scenario type of the user's business request.

3. The method for optimizing the efficiency of large-scale streaming generation of lexical units based on illusion interception according to claim 1, characterized in that, The calculation of the alignment between the lexical fragment and the three-dimensional baseline association matrix in the three dimensions includes: The alignment of the fact dimension is calculated based on the deviation rate between the fact information in the lexical fragment and the benchmark entry corresponding to the fact dimension. The logical consistency probability between the lexical fragment and the benchmark entry corresponding to the logical dimension is calculated based on the semantic entailment model to obtain the alignment degree of the logical dimension. Based on rule matching and risk semantic recognition, the compliance matching degree between the lexical fragment and the benchmark item corresponding to the compliance dimension is calculated to obtain the alignment degree of the compliance dimension; The user service request further includes a maximum output error tolerance, and the calculation of the alignment of the fact dimension based on the deviation rate between the fact information in the lexical fragment and the benchmark entry corresponding to the fact dimension includes: If the deviation rate is less than or equal to the maximum output error tolerance, the alignment of the fact dimension is determined to be 1. If the deviation rate is greater than the maximum output error tolerance, the alignment of the fact dimension is reduced by the proportion by which the deviation rate exceeds the maximum output error tolerance.

4. The method for optimizing the efficiency of large-scale streaming generation of lexical units based on illusion interception according to claim 1, characterized in that, The method of correcting the prior weights of each dimension based on the information entropy of the alignment of the three dimensions to obtain the adaptive weights at each time step includes: For each dimension, the information entropy of the dimension is calculated based on the normalized proportion of the alignment of the dimension at each time up to the target time, and the entropy weight coefficient of each dimension is calculated based on the information entropy of each dimension. For each dimension, the prior weights and entropy weights of the dimension are weighted according to a preset balance factor to obtain the intermediate weights of the dimension. The intermediate weights of the three dimensions are normalized to obtain the adaptive weights at the target time, and the sum of the adaptive weights is 1.

5. The method for optimizing the efficiency of large-scale streaming generation of lexical units based on illusion interception according to claim 1, characterized in that, The step of performing time-series estimation of the alignment observations at each of the aforementioned times based on Kalman filtering to obtain the optimal alignment at each of the aforementioned times includes: Using the actual alignment at each stated time as the state variable and the observed alignment at each stated time as the observation variable, a state equation and an observation equation are constructed. For the target time, prediction is made based on the optimal alignment and error covariance of the previous time to obtain the prior state estimate and prior error covariance of the target time. The Kalman gain is calculated based on the prior error covariance and the observation noise covariance, and the prior state estimate is updated based on the Kalman gain and the alignment observation at the target time to obtain the optimal alignment at the target time. Based on the variance of the observation residuals at recent times, the process noise covariance and the observation noise covariance are adaptively adjusted, wherein the initial values ​​of the process noise covariance and the observation noise covariance are preset initial noise parameters.

6. The method for optimizing the efficiency of large-scale streaming generation of lexical units based on illusion interception according to claim 1, characterized in that, The determination of the dynamic truncation threshold for each time step based on the optimal alignment and a preset expected loss function according to the optimal stopping rule includes: Based on the optimal alignment, cumulative word count, unit word cost, truncation loss coefficient, illusion omission loss coefficient, and unit business result benchmark value at each time point, an expected loss function is constructed, which includes invalid word cost loss, truncation business loss, and illusion omission loss. The expected loss function is solved based on the optimal stopping rule to obtain the baseline truncation threshold at each time point. The baseline truncation threshold is then corrected based on the changing trends of the error covariance and optimal alignment at each time point to obtain the dynamic truncation threshold at each time point. The statistical analysis of valid and invalid lexical units includes: counting the number of lexical units generated before the truncation instruction takes effect and determined to be hallucination content as the invalid lexical units, and counting the number of lexical units determined to be believable output as the valid lexical units; The method further includes: when the streaming generation of the large model is truncated, extracting the corresponding benchmark entries from the three-dimensional benchmark correlation matrix based on the dimension corresponding to the optimal alignment at the target time to generate correction prompts, and guiding the large model to be regenerated based on the correction prompts.

7. The method for optimizing the efficiency of large-scale streaming generation of lexical units based on illusion interception according to claim 1, characterized in that, The step of calculating the lexical efficiency value based on the effective lexical quantity, the invalid lexical quantity, and the business value parameter using a non-linear value mapping method includes: Based on the ratio of the effective word units to the total word units, the output accuracy correction coefficient, and the unit business result benchmark value in the business value parameter, the verifiable business value is calculated according to the saturated growth model. The total word units are the sum of the effective word units and the invalid word units. The output accuracy correction coefficient is determined based on the mean of the optimal alignment at each time point and the entropy of the full-process illusion uncertainty. Based on the total time consumed throughout the entire process, the time value decay coefficient is calculated according to the exponential decay model, and the comprehensive cost is calculated based on the total number of lexical units, the unit cost of lexical units, and the time value decay coefficient. The ratio of the verifiable business value to the overall cost is determined as the lexical efficiency value.

8. A device for optimizing the efficiency of large-scale streaming generation of lexical units based on illusion interception, characterized in that, include: The data acquisition module is used to acquire user business requests and a scenario-based fact benchmark knowledge base. The user business request includes business request text and business value parameters, and the scenario-based fact benchmark knowledge base includes multiple benchmark entries. The alignment modeling module is used to perform Bayesian probabilistic alignment modeling based on the user business request and the contextualized fact benchmark knowledge base to obtain a three-dimensional benchmark association matrix and prior weights for each dimension. The three-dimensional benchmark association matrix includes benchmark entries corresponding to the fact dimension, logic dimension and compliance dimension, respectively. The alignment estimation module is used to obtain the word fragments generated by the large model at each time step during the streaming generation process of the large model in response to the user's business request; for each word fragment at each time step, the alignment degree between the word fragment and the three-dimensional baseline association matrix in the three dimensions is calculated; the prior weights of each dimension are corrected based on the information entropy of the alignment degree in the three dimensions to obtain the adaptive weights at each time step; the alignment degree in the three dimensions is weighted based on the adaptive weights to obtain the alignment degree observation value at each time step; and the alignment degree observation value at each time step is temporally estimated based on Kalman filtering to obtain the optimal alignment degree at each time step. The truncation decision module is used to determine the dynamic truncation threshold for each time step based on the optimal alignment degree and the preset expected loss function according to the optimal stopping rule, and to truncate the streaming generation of the large model when the optimal alignment degree at the target time is less than the dynamic truncation threshold at the target time, and to count the number of effective and invalid lexical units, wherein the target time step is any time step among the time steps. The efficiency measurement module is used to calculate the lexical efficiency value based on the number of effective lexical units, the number of invalid lexical units, and the business value parameters, according to a non-linear value mapping method.

9. An electronic device, characterized in that, The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the large-model streaming generation lexical efficiency optimization method based on illusion interception as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the large-model streaming lexical efficiency optimization method based on illusion interception as described in any one of claims 1 to 7.