Large language model structured adaptive correction and optimization method and system

CN122549546APending Publication Date: 2026-08-11XINHUA NEWS AGENCY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-09
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0008]本发明的目的是提供一种大语言模型结构化自适应纠偏与调优方法及系统,旨在解决大语言模型在生成结构化数据时,因无法精准识别与区分拓扑结构与内容填充错误,导致的纠偏效率低、反馈信号不连续、模型能力难以闭环演进的技术问题

Benefits of technology

本发明提出的一种大语言模型结构化自适应纠偏与调优方法,通过双轨诊断引擎与动态提示词合成机制,将结构偏差量化为节点级修复指令,克服了传统泛化报错机制的盲目性,显著提高模型在工业级场景下的单次修复成功率与推理资源利用效率。其中,双轨诊断引擎引入抽象拓扑同态契合度(ATHC)与多维原子语义保真度(MASF)双轨量化指标,实现对拓扑畸变与内容错位的精准识别,弥补了传统线性评估指标对结构性崩溃不敏感的缺陷,为数据校验提供确定性数学依据,增强了异常识别能力与诊断准确性。最后本发明将双轨量化指标直接融合为稠密奖励信号,构建强化学习优化目标函数,推动模型在参数层面内生习得树状结构规划能力,形成从错误诊断到底层能力提升的闭环演进机制,实现推理与微调的闭环演进。且本发明能够全流程自动化运行,无需人工编写正则规则或标注纠偏样本,减少人工干预,显著降低系统维护成本,提升系统的可扩展性与通用性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122549546A_ABST
    Figure CN122549546A_ABST
Patent Text Reader

Abstract

This invention proposes a structured adaptive correction and optimization method and system for large language models, belonging to the fields of artificial intelligence and natural language processing. The method includes acquiring the preliminary structured output of the large language model, parsing it and the target structured data into abstract syntax trees respectively, and performing topological structure diagnosis and atomic content diagnosis in parallel to obtain quantized values ​​of topological structure deviation and atomic content deviation. When the quantization diagnosis result of at least one dimension does not meet preset conditions, a correction instruction is generated based on the deviation quantization residual of the corresponding dimension, and the correction instruction is fed back to the large language model to drive its iterative repair. The aforementioned interaction data is collected and used as training samples. A dense reward function is constructed to optimize the model's strategy, achieving autonomous evolution of the model's structured generation capability. This invention solves the technical problems of low correction efficiency, discontinuous feedback signals, and difficulty in closed-loop evolution of model capabilities when large language models generate structured data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of artificial intelligence and natural language processing technology, specifically relating to a structured adaptive correction and optimization method and system for large language models. Background Technology

[0002] With the widespread application of large language models in the field of natural language processing, they have gradually evolved from a single dialogue interface into a core engine driving intelligent agents and retrieval enhancement generation workflows. In the process of this technological paradigm evolution, how to accurately convert unstructured natural language intent into strictly machine-readable structured data (such as JSON, XML, etc.) has become a key indicator for measuring the industrial application capability of models.

[0003] However, current large language models, based on autoregressive generation mechanisms of one-dimensional linear text sequences, struggle to effectively handle generation tasks involving multi-dimensional topological structures or deeply nested logic. This often results in issues such as missing structural controllers, disordered hierarchy, and degraded object containers in the generated data. These structural errors not only compromise the syntactic integrity of the data but also directly prevent downstream systems from parsing or accessing it, ultimately leading to business interruptions.

[0004] To address the above problems, existing technologies mainly rely on the following methods: 1. Passive interception system based on rule parsing and text overlap: This method captures generalization anomalies through a parser and feeds them back to the model, or evaluates the generation quality through metrics such as BLEU and ROUGE. However, its diagnostic granularity is coarse, and it cannot distinguish between the differences in topological structure and content filling, resulting in low retry efficiency and distorted evaluation.

[0005] 2. Dynamic verification techniques based on external execution environments: This method obtains dynamic feedback by executing generated code or query statements through a compiler or database. However, its applicability is limited; it cannot be applied to statically serialized data (such as JSON and XML) that lacks executable semantics, and the feedback signals are mostly binary, failing to provide continuous gradients for model optimization.

[0006] 3. Flexible Feedback Mechanism Based on a Large-Parameter Referee Model: This method utilizes a large model to evaluate the generated results and provides natural language feedback. However, its output is random and uncertain, posing a risk of illusion, and has high inference costs, making it difficult to convert into the dense reward signals required for reinforcement learning.

[0007] In summary, existing technologies have significant limitations in terms of diagnostic accuracy, applicability, feedback effectiveness, and model evolution capabilities. There is an urgent need for an automated system that can deeply integrate structural diagnosis, precise correction, and model capability evolution. Summary of the Invention

[0008] The purpose of this invention is to provide a structured adaptive correction and optimization method and system for large language models, aiming to solve the technical problems of low correction efficiency, discontinuous feedback signals, and difficulty in closed-loop evolution of model capabilities caused by the inability to accurately identify and distinguish topological structure and content filling errors when generating structured data in large language models.

