An evidence-driven closed-loop reasoning control method and system for generative models
By adopting an evidence-driven closed-loop reasoning control method, the problem of uncontrollable generation process of large language models in open-world tasks is solved, and verifiable and auditable reliable results are output under budget constraints, thereby improving the practicality and credibility of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TSINGHUA SHENZHEN INTERNATIONAL GRADUATE SCHOOL
- Filing Date
- 2026-06-08
- Publication Date
- 2026-07-31
AI Technical Summary
Large language models lack continuous and rigid constraints on external evidence in open-world tasks, resulting in uncontrollable, unreproducible, and unauditable generation processes. This leads to problems such as evidence-conclusion decoupling, unreliable tool triggering, semantic drift during revisions, and high-risk illusions.
By constructing an evidence-driven closed-loop reasoning control method, a central state is maintained and a closed-loop control process of routing, gating, execution, and rollback is driven. The router selects actions using budgeted value information, performs evidence gating decisions and minimum difference rollback revisions, and ensures that the generation process outputs verifiable and auditable reliable results under budget constraints.
It achieves controllable, auditable, and reliable results for generative models under budget constraints, significantly improving the practicality and credibility of models in open-world tasks, avoiding unproven assertions and semantic drift, and ensuring the reproducibility and traceability of the reasoning process.
Smart Images