[0009] In a first aspect, the present invention provides a structured adaptive correction and optimization method for large language models, comprising the following steps: Obtain the initial structured output generated by the large language model in response to business instructions; The initial structured output and the preset target structured data are parsed into abstract syntax trees respectively. Based on the abstract syntax trees, quantitative diagnosis is performed on the two dimensions of topological structure and atomic content to obtain the quantitative values ​​of topological structure deviation and atomic content deviation. When the quantitative diagnostic results of at least one dimension do not meet the preset conditions, node-level natural language correction instructions are generated based on the deviation quantitative residual of the corresponding dimension, and the correction instructions are fed back to the large language model to drive its iterative repair. Collect interactive data containing preliminary structured output, topological deviation quantization value, atomic content deviation quantization value, correction instructions and repaired output, and use it as training samples for reinforcement learning. Based on reinforcement learning training samples, a dense reward function is constructed that integrates the topological structure deviation quantization value and the atomic content deviation quantization value. The policy is then optimized for large language models to achieve the autonomous evolution of the structured generation capability of large language models.

[0010] As an alternative implementation, the preliminary structured output and the preset target structured data are parsed into abstract syntax trees, respectively. Based on these abstract syntax trees, quantitative diagnostics are performed on both the topological structure and atomic content dimensions to obtain the topological structure deviation quantization value and the atomic content deviation quantization value, specifically including: The initial structured output and the target structured data are parsed into standardized recursive abstract syntax tree structures, with each node defined as a quintuple containing node type, key name, atomic value, set of child nodes, and depth information. The abstract topological homomorphic fit is calculated as a quantitative value of topological deviation. The abstract topological homomorphic fit is quantified by introducing a dynamic editing cost function with depth decay factor and node type weight to quantify the topological difference between the prediction tree and the target tree. Multidimensional atomic semantic fidelity is calculated as a quantitative value of atomic content deviation. Multidimensional atomic semantic fidelity is achieved by reducing the dimensionality of the tree structure to a set of semantic triples and constructing a soft intersection measure based on graph embedding and continuous similarity function to quantify the mapping accuracy of atomic content.

[0011] As an alternative implementation method, calculating the abstract topological homomorphic fit specifically includes: Define a sequence of edit operations to transform the prediction tree into the target tree. The single-step penalty cost of each edit operation is the product of the depth decay factor and the node type weight. The depth decay factor is negatively correlated with the depth of the node in the abstract syntax tree, and the node type weight is pre-set according to the node semantic type. The global topological heterogeneity loss value is obtained by minimizing the topology offset loss matrix through dynamic programming. The global topological heterogeneity loss value is exponentially smoothed and scale-normalized to obtain the abstract topological homomorphic fit.

[0012] As an alternative implementation method, calculating the multidimensional atomic semantic fidelity specifically includes: The prediction tree and the target tree are reduced to a set of semantic triples, each triple containing an absolute path vector, a key name, and an atomic value. Construct a graph embedding representation of path vectors and define a similarity function between triples, which is a weighted sum of path embedding cosine similarity and atomic value normalized similarity; The maximum bipartite graph matching is constructed based on the triplet similarity function, and the soft intersection measure is obtained. The soft intersection measure is the sum of the matching weights between the predicted triplet and the target triplet that are higher than the similarity threshold. Multidimensional atomic semantic fidelity is calculated based on the joint metric of generalized fuzzy sets, soft intersection measure, and cardinality of triple sets.

[0013] As an alternative implementation method, node-level natural language correction instructions are generated based on the deviation quantization residuals of the corresponding dimension, specifically including: When the topology deviation quantification value is lower than the first preset threshold, a structural constraint correction instruction for topology distortion is synthesized based on the editing operation path with the highest absolute cost recorded during the topology diagnosis process. When the topology deviation quantization value meets the first preset threshold but the atomic content deviation quantization value is lower than the second preset threshold, a content calibration correction instruction for atomic content mapping misalignment is synthesized based on the isolated semantic triples filtered during the atomic content diagnosis process.

[0014] As an alternative implementation, the dense reward function is the sum of a nonlinear combination of the topological structure deviation quantization value and the atomic content deviation quantization value and a KL divergence penalty term, and its expression is: ; Wherein, ATHC represents the abstract topological homomorphic fit, and MASF represents the multidimensional atomic semantic fidelity. and To balance topological rigor with semantic richness through adaptive weighting, Here is the divergence penalty coefficient. For the current strategy model, This is a reference model.

[0015] Secondly, this invention provides a structured adaptive error correction and optimization system for large language models, comprising: The large language model inference module is configured to: obtain the initial structured output generated by the large language model in response to business instructions; The dual-track diagnostic engine is configured to: parse the initial structured output and the preset target structured data into abstract syntax trees respectively, and perform quantitative diagnostics on the two dimensions of topological structure and atomic content based on the abstract syntax trees to obtain the topological structure deviation quantization value and the atomic content deviation quantization value. The dynamic prompt word synthesizer is configured to generate node-level natural language correction instructions based on the deviation quantization residual of the corresponding dimension when the quantitative diagnosis result of at least one dimension does not meet the preset conditions, and feed the correction instructions back to the large language model to drive its iterative repair. The closed-loop fine-tuning database is configured to collect interactive data containing preliminary structured output, topological deviation quantization value, atomic content deviation quantization value, correction instructions and repaired output, and use it as training samples for reinforcement learning. The reinforcement learning alignment module is configured to: construct a dense reward function based on reinforcement learning training samples that integrates the topological structure deviation quantization value and the atomic content deviation quantization value, optimize the policy of the large language model, and realize the autonomous evolution of the structured generation capability of the large language model.

[0016] Thirdly, the present invention provides an electronic device including a memory and a processor, and computer instructions stored in the memory and running on the processor, wherein the computer instructions, when executed by the processor, perform the method described in the first aspect.

[0017] Fourthly, the present invention provides a computer-readable storage medium for storing computer instructions, which, when executed by a processor, perform the method described in the first aspect.

[0018] Fifthly, the present invention provides a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect.

[0019] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention proposes a structured adaptive error correction and optimization method for large language models. Through a dual-track diagnostic engine and a dynamic prompt word synthesis mechanism, structural deviations are quantified into node-level repair instructions, overcoming the blindness of traditional generalized error reporting mechanisms and significantly improving the single-repair success rate and inference resource utilization efficiency of the model in industrial-grade scenarios. Specifically, the dual-track diagnostic engine introduces abstract topological homomorphic fit (ATHC) and multidimensional atomic semantic fidelity (MASF) dual-track quantization indicators to accurately identify topological distortions and content misalignments. This compensates for the insensitivity of traditional linear evaluation indicators to structural collapse, providing deterministic mathematical basis for data verification and enhancing anomaly identification capabilities and diagnostic accuracy. Finally, this invention directly integrates the dual-track quantization indicators into a dense reward signal, constructing a reinforcement learning optimization objective function. This drives the model to intrinsically learn tree-structure planning capabilities at the parameter level, forming a closed-loop evolution mechanism from error diagnosis to underlying capability improvement, achieving a closed-loop evolution of inference and fine-tuning. Furthermore, this invention can operate automatically throughout the entire process without the need for manual writing of regular rules or labeling of correction samples, thus reducing manual intervention, significantly lowering system maintenance costs, and improving the scalability and versatility of the system.

[0020] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0021] Figure 1 This is a flowchart of a structured adaptive correction and optimization method for large language models disclosed in an embodiment of the present invention; Figure 2 This is a framework diagram of a structured adaptive correction and optimization method for large language models disclosed in an embodiment of the present invention. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.

[0023] The technical solutions disclosed in the various embodiments of this application are described in detail below with reference to the accompanying drawings.

[0024] Example 1 like Figures 1 to 2As shown, this embodiment addresses the "topology collapse" and "deeply nested content misalignment" problems that easily occur when large language models perform structured data generation tasks, and provides a structured adaptive correction and optimization method for large language models. This method abandons the traditional application-layer code's simple interception and blind retry mechanism based on regular expressions, and instead introduces abstract syntax tree parsing technology and set mapping theory from compiler principles into the inference feedback loop of the large language model. The overall architecture consists of four core components: the large language model inference side, a dual-track diagnostic engine, a dynamic prompt word synthesizer, and a closed-loop fine-tuning database, forming a complete closed loop in logical flow: "initial generation, deep diagnosis, precise adaptive correction, and reinforcement learning feedback."

[0025] This embodiment provides a structured adaptive correction and optimization method for large language models, including the following steps: Obtain the initial structured output generated by the large language model in response to business instructions; The initial structured output and the preset target structured data are parsed into abstract syntax trees respectively. Based on the abstract syntax trees, quantitative diagnosis is performed on the two dimensions of topological structure and atomic content to obtain the quantitative values ​​of topological structure deviation and atomic content deviation. When the quantitative diagnostic results of at least one dimension do not meet the preset conditions, node-level natural language correction instructions are generated based on the deviation quantitative residual of the corresponding dimension, and the correction instructions are fed back to the large language model to drive its iterative repair. Collect interactive data containing preliminary structured output, topological deviation quantization value, atomic content deviation quantization value, correction instructions and repaired output, and use it as training samples for reinforcement learning. Based on reinforcement learning training samples, a dense reward function is constructed that integrates the topological structure deviation quantization value and the atomic content deviation quantization value. The policy is then optimized for large language models to achieve the autonomous evolution of the structured generation capability of large language models.

[0026] The technical solution of this invention will now be described in detail in stages, following the data processing flow: Phase 1: Business instruction parsing and initial reasoning of the large language model.