Figure CN122347229B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and natural language processing technology, and in particular to a control method, system and apparatus for achieving verifiable and auditable truth-seeking reasoning under budget constraints for generative models such as large language models. Background Technology
[0002] Currently, large language models face core challenges in open-world tasks: their generation process heavily relies on the self-consistency of internal parameters and lacks a mechanism for continuous and rigid constraints on external evidence. This leads to systemic problems such as "evidence-conclusion decoupling" (i.e., generated assertions lack verifiable evidence support), "tool-triggered unreliability" (i.e., the model struggles to reliably decide when and how to invoke external tools for verification), "revision semantic drift" (i.e., regeneration leads to inconsistencies when errors are discovered), and "high-risk illusion" (i.e., giving highly certain assertions even with insufficient evidence).
[0003] Existing solutions largely focus on prompt engineering or external retrieval enhancement techniques. These methods operate outside the model, failing to form a trainable and auditable closed-loop control. This makes the model's reliability highly dependent on the randomness of prompt words, and unable to achieve stable convergence (i.e., convergence towards a true and reliable conclusion) within a given budget (such as computing resources, time, and number of tokens). Specifically, existing technologies lack a unified control plane to collaboratively manage inference objectives, uncertainty quantification, resource budgeting, evidence collection, claim adjudication, and audit logs, resulting in an uncontrollable, unreproducible, and unauditable inference process.
[0004] Therefore, there is an urgent need in this field for a system-level solution that can elevate evidence to a first-order control variable in the reasoning process and ensure, through a closed-loop control mechanism, that generative models output verifiable and auditable reliable results under budget constraints. Summary of the Invention
[0005] The technical problem this invention aims to solve is how to transform the reasoning process of generative models from a black-box process that relies on internal parameter self-consistency into a controllable, auditable process that converges (approaches truth) towards a true and reliable conclusion under the rigid constraints of external evidence and a limited resource budget. Specifically, it addresses shortcomings such as "evidence-conclusion decoupling," "unreliable tool triggering," "semantic drift in revisions," and "high-risk illusions."
[0006] The technical problem of this invention is solved by the following technical solution: In a first aspect, the present invention provides an evidence-driven closed-loop reasoning control method for generative models, wherein the evidence-driven closed-loop reasoning control method is implemented by a processor executing a computer program stored in a memory, and includes the following steps: S1. Maintain the central state, wherein the central state includes: problem objective, structured uncertainty vector representing uncertainty in the reasoning process, unified budget ledger, evidence pool, atomic claim set and immutable circular log; S2. Based on the current state of the central state, select an action from a predefined set of actions through a budgeted value information router, wherein the selection of the action aims to maximize the expected reduction in unit budget uncertainty under the constraints of the unified budget ledger. S3. Execute the selected action and update the evidence pool and / or the atomic claim set based on the execution result; S4. Perform evidence gating adjudication on each atomic claim in the atomic claim set. The evidence gating adjudication is based on the support, reliability and conflict relationship of the evidence associated with the atomic claim in the evidence pool, and outputs a ruling result of pass, postponement or failure. If the ruling is postponed or fails, and a verifiable path exists, a sandbox execution action is triggered to obtain new evidence and update the evidence pool, and the affected atomic claims are revised with minimum difference rollback based on the new evidence. When the preset termination condition is met, the reasoning process terminates and a structured result is output. The structured result includes at least the set of atomic claims, the evidence index associated with each atomic claim, and a summary of residual uncertainty.
[0007] In some embodiments, the following technical features are also included: In step S1, the structured uncertainty vector includes at least one of the following dimensions: uncertainty of the candidate conclusion itself, evidence sufficiency gap, necessity of performing verification, risk of tool specification consistency, and exposure to high-risk assertions.
[0008] In some embodiments, in step S2, the predefined set of actions includes at least one of the following actions: internal reasoning, external retrieval, memory lookup, sandbox execution, and submission.
[0009] In some embodiments, the objective function of the budgeted value information router selection action in step S2 is:
[0010] in, For optimal action, t The loop count index is used, and argmax is the action that maximizes the objective function. A Let w be the set of actions, and w be a five-dimensional non-negative weight vector. T It is the transpose symbol. It is in state S t Next action The uncertainty of the vector form decreases. For cost function, Small positive constants This means "the following constraints are satisfied". This represents the budget update equation for deducting costs.
[0011] In some embodiments, in step S4, the rules for the evidence gating decision include: The ruling is passed if and only if the atomic claim is bound to a valid evidence pointer, the reliability-weighted support of the evidence exceeds a threshold, and there is no unresolved high-intensity conflict evidence. When there is insufficient evidence or unresolved conflicts, but a clear path for further verification exists, the ruling is to postpone the decision. When a high-risk claim lacks any supporting evidence or when there is solid evidence to refute it, the ruling is unsuccessful.
[0012] In some embodiments, in step S1, the unified budget ledger uniformly quantifies and manages at least one heterogeneous resource among lexical consumption, tool calls, execution time, and loop steps.
[0013] In a second aspect, the present invention provides an evidence-driven closed-loop reasoning control system for generative models, the evidence-driven closed-loop reasoning control system comprising a processor and a memory. The memory stores computer programs; The processor is configured to implement the evidence-driven closed-loop reasoning control method described above when executing the computer program.
[0014] Thirdly, the present invention provides a computing device including the aforementioned evidence-driven closed-loop reasoning control system.
[0015] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described evidence-driven closed-loop reasoning control method.
[0016] Fifthly, the present invention provides a method for storing or transmitting a bit stream, comprising: The above-described evidence-driven closed-loop reasoning control method is executed to generate a structured result bitstream; and the structured result bitstream is stored or transmitted.
[0017] Sixthly, the present invention provides an evidence-gated adjudication device, which is applied to the above-mentioned evidence-driven closed-loop reasoning control system, comprising: The claim acquisition module is configured to acquire atomic claim sets. The evidence query module is configured to query evidence information associated with atomic claims in the atomic claim set from the evidence pool; The adjudication module is configured to perform evidence-gated adjudication on each atomic claim based on the associated evidence information. The adjudication is based on the support, reliability, and conflict relationship of the evidence associated with the atomic claim in the evidence pool, and outputs an adjudication result of pass, postponement, or failure. The status update module is configured to write the adjudication result into the central status data or audit log data of the inference control system to drive subsequent inference action decisions or trigger claim rollback updates.
[0018] In some embodiments, the adjudication rules of the adjudication module include: The ruling is passed if and only if the atomic claim is bound to a valid evidence pointer, the reliability-weighted support of the evidence exceeds a threshold, and there is no unresolved high-intensity conflict evidence. When there is insufficient evidence or unresolved conflicts, but a clear path for further verification exists, the ruling is to postpone the decision. When a high-risk claim lacks any supporting evidence or when there is solid evidence to refute it, the ruling is unsuccessful.
[0019] In a seventh aspect, the present invention provides an evidence-driven closed-loop reasoning control method for generative models, wherein the evidence-driven closed-loop reasoning control method is implemented by a processor executing a computer program stored in a memory, and includes the following steps: F1. Initialize and maintain the central state, which includes at least the unified budget ledger, evidence pool, and atomic claim set; F2. Based on the current state of the central state, select actions from a predefined set of actions through a budgeted value information router. The set of actions includes code generation, code retrieval, static analysis execution, and dynamic test execution. The action selection aims to maximize the expected reduction in unit budget uncertainty under the constraints of the unified budget ledger. F3. Execute the selected action. If the action is code generation, update the atomic claim set. If the action is static analysis or dynamic test execution, store the tool output report as an evidence block in the evidence pool. F4. Perform evidence-gated adjudication on each atomic claim in the atomic claim set, the evidence-gated adjudication being based on compiler warnings, static analysis results, test coverage and memory check reports associated with the claim in the evidence pool, and outputting an adjudication result of pass, deferred or fail; If the ruling is postponed or fails, and there is a path that can be verified through further static analysis or dynamic testing, then the corresponding sandbox execution action is triggered to obtain new evidence and update the evidence pool, and the affected code segment and the corresponding atomic claim are revised by minimum difference rollback based on the new evidence. When the preset termination conditions are met, the code generation and verification process is terminated, and a structured result is output. The structured result includes at least the final code that has been adjudicated, an evidence index associated with the security claims in the code, a summary of residual uncertainties, and a budget execution audit report.
[0020] In some embodiments, the unified budget ledger quantifies the resource consumption of code generation, static analysis, and dynamic testing using a unified computing unit as the standard; the evidence pool stores output reports from compilers, static analysis tools, unit testing frameworks, and dynamic analysis tools; the atomic assertion set derives atomic assertions related to code security by parsing the abstract syntax tree of the generated code; the central state at least includes: The problem objective is defined as the security specifications and functional requirements of the code to be generated; Structured uncertainty vectors are used to quantify the uncertainties in the generated code regarding functional correctness, specification compliance, and memory safety.
[0021] In some embodiments, in step F1, the dimensions of the structured uncertainty vector include: uncertainty regarding the correctness of the generated code, uncertainty regarding whether the code conforms to secure coding standards such as MISRAC, uncertainty regarding the existence of undetected memory security vulnerabilities, and uncertainty regarding whether the code passes all predetermined test cases.
[0022] In some embodiments, in step F3, the static analysis tool includes Clang Static Analyzer, the dynamic analysis tool includes Valgrind Memcheck, and the unit testing framework is CppUTest; when the tool output reports are stored in the evidence pool as evidence blocks, they all include the tool name, version, runtime timestamp, and reliability score.
[0023] In some embodiments, in step F4, the rules for the evidence gating decision include: The decision is passed if and only if an atomic claim (such as "a non-null check was performed before pointer dereference") has a corresponding static analysis pass report and a dynamic test pass report in the evidence pool that have a reliability exceeding the threshold and are conflict-free. When an atomic claim lacks sufficient test coverage or has unresolved static analysis warnings, the ruling is suspended. When an atomic claim is reported as a conclusive security flaw by static analysis or dynamic testing tools, the ruling is deemed invalid.
[0024] In some embodiments, in step F4, the minimum differential rollback revision specifically involves: using a code diffing tool to locate the disproven code segment, performing a security rewrite only on that code segment, and synchronously updating the atomic claim set, rather than regenerating all the code.
[0025] The beneficial effects of this invention compared to the prior art include: This invention constructs and maintains a central state integrating a unified budget ledger, evidence pool, and atomic claim set. Based on this state, it drives a closed-loop control process including a budgeted value information router, evidence-gated adjudication, sandbox execution triggering, and minimum differential rollback revision. This overall technical solution elevates evidence from post-generation auxiliary information to a core control variable in the reasoning process. The core function of this technical solution is to achieve unified governance of heterogeneous resources through a unified budget ledger, ensuring cost control; to enforce that each atomic claim must be bound to verifiable evidence and explicitly handle conflicts through evidence-gated adjudication, thus eliminating passive assertions and silent overwriting; and to avoid semantic drift caused by traditional regeneration through minimum differential rollback revision, ensuring the accuracy and traceability of revisions. These technical features work synergistically to transform the reasoning process of generative models from a black-box process relying on internal representation self-consistency into a budget-controlled, auditable "truth-oriented" convergence process under rigid external evidence constraints. Therefore, this invention ultimately achieves the ability of generative models to output highly reliable and verifiable structured results within a given budget, significantly improving the practicality and credibility of the model in open-world tasks. It is precisely by combining the explicit representation of uncertainty (structured uncertainty vector) with the unified quantification of resources (unified budget ledger) that the decision objective of maximizing the reduction of uncertainty per unit budget (budgeted value information router) is achieved. The execution results of this decision-driven action provide input for evidence-gated adjudication and trigger sandbox execution and minimum difference rollback when the adjudication fails. These interconnected features constitute a complete closed-loop control system, ultimately achieving the aforementioned beneficial effects in a coordinated manner.
[0026] In addition, some embodiments also have the following beneficial effects: By making the implicit uncertainty of the model explicit and quantifiable through the structured uncertainty vector, a clear signal is provided for decision-making. Furthermore, through the multiple specific dimensions of the structured uncertainty vector, different sources of risk in the reasoning process can be characterized more precisely, making routing decisions and gating decisions more targeted.
[0027] By providing a diverse set of actions, the system offers flexible problem-solving paths and can select the optimal strategy based on the specific context.
[0028] By using the objective function, quantitative optimization of action selection under budget constraints is achieved, ensuring that resources are allocated to the links that can most efficiently reduce uncertainty.
[0029] By establishing specific adjudication rules, clear and operable standards are provided for evidence gating, ensuring the consistency and reliability of adjudication results.
[0030] Unified budget management simplifies the complexity of resource allocation and cost control.
[0031] Other beneficial effects of the embodiments of the present invention will be further described below. Attached Figure Description
[0032] Figure 1 This is a flowchart of an evidence-driven closed-loop reasoning control method for generative models in an embodiment of the present invention.
[0033] Figure 2 This is a schematic diagram of the core principle mechanism of the E³-Loop architecture in this embodiment of the invention.
[0034] Figure 3a and Figure 3b These are schematic diagrams of Phase 1 and Phase 2 of the hierarchical closed-loop architecture of the five elements embedded in the E³-Loop in the embodiments of the present invention.
[0035] Figure 4a and Figure 4b These are schematic diagrams of Phase 1 and Phase 2 of the base skin and parallel extension component architecture in the embodiments of the present invention.
[0036] Figure 5 This is a single-round decision-making flowchart of the E³-Loop in an embodiment of the present invention.
[0037] Figure 6 This is a schematic diagram of the stabilization layer structure for mHC mapping and residual fusion in an embodiment of the present invention.
[0038] Figure 7 This is a closed-loop flowchart of the E³-Loop controller driving Sandbox for evidence collection and proof carrying prompts in an embodiment of the present invention. Detailed Implementation
[0039] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. It should be noted that the embodiments of the present invention are intended to provide a deep understanding of the present invention, and their specific parameters, processes, and architectural details should not be construed as limiting the scope of protection of the present invention.
[0040] In the current international context, the competitive focus of large language models has clearly shifted from the linear narrative of "larger parameters = stronger capabilities" to the system capability level of "verifiable inference control, compressible cost curves, and constrainable runtime behavior." This directly aligns with the closed-loop technology of inference control-evidence alignment-tool execution addressed in the embodiments of this invention. Specifically, at the structural level, the sparsity approach represented by MoE (Mixture of Experts) uses routers to perform Top-k (first k) expert selection on tokens, and uses load balancing loss and capacity factor to control expert congestion, so that capacity expansion is no longer equivalent to a linear increase in FLOPs per token. At the inference service level, the memory usage, fragmentation, and scheduling latency of KVcache are considered decisive bottlenecks. Through prefill / decode separation, paginated KV management, and batch processing strategies, the conflicts of long contexts and high concurrency are transformed into an engineeringable resource allocation problem. More importantly, the new trend toward reliability shapes the model into an "actionable runtime system" that explicitly performs retrieval, computation, and verification in a constrained tool interface and sandbox environment. This upgrades the "generate-execute-feedback-revise" process from a hinting technique to a replayable trajectory and an auditable closed loop, thereby binding inference quality and inference budget within the same control framework and avoiding the substitution of evidence and verification with lengthy, self-consistent narratives when uncertain.
[0041] In parallel with the aforementioned international trend towards controllability, the development of large language models in China was constrained earlier by the hard constraints of computing power cost, deployment density, and delivery stability. Therefore, its technical approach is more focused on the coupling of sparse structures and inference system engineering, thus more quickly revealing the systemic gap caused by the "lack of a trainable control plane." On the one hand, domestic models generally use MoE sparsity and routing governance to reduce the cost per token, and improve the controllability of online services through routing stability, overflow strategies, and tail latency management. On the other hand, long context deployment emphasizes prefill acceleration, chunked scheduling, kernel pipelining, and bandwidth optimization, transforming the question of "how long can be read" into engineering problems such as "whether prefill scales linearly, whether memory access is controllable, and whether concurrent throughput is stable."
[0042] It is precisely under such strong engineering constraints that, if the rigid binding of evidence and conclusion is still lacking, citation drift and passive assertions are prone to occur; if the judgment and back-injection constraints for execution triggering are lacking, tool calls will be highly sensitive to contextual noise, resulting in false triggers / missed triggers. If the differential consistency and rollback mechanism for revision is lacking, error correction will degenerate into regeneration and cause belief drift; high-risk tail illusions will be masked by average indicators and erupt in key scenarios. From the perspective of functional differentiation rather than biological isomorphism, the internal synergy of current large language models in task allocation, attention focus, language organization, and semantic integration can approximate some of the functions of the prefrontal cortex, parietal cortex, Broca's area, and Wernicke's area in the human brain, but its fundamental limitation shared with the human brain is that the system mainly relies on the self-consistent reorganization between existing representations to complete judgment, reasoning, and generation, rather than continuously, directly, and bindingly taking in and correcting external evidence during operation. Therefore, evidence should not be regarded as supplementary information in the existing generation chain, but rather as a key fulcrum propelling large language models from "internal representation closure" to "external constraint convergence." This is precisely the most fundamental and long-neglected core issue in the current architectural evolution. Specific research gaps are as follows:
[0043] The decoupling of evidence and conclusion remains a structural gap: the generation process lacks a hard protocol that "assertions must carry locatable evidence pointers and explicitly preserve conflict relationships," leading to reference drift, passive assertions, and silent overriding of conflicts in long contexts or multi-source splicing, which are difficult to suppress stably through cue engineering.
[0044] Tool triggering strategies lack learnable runtime states: current triggering decisions are often approximated by templates, static rules, or lightweight classifiers, lacking a joint representation of evidence sufficiency, verifiability, action cost, and failure risk. This makes the system highly sensitive to wording and noise, resulting in budget and tail delay inflation caused by false triggers, and missed triggers causing the system to continue generating and forming a chain of errors during the verification process.
[0045] The computational allocation during the inference period is generally rigid: difficult and easy problems share a nearly isomorphic decoding process, and the model can only pretend to delve deeper into inference by "generating more text," but it lacks a controllable mechanism to direct the extra budget to retrieval, execution, and verification. Therefore, the increase in cost does not necessarily translate into a gain in reliability.
[0046] The revision lacks "version semantics" and differential constraints: When faced with new evidence or error correction needs, the model tends to replace the minimum necessary update with regeneration. The change boundary is uncontrollable, the commitment is inconsistent and semantic drift occurs frequently, and there is no verifiable binding between the revision reason and the evidence increment, making it difficult to maintain controllability for multi-round collaboration and iterative tasks.
[0047] High-risk tail illusions are difficult to manage with average metrics: when there is insufficient evidence, conflicting information, or ambiguity in the question, the system may still make a highly certain assertion; traditional training and evaluation tend to optimize the average accuracy rate, lacking a scalable monitoring and adjudication loop for "conservative exit when lacking evidence, clarification or verification of conflicts, and meeting the evidence threshold for key assertions".
[0048] Control and auditing often remain at the "glue layer," lacking a unified behavioral contract: memory retrieval, rejection strategies, tool injection, and anomaly avoidance are not solidified into optimizable goals and replayable state transitions, resulting in online behaviors that are not attributable and cannot be retrained. The larger the system, the more difficult it is to converge the triggered deviations.
[0049] After the bottlenecks of long context and high concurrency inference stack are solved by engineering, new contradictions are amplified: control information such as evidence blocks, audit logs, and tool specifications will directly compete for resources with KV cache bandwidth, scheduling strategies and memory fragmentation. If budget governance and structured compression strategies are lacking, the introduction of the control plane may worsen tail latency and reduce system throughput.
[0050] Furthermore, current parameter fine-tuning projects, while fundamentally addressing the instability of current large language models in open tasks, have dragged the R&D process into a high-investment, low-certainty cycle of "evaluation-regression-re-parameter tuning." A single round of fine-tuning often means not only a continuous stacking of data cleaning, sample construction, training scheduling, and hyperparameter search, but also a subsequent exponentially expanded metric retesting, scenario regression, manual review, and version comparison. The workload and computational consumption often far exceed the apparent training cost itself. More importantly, given the rapid iteration and continuously rising capability boundaries of open-source foundation models like DeepSeek and Qwen, parameter patching implemented to address a single defect is often partially covered by the capabilities of the new generation of foundation models before stable verification is completed. This ultimately leads to a structural dilemma of "long adaptation cycles, high verification costs, short benefit windows, and weak overall gains." Therefore, what is truly scarce at this stage is no longer the ability to continue making localized repairs around the parameter layer, but rather the ability to build a control plane that can steadily improve system performance within a given budget, so that system performance no longer relies primarily on expensive and fragile repeated fine-tuning, but can instead achieve stable improvements through a trainable, auditable, and reproducible control plane.
[0051] The aforementioned gaps all point to the same necessity: simply relying on a larger base, longer context, or stronger alignment cannot fundamentally eliminate the structural mismatch of "being able to talk but not stable." It is necessary to elevate "evidence gating - execution verification - rollback revision - budget termination - immutable log" into a trainable and auditable operating mechanism. This will significantly reduce the variance of the model achieving similar performance metrics (such as validation set loss) in multiple independent training runs, thereby improving the repeatability and stability of the training process.
[0052] The core of this invention lies in providing an evidence-driven closed-loop reasoning control method and system, which, for simplicity, is also referred to below as the E³-Loop (Evidence-Enhanced-Efficient Loop) architecture. This architecture drives a closed-loop control process of "routing → gating → execution → rollback → termination" by building and maintaining a central state, thereby achieving the objectives of this invention. The core inventions of this architecture include: 1) Building and maintaining a central state to uniformly manage reasoning objectives, uncertainties, budgets, evidence, claims, and audit logs; 2) Based on this central state, driving a mandatory closed-loop control process of "routing → gating → execution → rollback → termination," where routing decisions are based on budgeted value information, aiming to maximize the reduction of uncertainty per unit budget; 3) Through an evidence gating mechanism, mandating that all output claims must be bound to verifiable evidence and explicitly handling unresolved conflicts; 4) When gating fails, triggering sandbox execution to obtain new evidence and implementing minimum difference rollback revision to avoid full rewriting; 5) Using measurable conditions (such as budget exhaustion or uncertainty below a threshold) as the termination basis, outputting structured results with accompanying evidence indexes and audit information.
[0053] To address the aforementioned technical shortcomings, such as "generative self-consistency replacing factual constraints, lack of reproducible adjudicative semantics in tool-triggered mechanisms, and the susceptibility to drift and difficulty in auditing multiple rounds of revisions," this invention proposes the "E³-Loop" architecture for evidence-driven closed-loop truth-seeking intelligent reasoning and generation. Its core innovation lies in elevating evidence from a post-generational, supplementary support to a primary control variable throughout the entire process of reasoning, execution, revision, and termination. By continuously implementing evidence constraints, conflict adjudication, and closed-loop correction during runtime, it transforms the large language model from a probabilistic generation mechanism relying on internal representational self-consistency into an evidence-driven truth-seeking mechanism oriented towards the open world. Its uniqueness lies in the fact that E³-Loop does not simply attribute problems to insufficient base parameters, but rather returns to the cognitive structure of the brain based on first principles. While existing large language models have functionally formed a collaborative chain of approximate prefrontal cortex-based policy control, parietal cortex-based attentional integration, Broca's area-based representation generation, and Wernicke's area-based semantic understanding, their reasoning process, like human cognition, is still primarily based on the self-consistent reorganization of internal representations. They lack a rigid mechanism for continuously acquiring external evidence, explicitly defining conflicts, and rewriting refutations during operation. Therefore, once entering open-world scenarios with multi-source information and executable tasks, generation, triggering, revision, and risk suppression can easily become unstable simultaneously. Given that there is currently no operable "beyond the human brain" cognitive paradigm, this invention adopts a higher-order cognitive control approach borrowed from scientific researchers: "hypothesis generation - external evidence acquisition - contradiction identification - differential revision - re-verification closed loop." It systematically establishes evidence as the primary control object across the entire chain of reasoning, execution, revision, and output, proposing an evidence-driven closed-loop truth-seeking intelligent reasoning and generation architecture based on E³-Loop.
[0054] It is worth noting that the innovative design of E³-Loop is not a low-level computational backbone at the same level as Transformer, Mamba, or MoE, nor does it replace operator mechanisms such as attention. Instead, it is an evidence-driven reasoning control architecture and runtime control plane located above the base model. It addresses not the problem of training a single model, but rather the long-standing lack of a unified constraint mechanism for conclusion validity, tool triggering, revision rollback, and risk mitigation under open-world conditions. To this end, this invention uses evidence objects, state transitions, execution decisions, differential revisions, and budget governance as a unified control unit. This enables the system to achieve low-cost adaptation, multi-scenario migration, and rapid iteration to multiple open-source or closed-source base models while retaining the representational capabilities of the existing base model. This is achieved through efficient parameter tuning and context engineering, thereby transforming the capability enhancement path of large language models from high-cost, low-determinism iterative parameter fine-tuning to a trainable, auditable, and reproducible operational mechanism centered on evidence constraints.
[0055] Example 1 This embodiment provides an evidence-driven closed-loop reasoning control method for generative models. The evidence-driven closed-loop reasoning control method is implemented by a processor executing a computer program stored in memory, and includes the following steps: S1. Maintain the central state, wherein the central state includes: problem objective, structured uncertainty vector representing the uncertainty of the reasoning process, unified budget ledger, evidence pool, atomic claim set and immutable loop log; the unified budget ledger uniformly quantifies and manages at least one heterogeneous resource among lexical consumption, tool calls, execution time and loop steps; S2. Based on the current state of the central state, a routing decision is made through a budgeted value information router, that is, an action is selected from a predefined set of actions, wherein the selection of the action aims to maximize the expected reduction of unit budget uncertainty under the constraints of the unified budget ledger. S3. Execute the selected action and update the evidence pool and / or the atomic claim set based on the execution result; S4. Perform evidence gating adjudication on each atomic claim in the atomic claim set. The evidence gating adjudication is based on the support, reliability and conflict relationship of the evidence associated with the atomic claim in the evidence pool, and outputs a ruling result of pass, postponement or failure. If the ruling is postponed or fails, and a verifiable path exists, a sandbox execution action is triggered to obtain new evidence and update the evidence pool, and the affected atomic claims are revised with minimum difference rollback based on the new evidence. When the preset termination condition is met, the reasoning process terminates and a structured result is output. The structured result includes at least the set of atomic claims, the evidence index associated with each atomic claim, and a summary of residual uncertainty.
[0056] In step S1, the central state machine ( S t The construction and maintenance of ) specifically include: The system maintains a central state that serves as the sole decision-making entity. S t Its data structure is defined as S t = { Q , U , B , E , C , L}: Q (Problem Objective): Represents the current task to be solved and its decomposed sub-objectives, used to define the convergence direction of the inference.
[0057] U(Uncertainty Vector): A structured five-dimensional vector U = ( u answer , u evidence , u exec , u spec , u risk This function quantifies the uncertainty of candidate conclusions, the gap in evidence sufficiency, the necessity of verification, the risk of tool specification consistency, and the exposure of high-risk assertions. This vector is calculated and updated in real time by a dedicated uncertainty estimator based on the current evidence coverage, conflict edge density, and tool resolution status, making the implicit uncertainty of the model explicit and measurable.
[0058] B (Unified Budget Ledger): The consumption of heterogeneous resources such as token consumption, tool calls, execution time and loop steps will be uniformly mapped to the same quantitative standard for unified allocation, deduction and governance, providing cost constraints for decision-making.
[0059] E (Auditable Evidence Pool): Stores all available evidence blocks. Each evidence block must contain provenance information (such as URI, document ID, text range), reliability score, timestamp, hash digest, and conflict flags with other evidence. The evidence pool is the foundation for all gating decisions.
[0060] C (Atomic Claim Set): Decompose the natural language conclusions generated by the model into independently verifiable atomic claims. Each claim must include text content, confidence level, risk label, and supporting evidence pointing to its validity. The atomicity of claims ensures granular revision.
[0061] L (Immutable Circular Log): Records the complete history of state changes, executed actions, gating decisions, and budget consumption in an append-only manner. Log entries form a hash chain to ensure the auditability and immutability of the entire closed-loop trajectory.
[0062] In step S2, the closed-loop control process of "state-action-gating-decision-rollback" is executed: The system is based on a central state. S t This drives a reproducible closed-loop control process: Entropy Router based on Value Information (VoI): The routing decision-maker reads the current state ( U , E , B , C The algorithm selects the optimal action from a set of actions A = {THINK (internal reasoning), RETRIEVE (external retrieval), MEMORY_LOOKUP (memory lookup), SANDBOX_EXEC (sandbox execution), SUBMIT (submit)}. Its core algorithm is the Budgeted Value-of-Information Router (BVoIR), which makes decisions based on the expected reduction of uncertainty per unit budget cost. This mechanism ensures that the budget is prioritized for actions that most efficiently reduce uncertainty (such as retrieval or execution), rather than for unlimited text generation.
[0063] The "Proof-Carrying" Evidence Gate mechanism is the core mechanism for ensuring the reliability of conclusions. For atomic claim sets... C For each claim in the evidence pool, the evidence gating system mandates that it must provide locatable evidence support, based on the evidence pool. E Make a hard judgment on the information in the document:
[0064] PASS: An assertion is supported by a valid evidence pointer if and only if the reliability-weighted support of the evidence exceeds a threshold and there is no unresolved high-intensity conflict evidence.
[0065] HOLD: When there is insufficient evidence or unresolved conflicts, but there is a clear path to further verification (such as an executable search or tool call), the claim is suspended and the system will trigger corresponding actions to obtain new evidence.
[0066] FAIL: A claim is rejected when a high-risk claim lacks any supporting evidence or when there is conclusive rebuttal evidence (such as evidence refuted by sandbox execution results). This mechanism strictly prohibits the silent overriding or ignoring of claims with pending conflicts or insufficient evidence.
[0067] In step S3, the sandbox execution and differential rollback revision are linked: when the evidence gating decision is HOLD / FAIL and the proposition is falsifiable, the system prioritizes triggering the sandbox execution (SANDBOX_EXEC) action. The result returned by the execution (regardless of success or failure) is evidenced as a new Evidence Block and added to the evidence pool. EIf new evidence refutes an existing claim, the system will trigger a belief update rollback, updating only the affected claims, their risk labels, and confidence levels using minimum difference, and recording the conflict relationships. This avoids the full-text semantic drift caused by traditional "regeneration," ensuring the accuracy and traceability of the revision.
[0068] In step S4, the termination condition is based on auditability: The system's termination is not based on the fluency or self-consistency of the text, but rather on a combination of the following measurable conditions: Budget Governor: Strictly deducts all resource consumption, and triggers a hard termination when the budget is exhausted (Budget.exhausted()).
[0069] Stop Decider: When evidence gating results in all high-risk claims being rejected, and the uncertainty vector is low. U When the maximum component value drops below the threshold, convergence output is triggered.
[0070] The final output is no longer just plain text, but includes an assertion-evidence index, a summary of residual uncertainty, a budget execution report, and a minimal audit summary (pointing to the log). L The structured results ensure the complete auditability of the output.
[0071] The method described in this embodiment will be explained in detail below: Innovations in architecture and algorithms: Principles of the E³-Loop architecture The innovation of E³-Loop lies not in continuously stacking additional capabilities such as retrieval, memory, tools, or execution, but in consolidating these originally loosely coupled processes into a unified control semantic within the same closed loop: the system is centered on a single state. S t = { Q , U , B , E , C , L As the sole decision-making vehicle, among which Q This indicates the current problem objective and its sub-objectives. B This represents a unified budget ledger for tokens, tool calls, time, and steps. E This represents an evidence pool with source pointers, reliability, timestamps, and conflict edges. C This represents a set of atomic claims with risk labels and supporting pointers. L This represents an immutable circular log; where U = ( uanswer , u evidence , u exec , u spec , u risk ) is a five-dimensional structured uncertainty vector, where, u answer Characterizing the uncertainty of the candidate conclusions themselves. u evidence Characterizing the gap in sufficiency of evidence, u exec Characterize the necessity of performing verification. u spec Characterization tool specification consistency risks u risk The five-dimensional structured uncertainty is characterized by its exposure to high-risk assertions. These five dimensions are not manually annotated, but rather jointly generated and normalized by the uncertainty estimator after each round of reading the current hidden representation, evidence coverage, conflict edge density, tool parsing state, and risk label. Differential updates are performed after evidence addition, execution return, and rollback revision, thus transforming the "fuzzy uncertainty" originally residing in the model's implicit representation into trainable, comparable, and auditable control variables. In a preferred embodiment, the uncertainty estimator is attached to the last layer of hidden states of the base model. h N The lightweight trainable multilayer perceptron above takes input from the pooled representation of the last hidden state, concatenated with statistical features of evidence coverage, conflict edge density, tool specification matching state, and risk label, and outputs a five-dimensional structured uncertainty vector after being mapped by a normalization function. U = ( u answer , u evidence , u exec , u spec , u risk The uncertainty estimator is trained under supervision using inference trajectory data with gated decision results, execution receipts, and rollback revision tags. It performs differential updates on the uncertainty vector after each round of evidence addition, execution return, or claim rollback, thus making uncertainty quantification a trainable, reproducible, and auditable runtime control variable. The Entropy Router is not a token router in the sense of attention sparsity, but rather a lightweight, trainable policy network located in the runtime control plane; it reads... U , B , E andC State summary, output restricted action set A Policy distribution on {THINK, RETRIEVE, MEMORY_LOOKUP, SANDBOX_EXEC, SUBMIT} π ( S t It also provides a stopping threshold, depth of thought, and budget allocation bias, so that "internal reasoning first, proactive supplementary evidence first, memory check first, or execution verification first" no longer depends on the randomness of the prompt words, but becomes a learnable decision with the goal of reducing uncertainty benefits relative to budget costs.
[0072] After an action is selected and executed, the system enters a unified evidence gating and adjudication chain. Evidence Gate uses "proof-carrying gate" as its sole term, and judges each atomic claim according to four types of signals: "support coverage—source reliability—conflict relationship—risk level." Specifically, in step S4, the rules for evidence gating adjudication include: the adjudication is PASS if and only if the atomic claim is bound to a valid evidence pointer (preferably a locatable evidence pointer), the reliability-weighted support of the evidence exceeds a threshold, and there is no unresolved high-intensity conflict evidence. It should be noted that the evidence in the evidence pool is at least divided into two categories: externally verifiable evidence and internal inference intermediate results. Externally verifiable evidence refers to evidence returned by a retrieval system, database query, sandbox execution receipt, or other repeatable external sources, accompanied by source pointers and execution / query metadata. Internal inference intermediate results refer to intermediate semantic products generated by the THINK action and used only to form candidate claims or verification clues. For the two types of evidence, the system employs differentiated reliability assignment and update rules: externally verifiable evidence is assigned a higher initial reliability when its source is traceable, its return status is valid, and its results are verifiable; internal inference intermediate results are assigned only a conservative initial reliability and cannot be used alone as sufficient grounds for high-risk claims to pass evidence gating. Their reliability can only be increased after subsequent external evidence support or multi-source consistency verification. Therefore, the reliability of the evidence is not solely determined by model self-consistency, but rather by a combination of source type, verifiability, cross-source consistency, time validity, and conflict resolution results. This prioritizes externally verifiable constraints over internal generation tendencies and avoids evidence gating falling into circular reasoning. When evidence is insufficient or unresolved conflicts exist, but a clear next verification path (i.e., a verifiable path) exists, the ruling is HOLD. When a high-risk claim lacks any supporting evidence, the tool specification is not met, or there is conclusive rebuttal evidence, and the execution result constitutes disproving evidence, the ruling is FAIL, triggering belief_update_rollback to reduce the confidence level, rewrite the risk, or perform a minimum difference rollback on the corresponding claim. Here, tool invocation refers only to structured execution requests generated under ToolSpec, Schema, or finite state syntax constraints, while sandbox execution is the controlled execution process after the request enters an isolated environment; the two are not the same concept, the former is responsible for forming resolvable actions, and the latter is responsible for returning verifiable evidence.For conflicts between multiple tools, multiple receipts, or multiple sources of results, the Execution Arbiter does not use simple majority voting. Instead, it arbitrates based on the principles of prioritizing verifiable artifacts, weighting source reliability, and prioritizing time freshness and result repeatability. If the conflict remains unresolved, it maintains HOLD and prioritizes triggering further evidence gathering, without allowing generative language to mask the unresolved state. The Budget Governor, as an independent budget governance unit, performs unified hard deductions on tokens, tools, time, and steps, and applies soft constraints to the router when the budget approaches its limit and triggers hard termination when the budget is exhausted. The Stop Decider only stops when the gate passes and max(...). U If the value drops below a threshold, convergent output is allowed; otherwise, a bounded conservative conclusion is returned, along with an accompanying claim—an index of evidence, residual uncertainty, and budget ledgers. This ensures that the system's "truth-seeking" convergence is no longer based on linguistic fluency, but rather on... U The decline E The incremental changes, consistent gating decisions, and log replayability serve as unified criteria, ensuring that the model's optimization process and convergence criteria no longer implicitly depend on the fluency of the output text. Instead, controllable optimization is achieved through stabilizing the underlying training dynamics. The mHC mechanism provided in this invention, compared to standard residual connections, effectively constrains the upper bound of the gradient norm and significantly reduces the scale drift of activation values across different network depths. This stability reduces the sensitivity of the model training process to hyperparameters (such as the learning rate), resulting in smaller fluctuations and a more stable downward trend in the validation set loss within the same training period, providing a foundation for a controllable and reproducible training environment.
[0073] In its engineering implementation, this mechanism is solidified with replaceable interfaces (Policy / Uncertainty Estimator / Retriever / Memory Lookup / Thinker / Executor / Evidence Gate are replaceable), but the contract of "state-action-gating-decision-rollback update-budget termination-immutable log" remains unchanged, thus ensuring that the system is learnable, reproducible, and auditable. To enable this closed loop to form implementable and verifiable action selection rules under budget constraints, this embodiment uses a budgeted value information router as the core decision algorithm of the Entropy Router. Let the... t The wheel center state is S t = { Q t ,U t , B t , E t , C t , L t},in t Index for the number of loop iterations. Q t The current problem objectives and sub-objectives; U t This is a five-dimensional structured uncertainty vector; B t This is the remaining budget after token, tool, time, and step have been uniformly mapped to the same ledger caliber; E t For evidence pool; C t For atomic claim set; L t An immutable circular log; a set of actions A It includes five types of actions: THINK (internal inference), RETRIEVE (external retrieval), MEMORY_LOOKUP (memory lookup), SANDBOX_EXEC (sandbox execution), and SUBMIT (submit). To avoid budget overruns and specification mismatches, the system first constructs a set of actionable actions. A t feas Only actions that meet tool specification / parameter constraints and whose normalized cost does not exceed the current remaining budget are allowed to be included in the comparison. Subsequently, BVoIR uses "the expected reduction in uncertainty per unit budget" as the objective function. A t feas Select the optimal action .
[0074]
[0075] In step S2, the objective function of the budgeted value information router selection action is:
[0076]
[0077]
[0078]
[0079] in, λ tokThis is the weighting coefficient for the cost of word element consumption; λ tool The weighting factor for the tool call cost item. λ time The weighting factor for the execution time cost item. λ step These are the weighting coefficients for the cost item of the cycle steps. Each weighting coefficient is a non-negative real number, used to map different types of resource consumption to the same budget for comparison and settlement. In a preferred embodiment, it can be set to... λ tok =0.4, λ tool =0.3, λ time =0.2, λ step =0.1, prioritizing the calculation of token cost.
[0080]
[0081] in, U = ( u answer , u evidence , u exec , u spec , u risk ) T ∈[0,1] 5 These represent the uncertainty of the current claim conclusion, the gap in evidence sufficiency, the necessity of external execution verification, the risk of tool specification consistency, and the exposure of high-risk assertions, respectively. This vector is jointly estimated by the Uncertainty Estimator in each round based on the current claim set, evidence coverage, conflict edges, matching of pending action specifications, and risk labels. 。 For any candidate action, represent the predicted value of the uncertainty vector in the next round after performing the action in the current state. 。g spec The action specification feasibility gating function is used to characterize whether the candidate action meets the tool specification, parameter constraints and pattern verification requirements. It is set to 1 when it meets the requirements and 0 or a low penalty value when it does not meet the requirements. T The transpose symbol is used to represent a vector as a column vector or to perform vector dot product operations. A small positive constant is used to avoid zero denominators and improve the numerical stability of the objective function calculation. argmax is the action that maximizes the objective function. E t It is an evidence pool that includes evidence content, source tracing, reliability, conflict markers, etc. It is in state S t Next action The uncertainty of the vector form decreases, which can be understood as Δ U = U t -U t+1 The expected version; This indicates a decrease in non-negative uncertainty resulting from the action; w The previously mentioned five-dimensional non-negative weight vector is used to aggregate different types of uncertainty reduction into a single revenue scalar, ensuring that the sum of all components is 1; cost function It consists of a normalized weighted average of four parts: token consumption, tool invocation cost, execution time, and step overhead. 、 、 、 For example, in a preferred embodiment, the lexical consumption, tool calls, execution time, and loop step costs in the cost function are normalized by dividing by the current corresponding remaining sub-budget to obtain comparable dimensionless cost items. Each normalized cost item is then combined using preset non-negative weighting coefficients to form the total cost of the candidate action under a unified budget ledger, which is used for subsequent action selection and budget settlement. "Subject to" means "satisfies the following constraints"; B t+1 The remaining budget after this round of actions; This represents the budget update equation for cost deductions. Once the action is selected, it is executed... Update the budget ledger; if no action satisfies the constraints, or if the budget has been exhausted, the action chain is no longer extended, and the StopDecider outputs a bounded conservative conclusion with accompanying claims—an index of evidence, residual uncertainty, and a budget summary. Thus, BVoIR is no longer an empirical guideline for "think first, check first, or execute first," but rather a rewritten formal decision-making rule that is trainable, auditable, and repeatable under a unified state, a unified budget, and a unified definition of uncertainty.
[0082] Architectural and algorithmic innovations: A hierarchical closed-loop collaborative mechanism embedding five elements into the E³-Loop. After the main framework of the E³-Loop, namely "central state-routing-gating-execution-rollback-termination," is established, this embodiment of the invention further concretizes it into a hierarchical closed-loop collaborative mechanism with five embedded elements. This mechanism consolidates retrieval, associative memory, internal reasoning, and external execution from scattered external capabilities into a collaborative unit that is auditable, resolvable, and reproducible for the same cognitive state. The first element is the central cognitive state. S t = { Q , U , B , E , C , L}, where sub-targets Q Define the convergence direction of the task and the uncertainty vector. U The evidence pool expresses the evidence gaps, necessity of execution, and risk pressures in a structured way. E Risk-labeled atomic claim sets carry verifiable evidence based on source pointers, reliability, timestamps, and conflict edges. C The conclusion is broken down into adjudicable atomic claims, and an immutable circular log. L The trajectory of state-action-evidence-adjudication is solidified in an immutable manner; including a unified budget ledger. B Instead of being represented as an abstract, single limit, it is implemented as a structured budget ledger under a unified standard. This ledger records tokens, tool calls, execution times, loop steps, and remaining limits for rollback retention. The budget manager scalculates these costs into comparable decision costs before action selection and then settles and corrects them based on actual consumption after action execution. This divides the governance of heterogeneous resources into three interconnected but unambiguous layers: "presentation layer ledger—decision layer cost—execution layer settlement." The second element is the entropy routing control plane, which... U and B The input is not used for word generation, but for meta-control; when U When there is insufficient evidence, unresolved conflicts, or increased exposure to high-risk assertions, the strategy prioritizes allocating budget to the proactive verification action channel. Internal inference or external execution is only allowed into the candidate set when the reduction in predicted uncertainty has a positive benefit relative to budget costs, and the action meets the constraints of tool specifications and the budget feasible region. Furthermore, the product of internal inference can only enter subsequent adjudication as a "candidate claim" and cannot directly bypass the evidence chain to become a conclusion. The third element is the action channel layer, which unifies and reparameterizes retrieval, memory lookup, internal inference, and sandbox execution into a restricted action set, ensuring that all modules can only proceed through the action channel. S tThe incremental updates affect subsequent generation, and the mechanism prohibits implicit shortcuts that bypass evidence and budget constraints. Tool invocation is the act of forming a structured execution request, while sandbox execution is the controlled process of this request running in an isolated environment. The former is responsible for expressing the action as a parsable and verifiable call package, while the latter is responsible for returning verifiable artifacts, logs, failure codes, and execution evidence. The two have clear boundaries but are continuously connected within a closed loop. The fourth element is the evidence gating layer, which uses proof-carrying as a hard constraint to force each candidate claim to bind the source, reliability, time validity, and conflict relationship of the evidence items, and keeps unresolved conflicts explicitly visible and prohibits silent overwriting. When the support is sufficient and high-intensity conflicts have been resolved, the gating is approved. When the evidence is insufficient but there is a clear verifiable path, the gating is suspended and further evidence collection is triggered first. When a high-risk claim lacks support, the tool specifications are not met, or the execution result constitutes refutation, the gating is approved as a failure, thus transforming the "sufficiency of reasoning" into a computable and verifiable adjudication problem. The fifth element is the rollback update and budget termination layer. When the gating decision is invalid or the execution returns a negative result, the system only performs minimum differential rollback on the claims refuted by new evidence and their risk labels, and writes the conflict relationship back. E To solidify the causal chain, the budget governance device first performs pre-authorization and minimum rollback limit checks on each candidate action, and then completes settlement and correction based on the actual token, tool, time and step consumption after execution, avoiding the imbalance of the ledger caused by pre-estimation alone. At the same time, it prevents budget overdraft or rollback failure by using the method of "soft constraint guidance and hard boundary termination".
[0083] Therefore, the convergence criterion for closed-loop communication is no longer language fluency, but... U The decline E The system integrates incremental growth, consistent gating decisions, and replayable budget ledger settlement. When gating passes and residual uncertainty falls below a threshold, the system converges; when the budget is exhausted, the action set is empty, or the verification path does not exist, the system outputs a bounded conservative conclusion with an assertion-evidence index, budget summary, and residual uncertainty, ensuring the closed loop can both terminate and be reproduced. The direct purpose of this five-element synergistic hierarchical design is to first train the control semantics of "routing-gating-execution-rollback" to a stable convergence interval on the dense cortex of Phase 1, and then introduce MoE sparsification expansion only for cortex computation in Phase 2, using trajectory-preserving constraints to avoid behavioral drift, so that capacity upgrades reflect computational efficiency improvements rather than control semantic deformation. The specific Trace-Preserving Cortex Upgrade (TPCU) algorithm is as follows:
[0084] The first constraint on Phase-2 is to prevent it from turning "tasks that should be retrieved / executed" into "more thinking and more writing." This constraint aims to guide the action selection strategy of the Phase-2 model, ensuring it doesn't deviate from the goal of efficiently utilizing the budget to reduce uncertainty, and avoiding wasting resources intended for retrieval or execution on ineffective internal inference. The second constraint prevents Phase-2 from exhibiting overconfidence or uncertainty drift. This constraint aims to constrain the uncertainty estimation calibration of the Phase-2 model, preventing calibration drift relative to the Phase-1 model (including overconfidence or increased uncertainty). (·) represents the average value of the uncertainty peak across a batch of tasks. T 1 and T 2 represents the generated log or track set; exp(·) is the exponential function that maps the penalty term to the compatibility weights in (0,1]. λ It is the weighting coefficient of the action distribution offset penalty. β These are the weighting coefficients for the uncertainty drift penalty, and both are positive numbers; p 1( a )and p 2( a ) respectively represent by T 1 and T Actions in the obtained Phase 1 and Phase 2 trajectories The empirical distribution or frequency.
[0085] Architectural and algorithmic innovations: pedestal cortex and parallel expansion architecture components After fixing the control semantics of "state-action-gating-adjudication-rollback-termination-log" in the five-element hierarchical closed loop, the embodiments of the present invention further abstract the computation backbone into a base cortex contract that can be stably invoked by the control plane, and attach the necessary sensing and constraints for convergence to the truth using parallel extension components (architectural add-ons) without changing the mathematical operators of attention and FFN (Feed-Forward Network). Specifically, Phase 1 uses a Dense decoder-only Transformer + RoPE (Rotary Position Embedding) as the base cortex. Pre-Norm (Pre-Normalization), RMSnorm (Root Mean Square Normalization), GQA (Grouped Query Attention), KV-cache (Key-Value cache), SwiGLU (Swish-Gated Linear Unit), and bound embedding form a reproducible experimental baseline. The open ports of the backbone are fixed to the hidden states of the final layer. h N The output distribution is logits (logic output), and the parallel extension components are not pre-trained from scratch with the base backbone. Instead, after general pre-training is completed in the base cortex and the port contracts are frozen, they are added to it in a parameter-efficient tuning manner during the closed-loop training phase. h N Above this, the uncertainty / calibration head maps sentence-level states to a five-dimensional uncertainty vector. U As a policy sensor for the router, it advocates for the output of token-level binding hints in the evidence binding header to reduce the cost of subsequent evidence alignment and conflict localization. The ToolSpec GrammarAdapter uses JSON Schema as the sole tool specification description language and compiles it into a finite state machine or equivalent token-mask constraints during the decoding phase. It applies grammatical filtering only to optional token sets to ensure that tool calls can be deterministically parsed without writing back the semantics of the main operators. The Phase2 upgrade is strictly limited to the cortical computation level, only replacing the FFN sublayer with MoE-FFN, and improving the efficiency of conditional computation through Top-k routing, load balancing, and capacity overflow management, while maintaining...h N The input / output contracts of logits and the aforementioned side ports remain unchanged, thus ensuring that capacity expansion translates into improved throughput and cost-effectiveness without introducing control semantic drift. To prevent Phase-2 from disrupting the Phase-1 control plane, the most crucial aspect is the algorithm for the auxiliary loss in MoE route governance:
[0086]
[0087] The algorithm's function is to lock the MoE's "capability gain" within the FFN, while simultaneously forcing the route to prevent collapse. This allows Phase-2 to transform "conditional computation" into a controllable cost lever without altering the control plane. L bal This represents the auxiliary loss from routing load balancing; α These are the weighting coefficients of the auxiliary loss; ||·||2 refers to the L2 norm; This represents the mean of the routing probability vectors for all tokens within a batch, while p i Representing the i The routing probability vector of each token; N The number of tokens included in the statistics; u It is a uniformly distributed vector; E It represents the number of experts in the MoE architecture.
[0088] Mechanism innovation: The stability boundary of mHC at E 3 Structured Injection in a Loop mHC (Manifold-Constrained Hyper-Connection) is a method that constrains the hybrid matrix of multi-flow residual hyperconnections to a birandom matrix manifold DS through a Sinkhorn projection. nThe stabilization mechanism of the E³-Loop achieves near-mass-conserving residual routing and suppresses scale drift and gradient instability in deep propagation without rewriting the semantics of the attention / FFN operator. After the base cortex and parallel extension components complete port freezing, the E³-Loop must maintain reproducible convergence in multiple rounds of "evidence backfilling-gated adjudication-rollback revision" loops. Its underlying residual dynamics must have a clear stability boundary. To this end, this embodiment of the invention borrows mHC as a structured stability hook injected into the residual hyperconnection of the Base Cortex during training, so that the control signals (uncertainty routing, gated labels, budget deduction, and evidence binding hints) are restricted to a controllable geometric domain during cross-layer propagation. In its implementation, mHC approximates the multi-stream residual mixing matrix within the neighborhood of a double random matrix during the training phase. It then employs Sinkhorn-Knopp iterative execution of entropy-regularized normalized projection, ensuring that the composite gain of each residual channel remains within a controllable boundary and approximately satisfies mean conservation. This mitigates the risk of representation scale drift and gradient explosion or vanishing caused by deep stacking and multi-path topology. This constraint directly benefits the learnability of closed-loop control: the calibration of the uncertainty vector is not artificially inflated due to inter-layer amplification; the conflict resolution of evidence gating does not experience threshold drift due to hidden-state energy fluctuations; and the differential revision of the claim set during rollback updates maintains a stable action distribution under similar budgets. On the engineering side, mHC exists as a training-period regularization that is "switchable, monitorable, and rollbackable." It does not alter the operator semantics of attention and FFN, only applying projection and constraints to the mixing weights of residual fusion. Combined with kernel fusion and selective recomputation, it reduces additional I / O overhead, ensuring that this stability boundary aligns with budget governance rather than sacrificing the inference budget for apparent stability.
[0089] Mechanism Innovation: Low-cost memory collaboration mechanism for injecting engram evidence boundaries. After the training-period stability boundary provided by mHC constrains deep residual dynamics to a controllable domain, this embodiment of the invention further draws upon and improves the Engram evidence boundary injection mechanism to achieve closed-loop collaboration that is "usable but does not overshadow the main context" with the lowest possible storage and access overhead. Engram is a sparse conditional memory mechanism constrained by evidence boundaries. It writes retrieved memory entries into the evidence pool in the form of Evidence Blocks carrying source pointers, reliability, and conflict markers, and is subject to gated adjudication, rather than injecting the context without boundaries, thereby providing traceable and rollbackable memory collaboration with low access overhead. It is only used as an engineering functional analogy to refer to the conditional memory surface controlled by E³-Loop, rather than a direct claim to the biological neural memory mechanism. Unlike viewing memory as a freely splicable long-term context, this embodiment of the invention reconstructs it as an auditable evidence memory layer: the system uses only normally segmented Evidence Blocks as the smallest writing unit, and each entry generates a compressed key from a stable semantic fingerprint. k and with compact value slots v The system stores evidence summaries, source pointers, timestamps, reliability, conflict flags, scope of application, and revocable signatures. In a preferred embodiment, the memory table is organized using a "hash index directory + fixed-length Evidence Block records + hotspot cache" structure to achieve deterministic queries, low random read costs, and ease of audit playback. KV Block or hierarchical vector quantization codebooks are only used as alternative implementations for different capacity or compression scenarios. To prevent evidence contamination, model-generated text that has not been approved by the Evidence Gate or verified by external retrieval / sandbox execution receipts must not be directly written into the Engram; entries can only be added to the table if their source is traceable, their metadata is complete, and they meet the minimum reliability threshold. If subsequent evidence or execution results prove otherwise, the system will revoke, demote, or isolate the corresponding entry, and retain a tombstone marker to maintain version replayability. At runtime, the Router only processes uncertain vectors. U Prioritize evidence gaps and budget ledgers B An engram query is triggered only when MEMORY_LOOKUP has a higher unit cost benefit compared to continuing generation; the returned result does not directly increase the generation probability, nor is it allowed to bypass the main branch implicit fusion as an assertion. Instead, it is uniformly written into the evidence pool in the form of candidate Evidence Blocks. EThen, the evidence is passed to the Evidence Gate for proof and adjudication: those with sufficient support can participate in the subsequent conclusion convergence, while those with unresolved conflicts are only marked as disputed and trigger external retrieval or SANDBOX_EXEC for further verification, thus rewriting "memory recall" into "evidence candidate injection". In terms of cost governance, Engram uses a combination of sparse access, hot spot caching, batch prefetching and merged query to reduce memory access jitter during the decoding stage, and allows a portion of the sparse capacity budget to be transferred from the MoE expert side to the memory side in a controlled manner in Phase 2, replacing simple computing power stacking with the synergy of "sparse storage + sparse computation"; however, no matter how the capacity expands, its evidence boundary, write threshold, gating adjudication and rollback discipline remain unchanged, ensuring from a mechanism that memory only enters the closed loop as auditable evidence, and cannot degenerate back into a free association context that bypasses verification.
[0090] Engineering innovation: Low-cost closed-loop enhancement of external forensics and executable verification via the Sandbox. In the aforementioned E 3After the Loop control semantics were identified as the core content of the invention, the embodiments of the present invention further provide an engineering implementation path that is strictly isomorphic to this loop, namely, a low-cost loop enhancement for external forensics and executable verification using Sandbox, in order to systematically migrate "generation when evidence is insufficient" to "adjudicable actions and back-injections". Sandbox refers to an external verification channel that drives verification and rollback revisions through the execution of retrieval, file and code computation by determinately parsable tool calls in a virtual computing environment with minimal privilege isolation, and back-injects the generated verifiable products and return codes as evidence. In its implementation, the model explicitly expands the action set into external forensic and execution primitives such as search / fetch / compute / file-parse during inference runtime. It then uses ToolSpec+Schema / FSM constraints to converge the model output into a deterministically parsable call package (containing tool name, parameters, budget limit, timeout, and expected output type), enabling programmatic verification and replay of the execution chain. The Sandbox is implemented using a containerized isolated environment or other equivalent controlled execution environment, imposing least privilege constraints on network access, file system visibility, system call interfaces, and process permissions. The execution environment also sets limits on the time, memory, number of steps, and output size of a single execution. When unauthorized access, abnormal resource expansion, or exceeding limits is detected, execution is immediately terminated, a failure code is returned, and the exception information is written to the immutable circular log. The raw output returned by the execution is normalized into an Evidence Object and written into the evidence pool E, along with the source chain, timestamp, digest hash, and failure code. Subsequently, the Evidence Gate processes "retrieval evidence, execution evidence, and internal memory evidence" using the same adjudication semantics. When the result refutes a candidate claim, belief_update_rollback is triggered for minimum difference revision and solidification of conflict edges, thus forming an adjudicable trajectory of "hypothesis generation - external evidence acquisition - contradiction identification - differential revision - re-verification closed loop." This engineering innovation is methodologically aligned with the agency search / agent loop approach emphasized by Anthropic in recent years: its core is to allow the model to cyclically advance between tool calls and observation results, and to reduce context occupancy and error rates through clearer tool boundaries, procedural tool calls, and reproducible evaluation. The large model further structures this direction into a budget-governed closed-loop adjudication mechanism, making external evidence acquisition no longer an optional enhancement, but rather a cost-reliability integrated control mechanism that, together with stable convergence under budget constraints, mandatory alignment of evidence and conclusions, precise decision-making triggered by execution, and minimizing deviations in the revision process. This mechanism effectively suppresses high-risk assertions through evidence gating. When evidence is insufficient, the system tends to conservatively exit or actively seek verification rather than generating uncertain content, thereby systematically improving the reliability of the output.
[0091] Engineering innovations: Closed-loop fine-tuning training and auditable engineering deployment strategy under budget constraints. Once the large model has solidified the "external forensics—execution verification—reinjection revision" process into an adjudicable closed loop within the E³-Loop framework, the next crucial step is to transform this closed-loop discipline from an orchestration rule during the inference phase into a learnable behavioral distribution during the training phase, and maintain end-to-end auditable consistency during the deployment phase. Accordingly, this invention proposes a budget-constrained closed-loop fine-tuning training and auditable engineered deployment strategy, ensuring that convergence to truth no longer depends on the randomness of prompt words. On the training side, the E³-Loop contract serves as the highest constraint; samples no longer only contain instructions and answers but must also carry the central state. S t ={ Q , U , B , E , C , L The serialized trajectory, discrete action labels and parameter slots (such as RETRIEVE query template, SANDBOX_EXEC tool specification, MEMORY_LOOKUP key space), source information of Evidence Block (provenance / reliability / conflict tags), and differential rollback records of claim set C and uncertainty U are used to transform "evidence backfilling → gating decision → rollback revision → budget termination" into supervised state transition learning. To prevent the model from learning to "output structured text" instead of "making correct verification decisions", the training log synchronously records action distribution, gating pass rate, rollback frequency and budget deduction ledger, and requires the trajectory to be reproducible and ablation-comparable with the same budget caliber. On the engineering side, a PyTorch distributed training stack is used to handle FSDP / ZeRO-3, bf16 hybrid processing, activation recomputation, and efficient attention kernels, incorporating tool call artifacts and evidence artifacts into the first type of objects in the data pipeline. When computing power is limited, LoRA (Low-Rank Adaptation) / QLoRA (Quantized Low-Rank Adaptation) is used only as a controlled cost reduction measure, and its improvement in policy decision-making rather than format simulation must be demonstrated by closed-loop metrics. On the deployment side, the principle of "training-inference-audit consistency" is followed, unifying weight hashing and sharding versions, evidence artifact formats, log replay protocols, and budget ledger standards. Dialogue style is injected through an independent adapter or policy layer and decoupled from gating decisions. The Sandbox execution environment adopts least privilege and strong isolation, with encrypted artifact storage and an expiration destruction policy to ensure that any high-risk assertion under elastic scaling can be verified by the evidence chain and replay logs.
[0092] To clearly define the structural composition, interface boundaries, and state transition relationships of the large model in the E³-Loop closed loop, the attached figure shows the central state. S t The diagram illustrates the connection methods between action routing and gating decisions, sandbox execution back-injection, rollback revision, budget termination, and audit logs, and serves as a unified reference for each step and data structure in subsequent specific implementations.
[0093] Figure 2 The E³-Loop "frontal control plane" of the large model is given how it operates in the central state (i.e., Figure 2 (Central state in the middle) S achieves auditable, budgetary convergence to truth → provable output: the system outputs the current problem / sub-objective Q Structural uncertainty (profile) U (u_answer / u_evidence / u_exec / u_spec / u_risk), Budget B (tokens / tools / time / steps), Evidence Pool E (Source chain + conflict + reliability) and set of claims C (Draft claims + confidence level + risk labels) and immutable circular logs L (Audit trail) is uniformly packaged as a single decision-making vehicle. S t ={ Q , U , B , E , C , LThe evidence items are pooled in the form of Evidence Objects, and at least include id (number), type, content_ref, source information (source, resource identifier uri, text fragment span, timestamp ts), reliability (score, calculation method method}), conflict list (conflicts [{related evidence number evidence_id, relationship type relation, conflict score}]), and hash (hash value); claims are managed in the form of Claims, and at least include id, text (draft claim text), spans, confidence, risk_tag, supporting evidence number list support [evidence_id], and status (status). A "total assertion" refers to the smallest semantic assertion unit that can be determined as true / false / pending by a single piece of evidence. Its boundaries are defined by predicate-argument or the smallest falsifiable phrase. It is not equivalent to a token-level fragment and allows nesting, but parent-child dependencies must be explicitly recorded. Candidate assertions are written into the draft output by the Base Cortex after being rule-based segmentation by the Claim Parser. C This includes initial confidence and risk labels. The control loop (meta-control) is read by the Entropy Router loop. S t ( U , E , B , C Generate action strategies π ( S (Select action) and allocate computational (computing power) budget, setting stop / continue. The action space must at least include retrieval / memory lookup / internal inference / sandbox execution / rollback revision / termination; the Router determines whether to enter external verification based on thresholds and budget, for example, when the maximum uncertainty max( U )≥ U When the uncertainty threshold is reached, or when there is a high-risk claim with insufficient supporting evidence and option B allows, priority is given to obtaining evidence or taking action. Subsequently, the Evidence Gate triggers a gated decision. g ( C , E ), testing claims C And compare with the evidence E right CExecute the "proof-carrying" verdict item by item and detect conflicts: If risk_tag is high and there is no evidence item in support with a reliability not lower than reliability_min (the minimum reliability threshold), then judge FAIL; If the evidence pointed to by support has unresolved conflicts, then judge HOLD and explicitly expose the conflict edge; When judging PASS, the traceability between the claim and the evidence pointer is required. When the gate is in HOLD / FAIL or the u_exec (execution uncertainty) increases and the proposition can be falsified, the execution arbiter (real-world feedback) executes the verdict v(exec) to trigger sandbox_exec to run checks / checks / computes / tests in the least-privilege isolation environment, perform verification, output executable facts, and return the execution verdict result exec_verdict(pass / fail) and the execution evidence Δ E , the execution product and return code are evidenced as an Evidence Object and back-injected E . Trigger rollback / update: If exec_verdict is fail or new evidence falsifies an existing claim, then call belief_update_rollback to execute "minimum differential revision", whose semantics is to only update the status / confidence / risk_tag / support of the Claim entries that are falsified or affected by conflicts and record Δ C , and simultaneously update the relevant dimensions Δ in U accordingly U . Rewriting the full text is prohibited in place of local rollback. In addition, there are also parallel action channels. After retrieval / evidence-seeking, query the data source → Δ E ; Think / draft claims, internal reasoning → Δ C , Δ U . After executing / verifying facts (if feasible), then run checks / computes / tests → Δ E (execution evidence) + verdict. The Budget Governor makes hard deductions (decreases B ) for each round of tokens, tool calls, time, and steps, and uses Budget.exhausted() as a strong termination boundary (hard stop rule, including step / time limits); The stop condition of the Convergence / StopDecider is: When "all high-risk claims pass the gate and max(U) < U_threshold (residual UThe output terminates under two conditions: "acceptable" or "budget exhausted / external execution infeasible". `finalize_answer` (answer generation) (final output) only returns the claim-evidence index (chain of evidence), a summary of residual uncertainty (unresolved uncertainty), and a minimal audit summary, without exposing the unauditable implicit reasoning text. To meet the "immutable" requirement, L An append-only audit log is used to form a hash chain. Each record contains at least ts, step, S_hash (state hash), action, gate_verdict (gating decision result), exec_verdict (execution decision result), delta_C (claim set increment), delta_U (uncertainty increment), budget_delta (budget consumption increment), prev_hash (previous hash), and entry_hash (this record hash). Any tampering will break the chain verification, thus ensuring that the closed-loop trajectory is replayable and verifiable.
[0094] exist Figure 2 Based on the given "control surface driven closed-loop decision", Figure 3a and Figure 3b The E³-Loop of the large model is expanded into an achievable two-modal division of labor and evidence convergence path: central state (i.e. Figure 3a and Figure 3b Central Cognitive State S t After continuous reading and writing by the E³-Loop prefrontal control plane, the system follows the uncertainty vector. U With budget B Switching between Active Seeking Mode and Internal Thinking Mode (dynamic thinking), the former is the researcher's principle, namely "if uncertain → seek verification": generating ΔE through two channels: Retrieve (external) query and Memory Lookup (conditional memory), and forcibly attaching proofance and reliability (corresponding to externally retrieved evidence and engrammed evidence, respectively). O (1) Memory evidence) (proof gating), the latter being reasoning and drafting under constraints, i.e., "only when it can reduce U "Only when the time comes to think": The computational backbone Base Cortex (dense Transformer + RoPE rotational position encoding) produces only candidate Δ values under budget constraints. C And update Δ UFurthermore, this update is smoothed / truncated via the manifold-constrained hyperconnection mHC Stability Constraint (mHC stability constraint, i.e., a training-stable complex path) to avoid gradient and gating threshold drift caused by control signals and memory insertion; both types of evidence are uniformly entered into the Evidence Pool. E Afterwards, Evidence Gate performs proof-carrying and conflict resolution on the risk-tagged claimset. If the claims are deferred (if unresolved), they are moved to the Execution Channel (tools & external). Verifiable run, test, and compute operations are performed in the Sandbox / Tools, outputting the deterministic artifact Exec Verdict and execution evidence Δ. E (Conflict diagram and usage history), and trigger a Belief Update / Rollback decision pair. C and U Perform minimum difference revisions and write them to the audit log. L The loop eventually ends under the condition of "convergence or budget exhaustion," rather than covering up unproven parts with lengthy narratives.
[0095] Figure 4a and Figure 4b It describes the pluggable implementation boundary of the large model "base cortex + parallel extension components": input tokens (lexicons) x l ,..., x t After tie-embedding, it is mapped to the initial hidden state. h 0 ( E [ x → h 0 ∈R B ×T×d After that, it enters the Nth layer Pre-Norm decoder block, and performs block (decoder block) operations. l ( l =1,..., NThe network performs pre-normalization (root mean square normalization), ensuring density and compatibility with the FlashAttn algorithm. The attention sublayer is fixed as RoPE+GQA (group query attention) and compatible with KV-cache (key-value cache), i.e., causal self-attention, to stabilize decoding bandwidth. In the hybrid expert feedforward layer, Phase 2 only replaces the FFN sublayer with a Top-k gated MoE-FFN (SwiGLU hybrid expert-feedforward network), resulting in residual 1: h' = h + attn_out; residual 2: h_next = h' + ffn_out. Router r ( x Calculate the logistic regression value logits for each token. r = W r· h (Each word), and the probability is obtained by softmax normalization. p r =softmax(logits r ), then select k One expert { E1, .., En The capacity expansion is performed by dispatching and weighted composition, thus constraining capacity expansion to conditional computation and output. without changing the output port ℎ N ∈R B×T×d With logical output logits∈R B ×T×|V| Hybrid expert governance (main layer) includes load balancing loss management, capacity / overflow policies, expert discarding / redundancy, and route stability monitoring. Top-k expert selection (… e 1, e 2, w 1 ,w 2) Distribute word units → expert [ e ]; y e =Expert e ( h token Aggregation → y = w 1* y e1 + w 2* y e2 The entire process sequentially involves root mean square normalization, LM Head (Language Model Head) (linear mapping | V|, binding weights (tied), pre-normalized output logits, and each word. Among these, W To map the hidden representation of the current token to a trainable projection matrix of the expert routing score, r This corresponds to the routing logical value vector for each expert. w 1 ,w 2 represents the logical value vector from the routing path. r The weight values of the top-2 experts selected are used to adjust the output of the corresponding experts. y e1 , y e2 Perform a weighted summation. N This is the last layer number of the base decoder. d To hide the state dimension, | V | represents the vocabulary size. In the architecture add-ons, inputs include ℎ N (Main input) + logits (optional). Architectural Add-ons are read in parallel on this port. N Two types of side signals are output: one is generated by the uncertainty / calibration head. U = ( u a , u e , u x , u s , u r )∈[0,1] 5 As policy sensors of the E³-Loop, it provides stop / continue signals and budget allocation targets; secondly, it serves as a claim → evidence binding head. U =bind∈R B ×T×K By providing evidence-carrying hints, asserting fragments + evidence IDs, and supporting conflict perception, a binding hint matrix is provided at the token level to reduce the cost of subsequent evidence alignment search. u a , u e , u x , u s , u r That is, in Example 1 u answer , uevidence , u exec , u spec , u risk The Uncertainty / Calibration Head, Claim→Evidence Binding Head, and ToolSpec Grammar Adapter are all mounted as parallel attachment heads on the same BaseCortex. h N Above this, gradients are shared end-to-end with the backbone network by default, and joint training is conducted under supervision along the closed-loop trajectory. Alternatively, the backbone can be frozen during deployment, with only the additional head fine-tuned to reduce migration costs. Subsequently, two types of side signals enter the control stack. The E³-Loop controller can optionally enable the ToolSpec Grammar Adapter to apply a token-mask to logits, forcing deterministic parsing of the tool specification flow. Then, the tool_result (the tool execution result, i.e., the original result) is wrapped (result encapsulated) into a stable Evidence Block through the Engram Evidence Boundary. The evidence is then re-injected into the next round of prompts / context, forming a closed-loop interface of "execution product → evidence object → reusable input". h N (Step-by-step) trained mHC ConstraintHooks are attached to the system in the form of hidden dynamics penalty terms. h N Above, a loss term is added without rewriting the semantics of the attention / FFN operator; it only provides a stability prior to prevent gradient and threshold drift caused by control signals and memory injection. Furthermore, Figure 4b It also includes the pedestal cortex: The MoE decoder includes: embeddings, blocks: attention (rotational position encoding + group query attention) + hybrid expert-feedforward network, h N Logits. Through porting (adaptation and porting), state snapshot: policy + evidence alignment. Conditional memory evidence boundaries: (conditional memory storage + retrieval) including: key: n-gram / context hash; value: payload vector + metadata. Through retrieval (context...) 键 Conditional memory gating: ɑ = gating ( h 词元Evidence (suppressing conflict / noise). Then, evidence is emitted, injected into the adapter via conditional memory, including ID, source, timestamp; claim fragment / n-gram; confidence, conflict; and an injection tensor, injected into the adapter via conditional memory: h' = h + ɑ∙Proj(val); where Proj(val) is a linear projection function. The actions sequentially pass through the policy sensor and controller: {query interaction / retrieval / execution / correction / ...}. Upon entering the conditional memory trigger, the context is constructed. 键 The system calls the retrieval tool to obtain the call condition memory. After entering the evidence adjudicator, it checks the source chain, detects conflicts, and determines acceptance / rejection. The final output gating is: only allowing evidence to be carried, based on accepted evidence or experience sandbox results.
[0096] Figure 5 This demonstrates a single-round decision-making minimum complete path within the E³-Loop closed-loop truth-seeking architecture. Its design aims not to make the model "think one more step," but rather to reconstruct generative reasoning into an auditable, reproducible, and rollback-capable verification process within budget constraints. Initially, the system reads and uses the central state... S t = { Q , U , B , E , C , L As the sole decision-making vehicle, computational action set A feas The current problem / sub-goal Q Structural uncertainty U ,Budget B Evidence pool E Atomic Claims Collection C With immutable circular logs L By unifying everything into a single state machine, every subsequent action can be traced back to a clearly defined input and resource; based on this, the Entropy Router reads ( U , E , B , C Output the action for this round. a t and the depth of reasoning and the stopping threshold, and the execution action channel (according to) a t (Branch), and select external retrieval in the action channel → generate Δ E (Including traceability / reliability / conflict) write E Conditional Engram lookup table → Fast writing of candidate evidence E Internal (base cortex) drafting candidate claims Δ C and update Δ U(Candidates only) or trigger Sandbox executable verification → return to execution decision and Δ E Write E This explicitly transforms the researcher-driven iterative verification process of "hypothesis generation - external evidence acquisition - contradiction identification - differential revision - re-verification closed loop" into a controllable sequence of actions. Evidence gate then applies this to the claim set. C Each proof-carrying ruling is executed and marked PASS / HOLD / FAIL. The conclusion must carry a locatable evidence pointer, and conflicting relationships must not be silently overwritten. When gating fails and the proposition is falsifiable, the Execution Arbiter triggers SANDBOX_EXEC to obtain verifiable execution evidence and the ruling result. If necessary, a rollback revision is used to update the rejected claims using a minimum difference method. C And adjust simultaneously U This mechanism aims to prevent "rewriting the narrative" from replacing "revising beliefs." Budget management: The Budget Governor performs hard deductions on tokens / tools / time / steps. B The data is written to budget_delta, and the actions, gating, and execution decisions are written to an immutable log in the form of an append-only hash chain. L This ensures the closed-loop trajectory has an unalterable audit standard; ultimately, the Stop Decider uses "budget exhaustion" and "evidence gating all PASS and max( U )< U The two-conditional approach of "_threshold" completes hard termination or convergence output and returns only the claim-evidence index, residual uncertainty, and minimum audit summary, thus transforming the system's optimization objective from the fluency of generated text to a series of quantifiable, objective metrics directly related to training dynamics and generalization ability.
[0097] Training stability: The gradient norm is constrained within a controllable range, and activation value scaling drift is suppressed.
[0098] Convergence performance: With the same number of training steps or budget, the model converges more stably on the validation set, resulting in a lower final loss value.
[0099] Decision reliability: When control signals (such as uncertainty vectors) propagate between different layers of the model, their numerical range remains stable, avoiding decision errors caused by signal distortion.
[0100] Figure 6 Located within the "computational support layer (base cortex / MoE cortex of Phase 2)" of the E³-Loop, its function is not to generate new control rules, but rather to repeatedly write Δ to the control surface.U Δ C Evidence injection provides verifiable numerical stability boundaries, ensuring that the closed loop does not experience gating threshold drift and calibration distortion due to instability in deep residual dynamics during multiple iterations. The mechanism unfolds sequentially along the arrow path: In the first layer of the mHC mapping @ (), for each layer's input flow vector (i.e., feature tensor)... x l ∈R {B×n×d} First, perform dynamic mapping generation, then generate vec( x l (Representation vectorization) is obtained through linear projection. and Then, in the manifold projection stage, three types of structural matrices are formed, among which... Used to constrain the pre-mixing and post-increment to be non-negative scaling. Right now Explicitly projected to DS ( n A double random matrix manifold is used to achieve residual routing with "approximate mass conservation"; subsequently, ( )right x l Premixing, i.e. u l =( )· x l , obtain the input layer function F (Composed of causal self-attention of RoPE+GQA+KV-cache and MoE-FFN of SwiGLU or Phase2), output features y l= F layer ( u 1 )(Right now Figure 6 In y l= F ( u 1) After () ) Form delta=( )· y l (Increment) and ( )· x l Stable residual fusion is performed to obtain This ensures that crossflow residual propagation remains bounded, repeatable, and has a large number of convections during both training and inference. n streamsIt is insensitive to dynamic changes. mHC only operates on the pre-mixing and fusion routing of residual connections, without rewriting the operator semantics or forward computation process of attention / FFN. In implementation, this module exposes forward(...) as an mHC wrapper. x , F layer The interface internally uses a sinkhorn. knopp (An iterative algorithm) Iterative implementation DS (n) projection, and in constraint hook The (constraint hook) provides rows, columns, and biases, non-negative boundaries, and an optional "sharpness" penalty as a stability hook during training; therefore, it plays the role of "stable and controllable cortical dynamics" in the E³-Loop, rather than replacing evidence gating or executing adjudication semantics.
[0101] Figure 7This paper presents an engineering path for implementing Sandbox closed-loop forensics in E³-Loop using a large model. The key lies not in "calling the tool" itself, but in transforming the tool call into an auditable event flow that can be constrained by the control surface, accepted by the evidence gate, and can drive belief revision in reverse. Policy Sensors first output policy signals related to task risk, remaining budget, and trigger thresholds. These signals are then condensed into two types of constraints by the E³-Loop Controller: one type acts on the action tendency and stopping conditions of the LLM Policy (Large Language Model Policy), and the other type is issued to the ToolSpec Grammar Adapter in the form of policy + budget. This adapter applies a token-mask based on a finite state machine / schema to the candidate outputs, ensuring that the model can only generate resolvable calls that meet the tool specification, thus compressing the output space of "tools in appearance but fabricated in reality" from the source. Subsequently, the LLM Policy initiates a tool call according to controlled syntax, entering the Sandbox. Within the three isolated domains of External Access, FileSystem, and Code Execution, deterministic observations and artifacts are generated. These artifacts do not directly contribute to the final answer; instead, they are first fed into Proof-carrying Hints, binding the execution result with verifiable fingerprints such as artifact hashes, source and timestamps, and failure reasons as traceable evidence. This evidence is then fed back into the LLM Policy (loop) to trigger secondary inference and necessary rewriting. Final Output is only output when the evidence-carrying conditions are met and the control plane allows the submit() function. This structure creates a closed loop of "external evidence gathering - evidence carrying - policy loop," thus elevating execution verification from a one-off external step to a system mechanism that is budget-governed, gated, and reliably drives the convergence of metrics such as revision fidelity and execution trigger accuracy.
[0102] Example 2 To ensure the reproducibility and auditability of the large model in specific implementation, the initial implementation steps are solidified in the form of "documented contract + code implementation". 3 - Loop core technology: E 3 - The closed-loop semantics, five key elements, and central state of a loop. S t={ Q , U , B , E , C , L Field constraints and action space A The system includes standardized technical solutions for triggering conditions such as retrieval / memory / internal inference / sandbox execution / rollback revision / termination; strategy generation and budget allocation for the Entropy Router; proof-carrying adjudication and conflict arbitration for the Evidence Gate; executable verification and evidence injection for the Execution Arbiter; deduction rules and hard stop boundaries for the Budget Governor; convergence criteria and conservative exit for the Stop Decider; and replay parameters for the immutable audit log L. These are all recorded in the sword_23.md file as an unambiguous runtime contract. The corresponding Python core script provides typed state and evidence objects, run_e3_loop control functions, and standardized interfaces. The ToolSpec Grammar Adapter and Sandbox tool layers implement deterministic parsing and least privilege isolation. The EngramEvidence Boundary confers evidence for memory entries and injects noise suppression. The mHC constraint stabilizes residual dynamics with switchable training hooks, thereby locking the closed-loop truth-seeking mechanism into a reproducible implementation scheme through executable code paths.
[0103] In the specific training implementation, "post-closed-loop training" is taken as the main line. First, you need to freeze the E³-Loop control contract that you have completed in the previous part, including the central state, action routing, evidence gating, executable verification, rollback revision, budget deduction and termination criteria. Then, using five strong bases as the starting line of capability, through unified data tracing and replayable sandbox execution, the closed-loop discipline is written into the weight distribution, and finally, new safetensors (safe tensor format) shard weights are exported and auditable deployment is completed. The five bases are fixed according to their uses: a general flagship, two general lightweight bases, a coding agent, and an embodied VLA (Visual-Language-Action / Vision-Language Model). The general flagship uses Qwen3.5-397B-A17B, while the general lightweight bases use Qwen3-30B-A3B-Instruct-2507 and Qwen3-30B-A3B-Thinking-2507 respectively to correspond to the division of labor between Instruct (instruction execution) and Thinker strategies. The coding side uses Qwen3-Coder-Next for agency coding and tool closed loop, while the embodied side uses the LingBot-VLA model for vision-language-action closed loop. The engineering implications of this combination are to entrust "general semantics and knowledge coverage" to the strong base, and to entrust "within-budget convergence to truth, evidence-conclusion alignment, execution trigger accuracy, revision fidelity, and high-risk fabrication zeroing rate" to E³-Loop for training and solidification. This ensures that the training budget is consumed on verifiable closed-loop reliability, rather than being diluted by lengthy narratives. The availability of the general and lightweight bases and the model artifact formats are based on their open-source repositories, and the coding base Qwen3-Coder-Next is also based on the official release.
[0104] The core of data engineering is not to "manually rewrite" all open-source corpora into complete closed-loop trajectories, but to establish a hierarchical trajectory protocol so that closed-loop supervision primarily comes from computable and replayable signals. When samples are added to the database, at least machine-readable task context and action records should be generated. Q , B The evidence and execution artifacts (including tool calls, gating decisions, execution return codes, artifact hashes, and evidence source pointers) are uniformly encapsulated as Evidence Objects and written into the evidence pool E, automatically generating auditable logs. L Uncertainty vector U With Atomic Claims Collection C By default, it does not rely on subjective manual annotation. Instead, training labels are automatically derived from the model output, gating results, execution decisions, and conflict graphs. Examples of labels include "whether evidence collection / execution was triggered," "gating PASS / HOLD / FAIL," "execution verdict (adjudication result)," and "rollback differential Δ."C "As a supervisory signal, manual labeling is introduced only for a small number of high-risk or high-value samples to calibrate thresholds and correct biases; this avoids increasing the cost of the entire dataset with subjective annotations and eliminates the logical loop that 'training data must first satisfy closed-loop discipline.' Evidence is uniformly packaged as 'Evidence'." The minimum requirements for the Object field are to include source pointer, reliability, conflict marker, timestamp, digest hash, and verifiable product reference, making "evidence-conclusion alignment" a decisionable constraint during training rather than a post-hoc description. Deduplication and contamination control are based on cross-set hash deduplication, benchmark leakage filtering, and tool output forgery detection. Distribution balancing explicitly increases the proportion of high-risk assertions, conflicting evidence, failure rollbacks, and tool execution samples, naturally covering the closed-loop behavior of "insufficient evidence → postponement / verification," "unresolved conflicts → remaining unresolved," and "execution failure → minimum difference revision." Preference and alignment data primarily use UltraFeedback (an open-source preference dataset) and Tülu (a data system) to narrow convergence gate thresholds and conservative exit boundaries, preventing the model from confidently outputting high-risk assertions when evidence is insufficient.
[0105] Tools and Sandbox forensics should not be described as temporary add-ons during deployment, but rather as E 3 - The "executable verification channel" shared by the Loop in both training and inference is consistently modeled: during the training phase, data such as ToolBench, which provides tool call trajectories, is used as the main source. The call sequences, parameter slots, return codes, and failure reasons of multiple tool tasks are standardized into replayable records. The product summary, source chain, and timestamp generated by each call are encapsulated and written back to the evidence pool so that evidence gating and rollback revisions can be learned and adjudicated on the same data structure. The sandbox employs a least-privilege isolated execution domain, separating external retrieval, web crawling, file system operations, numerical computation, and code execution into independent executors. Each executor is given a defined ToolSpec and Schema or FSM constraint. During the decoding phase, a token-level mask is applied by the syntax adapter to ensure that the model output falls only within a deterministically parsable call space, thus systematically compressing the generation freedom of "pseudo-tool call-based fabrication." Observations and artifacts returned by the sandbox are first evidenced as Evidence Objects (containing verifiable fingerprints, return codes, timeout and conflict markers) before being injected back into the next round of state updates. Execution failures are also recorded as evidence events in the audit log to drive minimum differential rollback. For coding branches, the sandbox can be extended to a repository-level execution environment to replay dependency installation, unit testing, and build processes, forming decidable feedback. For embodied branches, an execution channel in the form of simulation or data replay can be selected, writing environmental feedback as isomorphic evidence objects into the evidence pool, thereby maintaining the gating semantics and auditable closed-loop consistency of the E³-Loop across different modalities.
[0106] Regarding the selection of open-source datasets, this implementation plan requires that each type of data can provide a "decidable signal" for the closed-loop mechanism, rather than simply improving language fluency. ToolBench is used for general tools and execution trajectories; Ultra Feedback and Tülu's open recipes are used for general alignment and preferences; SWE-bench is used as a benchmark for real-world defect repair and testing for coding tasks, and APPS and Code Contests are used to supplement the distribution of decidable programming problems, enabling the model to learn to transform inference into runnable products under budget constraints and accept test judgments. For embodied tasks, Open X-Embodiment and Bridge DataV2 are used as cross-platform trajectory and manipulation data sources to cover vision-language-action conditional policy learning and cross-environment generalization, and success / failure, keyframe feedback, and task progress are explicitly written into the evidence object. Although the Code Contests repository is archived, the data and task definitions can still be used as training corpus and evaluation distributions, and its public description as a source of Alpha Code training data can be used to demonstrate its task attributes and decision-making mechanism.
[0107] Fine-tuning training is implemented in a distributed post-training pipeline within the PyTorch framework. The core objective is to train the "closed-loop protocol" into a generalizable strategy, rather than simply training a structured text surface. The training process begins with supervised fine-tuning of the closed-loop protocol: trajectory data is used to supervise the model's output action selection and tool specifications, ensuring stable triggering of retrieval, memory, or sandbox execution when uncertainty increases or evidence gaps appear, and generating an atomic claim set with evidence pointers after the evidence pool is updated. Next, gating threshold and preference convergence training is performed: preference data and failed replay samples are used to penalize strategies such as "strong assertions with insufficient evidence," "silent overwriting without resolving conflicts," "skipping execution when it should be executed," and "excessive rollback leading to semantic drift," ensuring stable boundaries for gating decisions and stopping conditions. Finally, sandbox consistency replay verification is performed: a fixed set of executable samples is repeatedly replayed in the later stages of training, requiring reproducible tool calls under the same budget, consistent evidence injection formats, and interpretable rollback differences, thus making the auditability of the closed loop a hard condition for training completion.
[0108] This process applies only minimal modifications to each pedestal required for its function: Qwen3.5-397B-A17B prioritizes parameter-efficient post-training, focusing its learnable capacity on layers related to uncertainty / calibration, claim-evidence binding, and tool specification constraints. The underlying reason is that the flagship pedestal already possesses strong representations, and the larger model needs to supplement closed-loop control semantics. Qwen3-30B-A3B-Instruct-2507 leans towards execution control, with training focusing on low-overhead tool triggering and gating stability. The underlying reason is that its advantage of achieving significant results with limited resources must be realized by reducing invalid inference and improving execution trigger accuracy. Qwen3-30B-A3B-Thinking-2507 is biased towards... For highly complex reasoning but constrained by budget, the training focus is on the discipline of "reasoning output only entering the gating as candidate claims" and the minimum difference rollback after failure. The underlying reason is that its value lies in turning reasoning into adjudicable actions rather than long texts. Qwen3-Coder-Next must use repository-level sandbox replay as hard supervision and solidify the closed loop of patch generation and test adjudication as a strategy. The underlying reason is that the reliability of coding comes from execution verification and rollback rather than static completion. LingBot-VLA mainly uses behavior cloning and introduces failure replay evidence training, so that the action output is also subject to gating adjudication and rollback revision. The underlying reason is that the error cost of embodied scenarios is higher, and the zero-risk fabrication rate can only rely on verifiable feedback. The training process employs PyTorch's distributed capabilities (such as FSDP / ZeRO-like strategies), bf16 hybrid processing, activation recomputation, and an efficient attention kernel. Gating pass rate, execution trigger hit rate, rollback frequency, budget deduction ledger, and evidence conflict graph size are recorded as first-class training logs, along with the loss curve, to demonstrate that the closed-loop behavior converges rather than occurs by chance.
[0109] Weight generation and engineering deployment are terminated based on the criteria of "product traceability, protocol alignment, and audit replayability". After each model is trained, it is exported as safetensors shard weights and written with version stamps and hash digests. The list of data used for training, filtering rules, trajectory protocol versions, tool specification schemas, random seeds, and key hyperparameters are also solidified into an artifact list. The inference framework uses an engine capable of handling long contexts and high-throughput decoding as its foundation, such as an inference service stack that is compatible with the Transformers ecosystem and supports KV-cache and batch processing. The Qwen official model card also clearly states its compatibility with inference frameworks such as vLLM and SGLang. At the same time, the upper-layer runtime implements the E³-Loop controller, tool syntax constraints, sandbox execution, and evidence object back-injection, making "evidence collection and execution" a system action governed by budget rather than a loose plug-in. The backend persistence layer stores Evidence Objects, gating decision records, budget ledgers, rollback differentials, and sandbox artifact hashes as first-class artifacts, supporting offline replay verification and failure attribution. Online monitoring uses the full names of five Chinese indicators as a unified standard, transforming model iteration from "more eloquent" to "more stable and verifiable under the same budget," and ensuring the consistency of closed-loop semantics between the deployment and training periods through periodic sampling of sandbox replay samples.
[0110] Tools and sandbox forensics should not be described as temporary add-ons during deployment, but should be consistently modeled as an "executable verification channel" shared by E³-Loop at both the training and inference ends: during the training phase, data such as ToolBench, which provides tool call trajectories, should be used as the main source. The call sequences, parameter slots, return codes, and failure reasons of multi-tool tasks should be standardized into replayable records, and the product summary, source chain, and timestamp generated by each call should be encapsulated and written back to the evidence pool so that evidence gating and rollback revisions can be learned and adjudicated on the same data structure. The sandbox employs a least-privilege isolated execution domain, separating external retrieval, web crawling, file system operations, numerical computation, and code execution into independent executors. For each type of executor, a ToolSpec and Schema or FSM (Finite State Machine) constraint are defined. During the decoding phase, a token-level mask is applied by the syntax adapter to ensure that the model output can only fall within a deterministically parsable call space, thus systematically compressing the degree of freedom in generating "pseudo-tool call-based fabrication." Observations and artifacts returned by the sandbox are first evidenced as EvidenceObjects containing verifiable fingerprints, return codes, timeout and conflict flags, and then injected back into the next round of state updates. Execution failures are also recorded as evidence events in the audit log to drive minimum-difference rollback. For coding branches, the sandbox can be extended to a repository-level execution environment to replay dependency installation, unit testing, and build processes, forming decidable feedback. For embodied branches, an execution channel in the form of simulation or data replay can be selected, writing environmental feedback as isomorphic evidence objects into the evidence pool, thereby maintaining the gating semantics and auditable closed-loop consistency of the E³-Loop across different modalities.
[0111] Example 3 This embodiment provides an evidence-driven closed-loop reasoning control system for generative models, which is deployed on a server or high-performance computing device. The system includes:
[0112] Processor: Multi-core CPU and / or GPU (e.g., NVIDIA A100 graphics card) for running large language models and E 3 -Loop control logic.
[0113] Memory: Includes RAM and persistent storage (such as SSDs). Memory stores:
[0114] Weight files for the base language model (such as the model parameters for Qwen2.5-7B); A computer program that implements the E³-Loop control logic. This program contains the following main modules:
[0115] State Management Module: Responsible for the central state St Initialization, updating, and persistence.
[0116] Routing decision module: Implements the Budgeted Value Information Router (BVoIR) algorithm.
[0117] Action execution engine: encapsulates the execution of actions such as THINK (calling the model inference interface), RETRIEVE (calling the retrieval API), and SANDBOX_EXEC (calling the sandbox environment).
[0118] Budget Management Module: Responsible for unifying budget ledgers B Deductions and status queries.
[0119] Log recording module: Manages immutable circular logs in an append-only manner. L .
[0120] Sandbox environment: An isolated, permission-restricted computing environment used to securely execute code and access files or network resources. For example, it can be implemented using Docker container technology.
[0121] External tool interface: used to connect to external information sources such as search engines and databases.
[0122] A computing device, namely a server or workstation that includes the aforementioned processor, memory and necessary peripherals.
[0123] An evidence-gated adjudication device, as a core component of the system, has its software module specifically implemented as follows: Claim Acquisition Module: From Atomic Claim Sets C The claims pending adjudication are read from the text.
[0124] Evidence search module: Based on the list of support claims, retrieve evidence from the evidence pool. E Search for relevant evidence information.
[0125] Decision module: Based on the detailed rules in Example 1, output the decision result of PASS / HOLD / FAIL.
[0126] Status update module: Configured to write the ruling result back to the system's central status data or audit log data. Specifically includes:
[0127] Update the status field of the corresponding claim in the atomic claim set C; The information, including the ruling action, the claim IDs involved, the ruling result, and the timestamp, is written to the immutable circular log L in an append-only manner. This update operation will drive the subsequent behavior of the system: for example, if the ruling result is HOLD or FAIL and there is a verification path, the routing decision module may prioritize the retrieval or execution of actions in the next round of decision-making; if the ruling result is FAIL and is associated with new evidence, it may trigger the rollback revision module to perform a minimum difference update on the claim.
[0128] The working principle of this embodiment is as follows: The user sends a query request to the computing device via a client. After the system starts, the processor loads the model weights and control program from memory. The program runs according to the flow described in Example 1: initializing the state → looping through routing decisions → executing actions → updating the evidence pool and claim set → evidence-gated adjudication → triggering rollback revisions if necessary → until the termination condition is met. Finally, the generated structured results are returned to the user. The core function of the evidence-gated adjudication device is to ensure that the entire inference control system strictly adheres to the "proof-carrying" principle through its modular adjudication and state update process, and its output directly drives the subsequent direction of the control loop.
[0129] Example 4 This embodiment provides a training method for training an artificial intelligence model to adapt to evidence-driven closed-loop reasoning control, including the following steps: Obtain a training sample set, wherein each training sample is associated with serialized inference trajectory data, the inference trajectory data including at least the central state data in multiple rounds of loops, the action labels executed, the update data of the evidence pool, and the differential revision record of the claim set based on the evidence gating decision results; The difference between the action decisions, evidence binding results, or claim revision results generated by the artificial intelligence model under the supervision of the inference trajectory data and the corresponding labels or results recorded in the training samples is used as the loss function; The parameters of the artificial intelligence model are optimized using the gradient descent algorithm to minimize the loss function.
[0130] Example 5 This embodiment provides an inference control chip for generative models. The inference control chip integrates a dedicated hardware circuit, which includes: A state management unit is used to efficiently store and update central state data in the inference loop. The central state data includes at least the problem objective, uncertainty vector, budget ledger, evidence pool, and atomic claim set. The routing decision unit is used to calculate the ratio of the expected decrease of the uncertainty vector to the action cost based on the central state data, and to quickly screen feasible actions according to budget constraints. An evidence matching unit is used to receive atomic claim queries and quickly retrieve associated evidence information from the evidence pool based on hardware-accelerated similarity calculation or hash indexing circuitry.
[0131] Example 6 This embodiment provides a hardware accelerator that includes the inference control chip as described in embodiment 5.
[0132] Example 7 This embodiment applies the evidence-driven closed-loop reasoning control method for generative models described in this invention to the automatic generation and verification of safety-critical code in the embedded system field, in order to address the stringent requirements for code reliability, security, and traceability in this field.
[0133] 1. System initialization and central state ( S t ) build The system runs on a server equipped with a GPU accelerator, and its software stack is based on the PyTorch framework and the Hugging Face Transformers library. During system initialization, the base model CodeLlama-34B-Instruct, which has been pre-trained on a code corpus, is loaded, and the E³-Loop control layer is integrated.
[0134] Central state S t It is instantiated as a structured data object, whose specific composition is as follows: Problem Objective ( Q ): Defined as a specific code generation task, such as: "Generate a CAN bus data reception and verification function compliant with the MISRA C-2012 standard for automotive electronic control units (ECUs). The function needs to perform ID validity checks, length field verification, and CRC32 checks on the received data frames."
[0135] Structured uncertainty vector ( U This is represented by a five-dimensional vector, computed in real time using a proprietary uncertainty estimator. This estimator analyzes the current state of the claim set and the evidence pool, outputting values for each dimension:
[0136] u answer : Confidence in the generated code based on the model.
[0137] u evidence Based on the coverage and quality of the evidence (such as unit test coverage and the number of static analysis warnings) attached to the current code claim.
[0138] uexec Based on whether the task description contains elements that need to be verified through the sandbox (such as whether the CRC check is implemented correctly).
[0139] u spec : Evaluate whether the generated code strictly conforms to coding standards such as MISRA C-2012.
[0140] u risk Based on whether the code functionality involves safety-critical operations (such as vehicle control).
[0141] Unified Budget Ledger ( B The "computation unit" is used as the unified quantification metric. The initial budget is set at 10,000 units. The resource consumption model is defined as follows: code generation (THINK) consumes 10 units / thousand tokens; retrieval (RETRIEVE) consumes 50 units / time; in sandbox execution (SANDBOX_EXEC), running unit tests consumes 100 units, executing Clang StaticAnalyzer consumes 200 units, and running Valgrind Memcheck consumes 300 units.
[0142] Evidence pool ( E Evidence blocks are stored using a key-value database. Each evidence block contains the following fields:
[0143] id: Unique identifier.
[0144] type: Enumerated types, such as OFFICIAL_SPEC (MISRA standard document), UNIT_TEST_RESULT, STATIC_ANALYSIS_REPORT, DYNAMIC_ANALYSIS_REPORT.
[0145] content: Evidence content or storage path.
[0146] provenance: Source information, such as tool name, version, and runtime timestamp.
[0147] reliability: Reliability score, assigned based on the authority of the source (e.g., 1.0 in the official specification, 0.9 in the test result).
[0148] Atomic Claims Set ( C The system generates an abstract syntax tree from the Clang parser using the generated C language code, and extracts atomic claims from it. For example:
[0149] Claim C001: "Line 15 of the code: Before dereferencing the pointer pMsg, a non-null check was performed using if(pMsg !=NULL)."
[0150] Claim C002: "Line 22 of the code: When using the memcpy function, the size of the destination buffer (sizeof(dest_buf)) is greater than the length of the source data (data_len)."
[0151] Each claim contains an id, code_span, description, status (initially PENDING), support_evidence_ids (a list), and risk_tag (such as SAFETY_CRITICAL).
[0152] Immutable Circular Log ( L ): Uses an append-only WAL (Write-Ahead Log) format file. Each record contains a sequence number, timestamp, hash of the previous record, current action, state snapshot hash, etc., forming a tamper-proof hash chain.
[0153] 2. Execution of closed-loop control process After the system starts up, it enters a central state. S t The core of the loop control process.
[0154] Step G1, Routing Decision: The router reads the current state using budgeted value information. Assume the current uncertainty vector U is displayed. u evidence (The evidence is) relatively sufficiency, and the budget ledgers are consistent. B Sufficient. The router calculates the expected cost-benefit ratio for each action. For example, estimating that performing a static analysis (SANDBOX_EXEC, cost 200 units) might significantly reduce... u evidence and u spec Its information is of high value, so the current action is SANDBOX_EXEC.
[0155] Step G2, Action Execution: The system executes the selected SANDBOX_EXEC action. In a Docker-based isolated sandbox environment, the following toolchain is invoked sequentially:
[0156] Compile using the GCC compiler (with the -Wall -Wextra -Wpedantic flags) and generate a build report.
[0157] The Clang Static Analyzer is invoked to perform in-depth static analysis and generate a potential defect report.
[0158] Run unit tests based on the CppUTest framework to verify the correctness of core functions such as CRC check.
[0159] Dynamic memory analysis was performed using the Valgrind Memcheck tool. After the sandbox execution was complete, the output of all tools (build logs, analysis reports, test results, and memory check reports) was encapsulated into a new evidence block and stored in evidence pool E.
[0160] Step G3, Evidence Gating Adjudication: The evidence gating adjudication device is triggered. Its claim acquisition module reads all claims with a PENDING status from C. The evidence query module retrieves relevant information based on the support_evidence_ids of each claim and newly added evidence. The adjudication module adjudicates based on predefined rules:
[0161] For claims of C001 (pointer not null check), if neither the static analysis report nor the Valgrind report mentions the risk of null pointers, the decision is PASS.
[0162] For claims of C002 (buffer size check), if the static analysis report indicates a possible buffer overflow, the decision is FAIL.
[0163] Step G4, Status Update and Rollback: The status update module writes the ruling result back to claim set C (updating the status field) and records this ruling action in log L. For claim C002, which was ruled FAIL, the system triggers a minimum difference rollback revision. The code revision module analyzes the AST, locates the memcpy statement, and replaces it with a safer memcpy_s function (if the environment supports it) or adds explicit boundary checking logic. This revision only affects a local code subtree and generates the corresponding code diff. Atomic Claim Set C The claim was updated accordingly, with claim C002 revised into a new claim C002', and the evidence was re-attached.
[0164] Loop and Termination The system repeats steps S1 to S4 above until the termination condition is met: Condition 1 (Budget Exhausted): Unify Budget Ledger B When the balance drops to 0, the system is forcibly terminated.
[0165] Condition 2 (Reliable Convergence): All claims marked SAFETY_CRITICAL pass the gated decision (PASS), and the maximum component value of the uncertainty vector U is below the threshold of 0.1. After termination, the system outputs structured results, including: the final set of passed atomic claims C, a list of evidence indexes associated with each claim, a summary of residual uncertainties, and a complete budget execution audit report.
[0166] This embodiment applies the invention to the specific industrial field of embedded secure coding. Through deep integration with professional toolchains (Clang Static Analyzer, Valgrind, etc.), it achieves the evidentiary and auditable nature of the code generation process. The final output is a highly reliable code module with verifiable evidence chains (such as zero-warning reports in static analysis and proof of 100% pass rate in unit tests). It can be directly used in automotive electronic software development processes that comply with the ISO 26262 standard, significantly improving the reliability and security of automated code generation and solving the long-standing technical problem of lack of trust in third-party generated code in this field.
[0167] In the specific construction, fine-tuning, and adaptation process, taking a specific implementation scenario regarding the answer to "whether a certain objective factual proposition is true and what the basis is," the system first initializes the central state. S t ={ Q , U , B , E , C , L},in Q Record the objective of the problem to be solved. U Characterizes the uncertainty of current conclusions, gaps in evidence adequacy, necessity of external verification, risk of inconsistent tool specifications, and exposure to high-risk assertions. B To standardize budget books, E Empty evidence pool C For empty atom claim set, L This serves as the initial circular log. Subsequently, the budgeted value information router is based on... U and B Among actions such as internal reasoning, external retrieval, memory lookup, and sandbox execution, the candidate action with the greatest expected reduction in unit budget uncertainty is selected; when the system determines that external evidence collection is more profitable, a retrieval or sandbox execution is triggered to obtain external evidence with source pointers, timestamps, and return status, and this evidence is written into the evidence pool. E Then, the claim generation and evidence binding module forms an atomic claim set. CSubsequently, the evidence gating process applies a "support coverage—source reliability—conflict relationship—risk level" decision to each atomic claim: if the support is sufficient and there are no unresolved conflicts, the claim is approved; if the evidence is insufficient but a clear verification path exists, the claim remains suspended and further evidence is triggered; if the result of the decision or new evidence constitutes refutation, only the affected claims are subject to minimum differential rollback revision, while unaffected claims remain unchanged. Finally, when the residual uncertainty falls below a threshold or the budget reaches the termination condition, the system outputs a structured result including the atomic claim, corresponding evidence index, decision status, budget summary, and residual uncertainty explanation, thus completing an evidence-driven closed-loop truth-seeking reasoning process in an auditable, replayable, and budget-controlled manner.
[0168] In this embedded code generation scenario, the evidence pool E is a structured database used to store all "evidence blocks" generated during the verification process. Assuming the system is generating a CAN bus data processing function for a car ECU, the evidence pool might contain the following entries:
[0169] 1. E1: { id: "E001", type: "STATIC_ANALYSIS_REPORT", content: "ClangStatic Analyzer v16 report: In line 15 of the code file can_handler.c, the pointer pMsg was checked by if (pMsg != NULL) before dereferencing, and no risk of null pointer dereferencing was found.", provenance: {source:"Clang Static Analyzer", version: "16", timestamp: "2024-12-01T10:30:00Z"}, reliability: 0.95}.
[0170] 2. E2: { id: "E002", type: "UNIT_TEST_RESULT", content: "CppUTest unit test suite 'test_crc32': 100% pass rate. Test cases cover normal data, error data, and boundary value cases.", provenance: {source: "CppUTest", version: "4.0", timestamp: "2024-12-01T10:35:00Z"}, reliability: 0.90}
[0171] 3. E3: { id: "E003", type: "DYNAMIC_ANALYSIS_REPORT", content: "Valgrind Memcheck report: No memory leaks or illegal memory accesses were detected during a 1-hour stress test.", provenance: {source: "Valgrind", version: "3.22", timestamp: "2024-12-01T11:00:00Z"}, reliability: 0.92}
[0172] 4. E4: { id: "E004", type: "STATIC_ANALYSIS_REPORT", content: "ClangStatic Analyzer v16 report: In line 22 of the code file can_handler.c, in the call memcpy(dest_buf,src_data, data_len), the size of the target buffer dest_buf is not explicitly verified to be greater than data_len, posing a potential buffer overflow risk.", provenance: {source: "Clang Static Analyzer",version: "16", timestamp: "2024-12-01T10:30:00Z"}, reliability: 0.95,conflicts: [{evidence_id: "E002", relation: "Partial contradiction", score: 0.7}] / / Although the unit test passed, static analysis pointed out a potential risk.}
[0173] The evidence pool in this embodiment has the following functions: 1. Rigid binding of conclusion and evidence: When the model generates an atomic claim, such as C001: "pointer pMsg was not null checked before being dereferenced", the claim must provide the ID of its supporting evidence (e.g., support: ["E001"]). The evidence pool ensures that every generated assertion about code security is not unfounded, but is backed by traceable and verifiable tool reports. This fundamentally solves the problem of "evidence-conclusion decoupling".
[0174] 2. Conflict Detection and Explicit Management: The claim C002, "The memcpy operation is safe," might cite evidence E2, which states that the unit tests passed. However, evidence E4 in the evidence pool explicitly points to a potential buffer overflow risk and marks a "partial contradiction" with E2. The evidence pool does not silently cover up conflicts. The evidence gating system detects this conflict during adjudication and adjudicates claim C002 as HOLD or FAIL, triggering further verification actions (such as more rigorous boundary testing), rather than ignoring the risk and directly assuming safety. This avoids erroneous decisions based on incomplete information.
[0175] 3. Driving the verification process and resource allocation: Conflicts or insufficient evidence in the evidence pool are directly reflected in the uncertainty vector U (e.g., increased evidence and urisk). High uncertainty guides the budgeted value information router to prioritize actions that efficiently acquire new evidence (such as running additional static analysis or fuzzing) rather than continuing to generate code. This allows limited budget resources to be intelligently allocated to where verification is most needed, improving verification efficiency.
[0176] 4. Supports precise rollback and auditing: When new evidence (such as a failed boundary test) refutes claim C002, the system performs a minimum differential rollback. Based on the precise location of E4 in the evidence pool (line 22), it modifies only the problematic memcpy call (e.g., changing it to memcpy_s), rather than rewriting the entire function. The evidence pool provides precise evidence for revisions, ensuring the accuracy and traceability of code changes. Simultaneously, all evidence introductions, adjudication results, and revision records are written to the immutable log L, forming a complete audit chain and meeting the stringent requirements for process auditability in safety-critical areas.
[0177] Therefore, in this embodiment, the evidence pool is not only a repository of information but also a hub for quality control. Through mandatory evidence binding, explicit conflict management, and driving the verification process, it transforms AI code generation from an uncontrollable "black box" process into a verifiable, auditable, and trustworthy industrial process.
[0178] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, several equivalent substitutions or obvious modifications can be made without departing from the concept of the present invention, and all such modifications, achieving the same performance or purpose, should be considered within the scope of protection of the present invention.
Claims
1. An evidence driven closed loop reasoning control method for generative models, characterized in that, The evidence-driven closed-loop reasoning control method is implemented by a processor executing a computer program stored in memory, and includes the following steps: S1. Maintain the central state, wherein the central state includes a unified budget ledger, evidence pool, problem objectives, structured uncertainty vector representing the uncertainty of the reasoning process, immutable circular log, and atomic claim set, which are used to uniformly manage the target information, process uncertainty information, resource budget information, evidence information, reasoning claim information, and process audit information of the reasoning task; S2. Based on the current state of the central state, select actions from a predefined set of actions using a budgeted value information router, wherein the selection of actions aims to maximize the reduction of expected unit budget uncertainty under the constraints of the unified budget ledger; the objective function of the budgeted value information router in selecting actions is: in, For optimal action, t The index is the number of iterations, and argmax is the action that maximizes the objective function. A For a set of actions, w It is a five-dimensional non-negative weight vector. T It is the transpose symbol. It is in state S t Next action The uncertainty of the vector form decreases. For cost function, Small positive constants This indicates that "the following constraints are satisfied". The budget update equation representing the deduction of costs; S3. Execute the selected action and update the evidence pool and / or the atomic claim set based on the execution result; S4. Perform evidence gating adjudication on each atomic claim in the atomic claim set. The evidence gating adjudication is based on the support, reliability and conflict relationship of the evidence associated with the atomic claim in the evidence pool, and outputs a ruling result of pass, postponement or failure. If the ruling is postponed or fails, and a verifiable path exists, a sandbox execution action is triggered to obtain new evidence and update the evidence pool, and the affected atomic claims are revised with minimum difference rollback based on the new evidence. When the preset termination condition is met, the reasoning process terminates and a structured result is output. The structured result includes at least the set of atomic claims, the evidence index associated with each atomic claim, and a summary of residual uncertainty.
2. The evidence-driven closed-loop reasoning control method according to claim 1, characterized in that, In step S1, the structured uncertainty vector includes at least one of the following dimensions: uncertainty of the candidate conclusion itself, evidence sufficiency gap, necessity of performing verification, risk of tool specification consistency, and exposure to high-risk assertions. The unified budget ledger quantifies and manages at least one heterogeneous resource, including lexical consumption, tool calls, execution time, and loop steps.
3. The evidence-driven closed-loop reasoning control method of claim 1, wherein, In step S2, the predefined set of actions includes at least one of the following actions: internal reasoning, external retrieval, memory lookup, sandbox execution, and submission.
4. The evidence-driven closed-loop reasoning control method of claim 1, wherein, In step S4, the rules for the evidence gating decision include: The ruling is passed if and only if the atomic claim is bound to a valid evidence pointer, the reliability-weighted support of the evidence exceeds a threshold, and there is no unresolved high-intensity conflict evidence. When there is insufficient evidence or unresolved conflicts, but a clear path for further verification exists, the ruling is to postpone the decision. When a high-risk claim lacks any supporting evidence or when there is solid evidence to refute it, the ruling is unsuccessful.
5. An evidence driven closed loop reasoning control system for generative models, characterized in that, The evidence-driven closed-loop reasoning control system includes a processor and a memory. The memory stores computer programs; The processor is configured to implement the evidence-driven closed-loop reasoning control method as described in any one of claims 1 to 4 when executing the computer program.
6. An evidence-gated decision device characterized by, The evidence gating adjudication device is applied to the evidence-driven closed-loop reasoning control system of claim 5, and the evidence gating adjudication device comprises: The claim acquisition module is configured to acquire atomic claim sets. The evidence query module is configured to query evidence information associated with atomic claims in the atomic claim set from the evidence pool; The adjudication module is configured to perform evidence-gated adjudication on each atomic claim based on the associated evidence information. The adjudication is based on the support, reliability, and conflict relationship of the evidence associated with the atomic claim in the evidence pool, and outputs an adjudication result of pass, postponement, or failure. The status update module is configured to write the adjudication result into the central status data or audit log data of the inference control system to drive subsequent inference action decisions or trigger claim rollback updates. The adjudication rules of the adjudication module include: The ruling is passed if and only if the atomic claim is bound to a valid evidence pointer, the reliability-weighted support of the evidence exceeds a threshold, and there is no unresolved high-intensity conflict evidence. When there is insufficient evidence or unresolved conflicts, but a clear path for further verification exists, the ruling is to postpone the decision. When a high-risk claim lacks any supporting evidence or when there is solid evidence to refute it, the ruling is unsuccessful.
7. An evidence driven closed loop reasoning control method for safety critical code generation and verification of embedded systems, characterized in that, The evidence-driven closed-loop reasoning control method is implemented by a processor executing a computer program stored in memory, and includes the following steps: F1. Initialize and maintain the central state, which includes at least a unified budget ledger, an evidence pool, and an atomic claim set; the central state also includes at least: The problem objective is defined as the security specifications and functional requirements of the code to be generated; Structured uncertainty vectors are used to quantify the uncertainties in the generated code regarding functional correctness, specification compliance, and memory safety. F2. Based on the current state of the central state, actions are selected from a predefined set of actions via a budgeted value information router. This set includes code generation, code retrieval, static analysis execution, and dynamic test execution. The action selection aims to maximize the expected reduction in unit budget uncertainty under the constraints of the unified budget ledger. The unified budget ledger quantifies the resource consumption of code generation, static analysis, and dynamic testing using a unified caliber for computational units. The evidence pool stores output reports from compilers, static analysis tools, unit testing frameworks, and dynamic analysis tools. The atomic assertion set obtains atomic assertions related to code security by parsing the abstract syntax tree of the generated code. F3. Execute the selected action. If the action is code generation, update the atomic claim set. If the action is static analysis or dynamic test execution, store the tool output report as an evidence block in the evidence pool. F4. Perform evidence-gated adjudication on each atomic claim in the atomic claim set, the evidence-gated adjudication being based on compiler warnings, static analysis results, test coverage and memory check reports associated with the claim in the evidence pool, and outputting an adjudication result of pass, deferred or fail; If the ruling is postponed or fails, and there is a path that can be verified through further static analysis or dynamic testing, then the corresponding sandbox execution action is triggered to obtain new evidence and update the evidence pool, and the affected code segment and the corresponding atomic claim are revised by minimum difference rollback based on the new evidence. When the preset termination conditions are met, the code generation and verification process is terminated, and a structured result is output. The structured result includes at least the final code that has been adjudicated, an evidence index associated with the security claims in the code, a summary of residual uncertainties, and a budget execution audit report. The rules for the evidence gating decision include: The ruling is passed if and only if the atomic claim has a corresponding static analysis pass report and a dynamic test pass report in the evidence pool that are reliable and conflict-free and have a reliability exceeding the threshold. When an atomic claim lacks sufficient test coverage or has unresolved static analysis warnings, the ruling is suspended. When an atomic claim is reported as a conclusive security flaw by static analysis or dynamic testing tools, the ruling is deemed invalid.
8. The evidence-driven closed-loop reasoning control method of claim 7, wherein, In step F4, the minimum differential rollback revision specifically involves: using a code diffing tool to locate the disproven code segment, performing a security rewrite only on that code segment, and synchronously updating the atomic claim set, rather than regenerating all the code.