[0027] The operation of this method begins with an input business instruction issued by the upstream business system. This instruction typically includes an unstructured natural language task description and implicit or explicit constraints on the target output data format. Upon receiving this instruction, the large language model's inference side initiates forward inference computation, generating a preliminary structured output based on its autoregressive mechanism. Since the large language model is essentially a system for probabilistic prediction based on one-dimensional linear text sequences, it is highly susceptible to contextual attention decay and recursive logic stack overflow when processing multi-dimensional spatial grids or deeply nested tree structures. Therefore, while the preliminary structured output may appear normal in terms of surface character coherence, it often harbors two types of hidden and fatal errors: the first is topological illusion, manifested as missing key closing symbols, disordered nesting levels, or degraded object containers; the second is disordered atomic content mapping, manifested as filling specific business values ​​into incorrect logical paths within the correct structural framework. Faced with these preliminary data that contain topological or content illusions, the system will not directly intercept them and perform simple error processing. Instead, it will import them in full into the core component below, namely the dual-track diagnostic engine, for in-depth mathematical analysis.

[0028] Phase Two: High-dimensional in-depth analysis and complex quantitative calculations of the dual-track diagnostic engine.

[0029] The dual-track diagnostic engine is the core guiding module for achieving automated error correction in this invention. This engine first activates the heterogeneous data unified parsing module, performing a reverse generation of an abstract syntax tree (AST), mapping multimodal heterogeneous serialization syntaxes (such as JSON and XML) to a unified abstract space. The system uses a recursive descent parsing algorithm to transform the target data (target structured data) and the predicted data (i.e., the initial structured output) into a standardized recursive abstract syntax tree structure. Each node in this tree structure is strictly defined as a quintuple. ,in, The semantic type of the node, whose value range covers root nodes, dictionary container nodes, list container nodes, and atomic numeric nodes. This type attribute determines the validity and legality of subsequent fields of the node. The key name identifier of the node is used for unique addressing in the dictionary structure; This field is used to store the specific atomic data values ​​carried by leaf nodes; it is empty for non-leaf nodes. This indicates the index position of a node in an ordered list structure, used to maintain the sequence order; This represents the sequence of child nodes contained in the node, and its recursive definition supports nested structures of arbitrary depth. This abstraction process fully preserves the deep nesting logic and parent-child dependencies of the data, while removing syntactic noise such as parentheses and colons. Based on this, the engine's data flow is divided into two parallel, complex quantitative diagnostic branches, replacing the traditional simple distance or intersection-union ratio calculations. Specifically, the target data is transformed into a standardized, recursively abstract syntax tree structure to obtain the baseline tree. The prediction data is transformed into a standardized, recursive abstract syntax tree structure to obtain the prediction tree. .

[0030] The first parallel branch is the topology diagnostic module, responsible for calculating the Abstract Topological Homomorphic Congruence (ATHC). This module abandons the traditional uniform cost tree edit distance and introduces a non-linear cost function with "depth awareness" and "node type weights." Considering that in structured data, topological disruptions to root or shallow nodes are often more detrimental to the overall parsing than disruptions to deep leaf nodes, the system defines a dynamic edit cost function with a depth decay factor. For predicting the tree... Transform into a baseline tree Any basic editing operation (Insert, delete, rename), the single-step penalty cost is defined as: ; In the above formula, This indicates the absolute depth of the current operation node in the abstract syntax tree. For depth decay hyperparameters; The basic learning rate constant; For node semantic type; This is a weight mapping function for node semantic types. For example, the cost of destroying a dictionary container node is much greater than destroying a simple list index node. Based on this dynamic penalty cost, the system uses dynamic programming to solve for the globally minimized topology offset loss matrix, obtaining the multidimensional topology heterogeneity loss value. : ; In the formula, This is a sequence of edit operations to transform the prediction tree into a baseline tree; The dynamic penalty cost function for single-step editing operations; To represent the first operation in this sequence The system performs several basic editing operations. To transform this unbounded loss value into a normalized confidence metric for threshold determination, the system further calculates the final abstract topological homomorphic fit through exponential smoothing and scale normalization. ; in, This is a topological complexity balancing operator. This metric highly quantifies the model's ability to reconstruct deeply nested logic and the overall topological skeleton. If If the output is below the preset health bias threshold, the system will accurately determine that there is a serious topological distortion in the current output.

[0031] The second parallel branch is the atomic content diagnostic module, responsible for calculating multi-dimensional atomic semantic fidelity (MASF). Traditional content computation often relies on absolutely consistent string matching, which is prone to over-penalization due to valid numeric type conversions (such as writing the integer 1 as the floating-point number 1.0) or minor path rearrangements. This module performs continuous similarity evaluation by constructing a fuzzy set within an abstract space. The system first reduces the dimensionality of the multi-dimensional tree structure into a set of semantic triples. ,in, These represent the absolute path vector, key name, and atom value of the node, respectively. Subsequently, the system introduces a continuous similarity function in a high-dimensional feature space. To measure the generation of triples With standard triplet The micro distance between them (predicting the tree) Dimensionality reduction to generate triples , base tree Dimensionality reduction to generate standard triples ): ; In the formula, The graph embedding vector space representation of the path is used to measure the structural affinity of hierarchical paths. To generate triples The graph embedding representation of the absolute path vector represents the absolute positional features of the model's predicted data in the abstract topological space. For standard triplet The graph embedding representation of the absolute path vector in the graph represents the absolute positional characteristics of the standard answer in the abstract topological space; This is a normalized content fit function based on edit distance or absolute numerical difference; and The control coefficient for the balance characteristics; To generate triples The atomic numbers in For standard triplet The system utilizes atomic values ​​within the matrix. Based on this microscopic similarity, it breaks away from the traditional discrete intersection-union ratio and constructs a soft intersection measure based on maximum bipartite graph matching. : ; in, This is a gating indicator function used to filter noise maps with extremely low correlation. This refers to the set of generated triples formed after the prediction tree is dimensionality reduced and expanded. The standard set of triples formed after the dimensionality reduction and expansion of the baseline tree; A similarity threshold is set. Finally, the system calculates the multidimensional atomic semantic fidelity using a joint metric based on generalized fuzzy sets. ; This indicator not only has extremely strong path sensitivity, but also allows for a certain degree of generalization of numerical representation, enabling it to accurately identify numerical illusion problems and deep mapping misalignment problems in large models.

[0032] The third stage: dynamic discrimination tree, precise prompt synthesis and autoregressive correction loop.

[0033] After high-dimensional analysis by the dual-track diagnostic engine, the system enters the logical judgment center. The system constructs a two-dimensional confidence decision boundary, that is, when... and When both checks are passed, the system determines that the output matches perfectly in both topology and content. It then extracts the diagnostic status from the data and sends it to downstream business systems. For the abstract topological homomorphic fit threshold, The threshold for multidimensional atomic semantic fidelity.

[0034] If the above boundary conditions are not simultaneously met, the system will be redirected to the dynamic prompt synthesizer, initiating a fine-grained adaptive correction loop. At this stage, the intermediate gradients and residuals generated in the aforementioned complex mathematical calculations are not only used for scoring but are also directly "translated" into correction instructions. When a topological error is detected, the synthesizer calls the structurally constrained prompt synthesis engine. The engine will parse... (Multidimensional Topological Heterogeneous Loss Value) The set of edit operation path matrices with the highest absolute cost recorded during the solution process. For example, if the matrix indicates that there is a high-cost redundant closure at a node with a depth of 4, the synthesizer will dynamically assemble strong constraint instructions, such as "The system has detected a path depth function crash. You have prematurely triggered a dictionary closure instruction in the third-level region derived from the root node, causing a topology break. Please strictly follow the original parent-child dependency rules for reconstruction."

[0035] When topological fit meets the standard, but multidimensional atomic semantic fidelity is not... Upon a fall, the synthesis of content-calibrated prompts is triggered. The system relies on soft intersections. Indicated function during operation Intercepted isolated triples generate precise content correction constraints. For dangling phantom nodes in the prediction set, a prompt is generated: "You have illegally fabricated an out-of-domain key-value pair in the path mapping tensor; please perform pruning." For uncovered key triples in the standard set, a forced filling instruction is generated. This natural language correction information, automatically synthesized from high-dimensional mathematical differences, serves as a strongly gradient-guided contextual input, feeding back into the large language model for a new round of autoregressive iteration. The model utilizes its built-in attention mechanism to focus on error-prompted regions, repairing the generation flow until it crosses the decision boundary.

[0036] Phase 4: Alignment of multimodal closed-loop feedback with underlying reinforcement learning based on dual-track punishment.

[0037] The system not only provides application-level adaptive fault tolerance during the inference phase, but also transforms the computational byproducts of dual-track diagnostics into nourishment for the evolution of the model base. In the closed-loop fine-tuning database on the right, the system collects high-quality human preference (AI preference) feedback tuples through asynchronous streams, consisting of "flawed initial generation, dual-track evaluation scalar, synthesized correction instructions, and repaired complete output".

[0038] In the periodic reinforcement learning alignment phase of the model, this invention innovatively proposes a hybrid reward model architecture based on dual-track geometric penalties. Unlike traditional reward models that rely solely on natural language fluency scores, this system uses the aforementioned calculated... and It is directly and deeply integrated into the objective function of policy optimization. The resulting comprehensive dense reward function... Designed as a composite structure incorporating nonlinear activation and divergence constraints: ; In the above strategy update formula, and An adaptive weight tensor used to control the balance between topological rigor and semantic richness; To calculate the current policy model Compared with the reference model The penalty term for the Kullback-Leibler divergence is used to prevent the model from catastrophically forgetting its language abilities when it overemphasizes high structure scores; The divergence penalty multiplier.

[0039] To further address the long-tailed sparsity error unique to nested structure generation, the system adds an additional structural entropy regularization constraint to the objective function. This forces the model to learn to reduce the local probability entropy during the generation of deep abstract syntax trees as the policy gradient ascends. ; in, The weight parameter matrix of the large language model base. This serves as the system's closed-loop fine-tuning database (i.e., the experience replay pool). To obtain from the database The training data pairs sampled from the middle, The control weight hyperparameter for the structural entropy regularization term is... Represents the mathematical expectation. Represents conditional probability. An abstract syntax tree corresponding to the structured data generated in the current round of the large language model.

[0040] By deepening abstract topological consistency and atomic information fidelity from external verification tools into reward scalars that directly drive the backpropagation of neural network parameters, the large language model foundation can implicitly learn bottom-up tree structure planning capabilities in the manifold optimization of the parameter space. After multiple rounds of closed-loop reinforcement learning iterations, the model's first-pass success rate for handling complex heterogeneous data without examples will be significantly improved, realizing the evolution of the large language model from post-event passive error correction to native autonomous error tolerance in industrial-grade fully automated data flow.

[0041] The following section uses "Automated Structure Extraction of Financial Information Event Impact Chain" as an example to further explain the solution proposed in this application.

[0042] In this example, the system is deployed in the core scheduling flow of an intelligent agent on a financial information service platform. The upstream business system inputs a long, unstructured financial news text (e.g., "Today, the central bank announced a 0.5 percentage point reduction in the reserve requirement ratio. Affected by this macro-easing policy, the real estate sector collectively strengthened, with Poly Developments and Vanke A hitting their daily limit..."), and issues a business instruction requiring the large language model to extract the events and their impact chains from the text into deeply nested JSON structure data for direct API calls by the downstream quantitative trading system. The target schema requires the inclusion of event names, an impact list, and the impact list must be an array of multiple dictionaries, each containing an affected sector, a trend, and a list of related companies.

[0043] Step 1: Initial inference of the large language model and dual-track parsing diagnosis.

[0044] After receiving the instruction, the large language model's inference side generates an initial, preliminary structured output via autoregression. Due to attention decay caused by deep nesting, the JSON string generated by the model exhibits a typical "topology and content composite error": {"event": "RRR cut", "impacts": {"sector": "real estate", "trend": "up", "companies": "Poly Development", "risk_level": "high"}} The dual-track diagnostic engine captures this output and immediately compares it with the target abstract syntax tree preset by the business system. A unified parsing mapping is performed. The system's computing engine begins executing dual-track quantization evaluation, setting the base learning rate constant. Depth decay hyperparameter Abstract topological homomorphic fit threshold Multidimensional atomic semantic fidelity threshold .

[0045] In the topology diagnostic branch, the engine discovered that the prediction tree incorrectly instantiated a "Dictionary Container Node (DICT)" under the root.impacts path, while the target tree should have a "List Container Node (LIST)" at that location. Furthermore, the underlying companies nodes were illegally reduced from a "list" to a "single numerical value." The dynamic programming algorithm calculated the multidimensional topological heterogeneity loss value. The value was too high. After normalization, the abstract topological homomorphic fit was obtained. .

[0046] In the atomic content diagnostic branch, due to the existence of an undefined phantom key-value pair "risk_level": "high" and misaligned companion paths, soft intersections were detected. Significantly reduced, the multidimensional atomic semantic fidelity was calculated. .

[0047] Step 2: Determine and synthesize structurally constrained prompt words (first round of dynamic correction).

[0048] The system enters the logic discrimination center. Due to the current... The system determines that a severe topology distortion has occurred. To prevent subsequent content calibration from being meaningless due to underlying structural errors, the system prioritizes triggering the topology correction loop.

[0049] The dynamic prompt synthesizer extracts the backtracking path of the most costly edit operation and automatically assembles structural constraint prompts to feed back to the large model: "Topology diagnosis failed: You incorrectly instantiated a dictionary object at the path root.impacts. The target specification requires that this node must be a list container to hold multiple impact sub-chains; at the same time, your companies node is missing the list closure control character. Please add square brackets [] to perform nested topology dimensionality upgrade and strictly follow the original parent-child dependency rules for reconstruction." Step 3: Secondary generation of the large language model and content calibration (second round of dynamic correction).

[0050] After receiving the aforementioned structural correction instruction with strong gradient guidance, the large language model, combined with the historical context, re-inferred and generated a second output: {"event": "RRR cut", "impacts": [{"sector": "real estate", "trend": "up", "companies": ["Poly Development"], "risk_level": "high"}]}.

[0051] The dual-track diagnostic engine performs high-dimensional analysis again. At this point, the topology perfectly matches, and the recalculation... Successfully crossed Threshold. However, in the atomic content diagnosis branch, when the system performs the difference comparison of semantic triples, it finds that there is still an isolated illusion triple (root.impacts[0].risk_level, risk_level, high) in the prediction set, which is not within the standard business constraints. The calculated result is... It has not yet been achieved. .

[0052] At this point, the system triggers the synthesis of content calibration prompts. The synthesizer generates a precise prompt: "The topology fit has met the standard, but the content mapping verification has failed: You have illegally fabricated an out-of-domain key-value pair "risk_level": "high" under the path root.impacts[0]. Please perform local pruning to remove redundant attributes and keep the current correct structure unchanged." Step 4: Final output distribution and reinforcement learning data storage.

[0053] The large language model completed its third inference based on content-calibrated prompts, successfully removing redundant fields. The system's third diagnostic concluded... and The two-dimensional confidence decision boundary was successfully breached. The system then extracted the diagnostic status of the data and sent it as the final, verified data to the downstream quantitative trading API.

[0054] Meanwhile, the system's closed-loop fine-tuning database automatically records the complete tuple queue of this interaction in the background: from the flawed initial generated text, to each diagnostic... and From continuous penalty scalars and two rounds of high-quality correction instructions automatically synthesized by the system, to the final perfectly structured data, the system imports this massive amount of real-world alignment data into the objective function of policy optimization within the model iteration cycle of the week. In the middle, a proximal policy optimization algorithm is used, utilizing a comprehensive dense reward function that incorporates dual-track geometric penalties. Gradient updates are performed on the underlying weight parameters of the model. After this reinforcement learning feedback, the model's ability to intrinsically plan tree structures is significantly enhanced when handling subsequent tasks such as extracting nested financial entities. The zero-sample first-pass pass rate jumps from the initial 45% to over 90%, achieving an effective transformation from adaptive repair to strengthening the underlying capabilities.

[0055] Example 2 This embodiment provides a structured adaptive error correction and optimization system for large language models, including: The large language model inference module is configured to: obtain the initial structured output generated by the large language model in response to business instructions; The dual-track diagnostic engine is configured to: parse the initial structured output and the preset target structured data into abstract syntax trees respectively, and perform quantitative diagnostics on the two dimensions of topological structure and atomic content based on the abstract syntax trees to obtain the topological structure deviation quantization value and the atomic content deviation quantization value. The dynamic prompt word synthesizer is configured to generate node-level natural language correction instructions based on the deviation quantization residual of the corresponding dimension when the quantitative diagnosis result of at least one dimension does not meet the preset conditions, and feed the correction instructions back to the large language model to drive its iterative repair. The closed-loop fine-tuning database is configured to collect interactive data containing preliminary structured output, topological deviation quantization value, atomic content deviation quantization value, correction instructions and repaired output, and use it as training samples for reinforcement learning. The reinforcement learning alignment module is configured to: construct a dense reward function based on reinforcement learning training samples that integrates the topological structure deviation quantization value and the atomic content deviation quantization value, optimize the policy of the large language model, and realize the autonomous evolution of the structured generation capability of the large language model.

[0056] It should be noted that the above modules correspond to the steps in Embodiment 1, and the examples and application scenarios implemented by the above modules and their corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should also be noted that the above modules can be executed in a computer system as part of the system.

[0057] In further embodiments, the following is also provided: An electronic device includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor, which, when executed by the processor, perform the method described in Embodiment 1. For brevity, further details are omitted here.

[0058] It should be understood that in this embodiment, the processor can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0059] A computer-readable storage medium for storing computer instructions that, when executed by a processor, perform the method of Embodiment 1.

[0060] The method in Example 1 can be directly executed by a hardware processor, or it can be executed by a combination of hardware and software modules within the processor. The software modules can reside in readily available storage media in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, a detailed description is not provided here.

[0061] A computer program product includes a computer program that, when executed by a processor, implements the method in Embodiment 1.

[0062] The present invention also provides at least one computer program product tangibly stored on a non-transitory computer-readable storage medium. The computer program product includes computer-executable instructions, such as instructions included in program modules, which execute in a device on a target real or virtual processor to perform the processes / methods described above. Typically, program modules include routines, programs, libraries, objects, classes, components, data structures, etc., that perform specific tasks or implement specific abstract data types. In various embodiments, the functionality of program modules can be combined or divided among program modules as needed. The machine-executable instructions for the program modules can execute within a local or distributed device. In a distributed device, the program modules can reside in both local and remote storage media.

[0063] The computer program code used to implement the methods of the present invention may be written in one or more programming languages. This computer program code may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the computer or other programmable data processing device, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a computer, partially on a computer, as a stand-alone software package, partially on a computer and partially on a remote computer, or entirely on a remote computer or server.

[0064] In the context of this invention, computer program code or related data may be carried by any suitable carrier to enable a device, apparatus, or processor to perform the various processes and operations described above. Examples of carriers include signals, computer-readable media, and the like. Examples of signals may include electrical, optical, radio, sound, or other forms of propagation signals, such as carrier waves, infrared signals, etc.

[0065] Those skilled in the art will recognize that the units and algorithm steps described in conjunction with the embodiments herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0066] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A structured adaptive correction and optimization method for large language models, characterized in that, Includes the following steps: Obtain the initial structured output generated by the large language model in response to business instructions; The preliminary structured output and the preset target structured data are parsed into abstract syntax trees respectively, and quantitative diagnosis is performed on the two dimensions of topological structure and atomic content based on the abstract syntax trees to obtain the topological structure deviation quantization value and the atomic content deviation quantization value. When the quantitative diagnostic result of at least one dimension does not meet the preset conditions, a node-level natural language correction instruction is generated based on the deviation quantitative residual of the corresponding dimension, and the correction instruction is fed back to the large language model to drive its iterative repair. Collect interactive data containing the initial structured output, the topology deviation quantization value, the atomic content deviation quantization value, the correction instruction, and the repaired output, and use it as reinforcement learning training samples; Based on the reinforcement learning training samples, a dense reward function is constructed that integrates the topological structure deviation quantization value and the atomic content deviation quantization value. The policy is then optimized for the large language model to achieve the autonomous evolution of the large language model's structured generation capability.

2. The structured adaptive correction and optimization method for large language models as described in claim 1, characterized in that, The preliminary structured output and the preset target structured data are parsed into abstract syntax trees, respectively. Based on these abstract syntax trees, quantitative diagnostics are performed on both the topological structure and atomic content dimensions to obtain the topological structure deviation quantization value and the atomic content deviation quantization value, specifically including: The initial structured output and the target structured data are respectively parsed into a standardized recursive abstract syntax tree structure, and each node is defined as a quintuple containing node type, key name, atomic value, set of child nodes and depth information; The abstract topological homomorphic fit is calculated as the topological deviation quantification value. The abstract topological homomorphic fit is quantified by introducing a dynamic editing cost function with depth decay factor and node type weight to quantify the topological difference between the prediction tree and the target tree. The multidimensional atomic semantic fidelity is calculated as the atomic content deviation quantification value. The multidimensional atomic semantic fidelity is obtained by reducing the dimensionality of the tree structure to a set of semantic triples and constructing a soft intersection measure based on graph embedding and continuous similarity function to quantify the mapping accuracy of the atomic content.

3. The structured adaptive correction and optimization method for large language models as described in claim 2, characterized in that, The calculation of the abstract topological homomorphic fit specifically includes: Define a sequence of edit operations to transform the prediction tree into the target tree. The single-step penalty cost of each edit operation is the product of the depth decay factor and the node type weight. The depth decay factor is negatively correlated with the depth of the node in the abstract syntax tree, and the node type weight is pre-set according to the node semantic type. The global topological heterogeneity loss value is obtained by minimizing the topology offset loss matrix through dynamic programming. The global topological heterogeneity loss value is exponentially smoothed and scale-normalized to obtain the abstract topological homomorphic fit.

4. The structured adaptive correction and optimization method for large language models as described in claim 2, characterized in that, The calculation of multidimensional atomic semantic fidelity specifically includes: The prediction tree and the target tree are reduced to a set of semantic triples, each triple containing an absolute path vector, a key name, and an atomic value. Construct a graph embedding representation of path vectors and define a similarity function between triples, wherein the similarity function is a weighted sum of path embedding cosine similarity and atomic value normalized similarity; The maximum bipartite graph matching is constructed based on the triplet similarity function to obtain the soft intersection measure, which is the sum of matching weights between the predicted triplet and the target triplet that are higher than the similarity threshold. Multidimensional atomic semantic fidelity is calculated based on the cardinality of the soft intersection measure and the triple set using a joint metric of generalized fuzzy sets.

5. The structured adaptive correction and optimization method for large language models as described in claim 1, characterized in that, Based on the deviation quantization residuals of the corresponding dimensions, node-level natural language correction instructions are generated, specifically including: When the topology deviation quantification value is lower than the first preset threshold, a structural constraint correction instruction for topology distortion is synthesized based on the editing operation path with the highest absolute cost recorded during the topology diagnosis process. When the topology deviation quantization value meets the first preset threshold but the atomic content deviation quantization value is lower than the second preset threshold, a content calibration correction instruction for atomic content mapping misalignment is synthesized based on the isolated semantic triples filtered during the atomic content diagnosis process.

6. The structured adaptive correction and optimization method for large language models as described in claim 1, characterized in that, The dense reward function is the sum of a nonlinear combination of the topological structure deviation quantization value and the atomic content deviation quantization value, plus a KL divergence penalty term. Its expression is: ; Wherein, ATHC represents the abstract topological homomorphic fit, and MASF represents the multidimensional atomic semantic fidelity. and To balance topological rigor with semantic richness through adaptive weighting, Here is the divergence penalty coefficient. For the current strategy model, This is a reference model.

7. A structured adaptive error correction and optimization system for large language models, characterized in that, include: The large language model inference module is configured to: obtain the initial structured output generated by the large language model in response to business instructions; The dual-track diagnostic engine is configured to: parse the preliminary structured output and the preset target structured data into abstract syntax trees respectively, and perform quantitative diagnosis on the two dimensions of topological structure and atomic content based on the abstract syntax trees to obtain the topological structure deviation quantization value and the atomic content deviation quantization value. The dynamic prompt word synthesizer is configured to: when the quantitative diagnostic result of at least one dimension does not meet the preset conditions, generate node-level natural language correction instructions based on the deviation quantitative residual of the corresponding dimension, and feed the correction instructions back to the large language model to drive its iterative repair. The closed-loop fine-tuning database is configured to: collect interactive data containing the initial structured output, the topology deviation quantization value, the atomic content deviation quantization value, the correction instruction and the repaired output, and use it as reinforcement learning training samples; The reinforcement learning alignment module is configured to: construct a dense reward function based on the reinforcement learning training samples, which integrates the topological structure deviation quantization value and the atomic content deviation quantization value, and optimize the policy of the large language model to achieve the autonomous evolution of the structured generation capability of the large language model.

8. An electronic device, characterized in that, It includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor, which, when executed by the processor, perform the method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, Used to store computer instructions, which, when executed by a processor, perform the method described in any one of claims 1-6.

10. A computer program product, characterized in that, Includes a computer program, which, when executed by a processor, implements the method described in any one of claims 1-6.