A data processing method for optimizing explainability of an agent, an intelligent agent and a storage medium
By acquiring structured registration data from the intelligent agent system and encapsulating it into traceable data, dynamically constructing expression trees, and forcing variables to be accessed through structured interfaces, the problem of broken computation chains in the intelligent agent system is solved. This achieves full-link traceability from initial data to results, improves the transparency and credibility of the computation process, and meets the compliance verification requirements of high-credibility scenarios.
Patent Information
- Application Number
- CN202511176311.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-08-21
AI Technical Summary
Existing intelligent agent systems, when handling structured, multi-step computational tasks, suffer from untraceable computational processes due to broken multi-step computational chains. The lack of chain-like association mechanisms between independent code fragments makes it impossible to construct a fully verifiable path from initial data to results. The system only retains the final result while missing the context, operators, and data dependencies of intermediate steps, making it difficult to trace back the computational results. This makes it impossible to meet the needs of high-reliability scenarios such as financial due diligence, automated auditing, scientific modeling, engineering analysis, and compliance verification.
By obtaining structured registration data from the registration database, encapsulating it into traceable data types, automatically recording calculation operation information using overloaded operators, dynamically constructing an expression tree, and forcing variables in the calculation code to access the registration database through a structured interface, we ensure that the data source is unique and verifiable. Combined with the expression tree to record complete dependency relationships, we construct a fully verifiable path and visualize the output expression chain.
It achieves complete computation chain retention from initial data to results, meeting the end-to-end traceability requirements of high-reliability scenarios, improving the transparency and credibility of the computation process, and enabling precise traceability of the source of each step of the computation results in scenarios such as financial due diligence, automated auditing, scientific modeling and compliance verification, thus meeting compliance verification requirements.
Smart Images

Figure CN120671715B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a data processing method, intelligent agent, and storage medium for optimizing agent interpretability. Background Technology
[0002] In recent years, the technology of building agents based on LLM (Large Language Model) has developed rapidly, and agents have demonstrated significant capabilities in automated data processing. However, when dealing with structured, multi-step computational tasks, existing agent systems suffer from several drawbacks. The broken computation chains make the computation process untraceable, and the lack of chain-like association mechanisms between independent code fragments prevents the construction of a fully verifiable path from initial data to the result. The system only retains the final result, failing to record the context, operators, and data dependencies of intermediate steps, making it difficult to trace back the computation results. This is a fatal flaw for high-reliability scenarios such as financial due diligence, automated auditing, scientific modeling, engineering analysis, and compliance verification. Summary of the Invention
[0003] To address the aforementioned issues, this invention provides a data processing method, an intelligent agent, and a storage medium for optimizing agent interpretability.
[0004] To solve the above-mentioned technical problems, this invention provides the following technical solution: a data processing method for optimizing agent interpretability, comprising the following steps: acquiring a registration database, wherein the registration database stores structured registration data in key-value pair format; acquiring task information and identifying the task intent of the task information; if the task intent conditions are met, extracting the structured registration data required for the task information from the registration database; encapsulating the structured registration data into traceable type data, wherein the traceable type data automatically records computational operation information through overloaded operators; constructing a code generation request, wherein a large language model generates computational code based on the code generation request; wherein the variables in the computational code are all processed through structured interfaces. The process involves: accessing the structured registration data; executing the calculation code and dynamically constructing an expression tree during the calculation; generating calculation results and result expression chains based on the expression tree, and visually outputting the result expression chain; wherein the traceable type data includes the value of the structured registration data, calculation process information recording the operation history, and pointers to expression tree nodes associated with the calculation steps; the calculation results and their corresponding expression trees are recorded in the registration database as structured registration data in key-value pair format; the traceable type data automatically records calculation operation information through overloaded operators, including creating new expression tree nodes to represent this calculation, and linking the expression tree of the structured registration data as child nodes to the new expression tree nodes.
[0005] Preferably, the traceable type data includes Trackedvalue type data, and the calculation operation information includes the data name, data value, and operator of the calculation operation.
[0006] Preferably, the traceable type data automatically records computation operation information through overloaded operators, including: obtaining the structured registration data participating in the computation and its associated data name, data value, and expression tree; performing the computation and recording the operators used; creating a new expression tree node to represent this computation, and linking the expression tree of the structured registration data as a child node to the new expression tree node; returning a new Trackedvalue type data to encapsulate the computation result, and associating the new expression tree node with the new Trackedvalue type data.
[0007] Preferably, the code generation request includes the following constraints: providing a list of access paths to the structured registration data to the large language model, and not displaying the numerical values of the structured registration data; prohibiting the definition of free variables or references to raw values that are not bound to the registration database; and forcing all variables in the calculation code to be obtained by accessing the structured registration data through the structured interface.
[0008] Preferably, the step of acquiring task information and identifying the task intent of the task information, and extracting the structured registration data required for the task information from the registration database if it meets the preset task intent conditions, includes the following steps: acquiring task information, identifying the task intent of the task information based on a large language model; when the task intent of the task information includes a computational requirement, the registration database does not include the computational result of the computational requirement, and the registration database includes all the structured registration data required to complete the computation, extracting the structured registration data required for the task information from the registration database.
[0009] Preferably, when the task intent of the task information does not include computational requirements, the system responds to the user in a dialogue mode; when the registration database includes the computational results of the computational requirements, the system recalls and outputs the corresponding structured registration data.
[0010] Preferably, the step of extracting the structured registration data required for the task information from the registration database includes the following steps: based on the task information, selecting a first candidate data set from the structured registration data using a keyword matching algorithm, and selecting the structured registration data required for the task information from the first candidate data set based on semantic parsing using a large language model; wherein, the structured registration data includes data name, data value, and expression tree corresponding to the data value.
[0011] To solve the above-mentioned technical problems, the present invention provides another technical solution as follows: an intelligent agent, comprising the following modules: an input module for acquiring a registration database, the registration database storing structured registration data in key-value pair format, and for acquiring task information; a structured registration data retrieval module for identifying the task intent of the task information, and if it meets preset task intent conditions, extracting the structured registration data required for the task information from the registration database; and an encapsulation module for encapsulating the structured registration data into traceable type data, the traceable type data automatically recording calculation operation information through overloaded operators; the traceable type data includes the value of the structured registration data, calculation process information recording the operation history, and expression tree node pointers associated with the calculation steps; The traceable type data automatically records computational operation information through overloaded operators, including creating new expression tree nodes to represent the current computation and linking the expression tree of the structured registration data as child nodes to the new expression tree node; a computational code generation module is used to construct a code generation request, and the large language model generates computational code based on the code generation request; wherein, the variables in the computational code are all obtained by accessing the structured registration data through a structured interface; a computation module is used to execute the computational code and dynamically construct the expression tree during the computation process; an output module is used to generate computational results and result expression chains based on the expression tree, and visually output the result expression chain; the computational results and their corresponding expression trees are recorded in the registration database as structured registration data in key-value pair form.
[0012] To solve the above-mentioned technical problems, the present invention provides another technical solution as follows: a computer-readable storage medium, wherein when a computer program is executed, it implements the data processing method for optimizing agent interpretability as described in any one of the above-mentioned methods.
[0013] Compared with existing technologies, the data processing method, intelligent agent, and storage medium for optimizing agent interpretability provided by this invention have the following beneficial effects:
[0014] 1. This invention provides a data processing method to optimize agent interpretability. By acquiring a registration database containing structured registration data in key-value pair format, it ensures that the source of all original data is traceable, providing a foundation for end-to-end traceability. By encapsulating the structured registration data into traceable data types, which automatically record computational operation information through overloaded operators, an expression tree can be dynamically constructed during the computation process. This solves the problem of broken computational chains, ensuring that the context (such as data name, data value, etc.), operators, and data dependencies of each computational step are recorded in real time, forming a continuous computational chain. Discrete computational steps are transformed into structured expression trees, achieving complete computational chain retention from original data to result, meeting the traceability requirements of audit scenarios for intermediate processes. By forcing variables in the computational code to access the registration database only through structured interfaces, it ensures that the data source of all variables in the computational code is unique and traceable. Combined with the complete dependency relationships recorded in the expression tree, a fully verifiable path from initial data to final result is constructed, achieving end-to-end traceability. By visually outputting the result expression chain, the logical relationships of intermediate steps and the data computation process are intuitively presented, facilitating user verification of the correctness of the computational logic. It effectively solves the problem that existing intelligent agent data processing methods only retain the final result and lack intermediate information, and the result cannot be traced back. In high-reliability scenarios such as financial due diligence, automatic auditing, scientific modeling, engineering analysis and compliance verification, the source of each calculation result can be traced, and compliance verification requirements are met.
[0015] 2. The traceable type data provided in this embodiment of the invention includes Trackedvalue type data, and the calculation operation information includes the data name, data value, and operator of the calculation operation. Since the traceable type data includes Trackedvalue type data, which is the basic data structure used in this invention to carry specific calculation data and record operation information, the structured registration data is encapsulated into traceable type data. After encapsulation, the structured registration data is no longer in its original form, but is packaged into a new type, namely the Trackedvalue class. Trackedvalue, as a specific custom data type, contains two core attributes: basic data attributes and operation tracking attributes. It stores the value of the structured registration data and additional information about how the structured registration data participates in the calculation, including calculation process information that records the operation history and expression tree node pointers associated with the calculation steps, etc., and can automatically record its own change process and dependencies. When using TrackedValue type data for calculations, by overloading operators, the system automatically records detailed information such as the data name, data value, and operators involved in the calculation operation. During the calculation process, an expression tree is dynamically generated to reflect data flow and dependencies, ensuring that the expression tree contains key information such as data name, data value, and operators. This solves the problem of missing context in intermediate steps in existing technologies. Furthermore, it provides a standardized data foundation for subsequent parsing and visualization of the expression tree, enabling users to accurately trace the specific operational details of each calculation step and improve the accuracy of verification in high-confidence scenarios.
[0016] 3. In this embodiment of the invention, the structured registration data involved in the calculation and its associated data names, data values, and expression trees are obtained; the calculation is performed and the operators used are recorded; a new expression tree node is created to represent this calculation, and the expression tree of the structured registration data is linked to the new expression tree node as a child node; a new Trackedvalue type data is returned to encapsulate the calculation result, and the new expression tree node is associated with the new Trackedvalue type data. This ensures that the expression tree of each calculation step is associated with the expression tree of the structured registration data involved in the calculation, forming a hierarchical relationship between the nodes, so that the structure of the expression tree has clear continuity and hierarchy, solving the problem of missing data dependencies in intermediate steps; each new Trackedvalue type data is associated with a corresponding expression tree node, ensuring the binding of the calculation result with the calculation process, providing technical support for end-to-end verification.
[0017] 4. In this embodiment of the invention, constraints are imposed on code generation requests. These constraints include: providing a list of structured registration data access paths to the large language model, and not displaying the numerical values of the structured registration data; prohibiting the definition of free variables not bound to the registration database or referencing raw values; and forcing variables in the computation code to be obtained by accessing the structured registration data through the structured interface. This avoids generating free variables or raw values not bound to the registration database from the source of code generation, ensuring that all data in the computation comes from the registration database and eliminating the risk of data chain breakage due to unknown data sources. By forcing variables to be obtained by accessing the structured registration data through the structured interface and not displaying the numerical values of the structured registration data, the use of raw values is avoided when the large language model generates code. Values can only be obtained from the structured registration data, making the data reading path of variables traceable, ensuring the verifiability of the structured registration data during the computation process, and meeting the requirement of verifiable data sources in high-reliability scenarios.
[0018] 5. In this embodiment of the invention, the calculation results and their corresponding expression trees are used as structured registration data and entered into the registration database in the form of key-value pairs, realizing a closed loop between the calculation results and the new structured registration data: enabling subsequent calculations to directly use existing calculation results containing complete expression trees, solving the problem of lack of association between independent code fragments; all data stored in the registration database, including initial data, intermediate results and final results in the calculation process, carry expression trees, constructing a continuously traceable calculation chain, meeting the full-link auditing requirements of multi-step complex calculation scenarios.
[0019] 6. In this embodiment of the invention, task information is obtained, and the task intent of the task information is identified based on a large language model. When the task intent of the task information includes a computational requirement, the registration database does not include the computational result of the computational requirement, and the registration database includes all the structured registration data required to complete the computation, the structured registration data required for the task information is extracted from the registration database. Thus, the triggering conditions for task intent identification and data extraction of the task information are clarified as follows: there is a computational requirement, there is no readily available computational result, and the registration database has complete required structured registration data, avoiding invalid computation and improving efficiency. It ensures that all necessary structured registration data has been obtained before computation, providing complete initial child nodes for the subsequent complete expression tree construction, ensuring the integrity of the computation chain from the source, and avoiding the breakage of the intermediate computation step chain due to the lack of initial data.
[0020] 7. In this embodiment of the invention, when the task intent of the task information does not include computational requirements, the system responds to the user in a dialogue mode; when the registration database includes computational results for computational requirements, the corresponding structured registration data is retrieved and output. By responding with a dialogue when there are no computational requirements and retrieving and outputting the corresponding structured registration data from the registration database when there are results, the system's flexibility is improved, adapting to diverse task scenarios. When retrieving existing corresponding structured registration data, because the structured registration data is associated with an expression tree, even direct output ensures that the structured registration data can be traced back to the initial data, ensuring that the requirement for data result verifiability is still met in non-computational scenarios, covering the entire process requirements of high-reliability scenarios.
[0021] 8. In this embodiment of the invention, a two-step filtering method using keyword matching algorithm and large language model semantic parsing is employed to extract structured registration data. First, a preliminary filtering is performed using the keyword matching algorithm, followed by further precise filtering based on large language model semantic parsing. Even if there are some differences between the data names in the task information and the corresponding key names in the structured registration data, accurate selection can still be achieved without interference. Since the structured registration data contains data names, data values, and expression trees, it provides a complete information dimension for the two-step filtering method. Preliminary filtering can be achieved based on data names, while the expression tree facilitates further precise filtering through large language model semantic parsing. This ensures that the extracted structured registration data and task requirements are doubly matched in terms of name identification and source logic, guaranteeing the accuracy of the match between the extracted structured registration data and task requirements, and avoiding invalid computational links due to incorrect matching between structured registration data and task requirements. Furthermore, the extracted structured registration data carries an expression tree, allowing the expression tree in subsequent calculations to directly relate to the historical links of the structured registration data, ensuring accuracy in multi-step calculations and further strengthening the coherence and verifiability of the entire link.
[0022] 9. The present invention also provides an intelligent agent and a computer-readable storage medium, which have the same beneficial effects as the above-described data processing method for optimizing agent interpretability, and will not be described in detail here. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart of the steps of a data processing method for optimizing agent interpretability provided in the first embodiment of the present invention.
[0025] Figure 2 This is a schematic diagram of the expression tree structure provided in the first embodiment of the present invention.
[0026] Figure 3 This is a flowchart of step S3 of a data processing method for optimizing agent interpretability provided in the first embodiment of the present invention.
[0027] Figure 4 This is a flowchart of step S2 of a data processing method for optimizing agent interpretability provided in the first embodiment of the present invention.
[0028] Figure 5 This is a flowchart of step S22 of a data processing method for optimizing agent interpretability provided in the first embodiment of the present invention.
[0029] Figure 6 This is a structural block diagram of the intelligent agent provided in the second embodiment of the present invention.
[0030] Explanation of reference numerals in the attached diagram:
[0031] 1. Input module; 2. Structured registration data retrieval module; 3. Encapsulation module; 4. Calculation code generation module; 5. Calculation module; 6. Output module; 100. Intelligent agent. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0033] Please see Figure 1 The first embodiment of the present invention provides a data processing method for optimizing agent interpretability, comprising the following steps:
[0034] Step S1: Obtain the registration database, which stores structured registration data in key-value pair format;
[0035] It should be noted that the structured registration data stored in the registration database possesses credibility, integrity, and authenticity during storage, management, and use. The data will not be tampered with, is authentic, valid, and trustworthy. Optionally, the structured registration data can be a trusted data source provided by the user to the registration database, or it can be a trusted data source stored in the registration database during pre-construction. A key-value pair is a fundamental data storage structure in computer science, consisting of two related elements: a key and a value, such as {"Net Profit_202401":xxx, "Net Profit_202402":xxx}. The "key" is equivalent to an "identifier" or "index," possessing uniqueness within the registration database and used for quickly locating and accessing the corresponding "value." The value is the specific data associated with the key, and can be of any type (such as numbers, strings, lists, objects, etc.).
[0036] Step S2: Obtain task information and identify the task intent of the task information. If it meets the preset task intent conditions, extract the structured registration data required for the task information from the registration database.
[0037] It should be noted that, optionally, task intent recognition can be based on a Large Language Model (LLM); it can also be based on a dictionary and knowledge base, identifying task intent through semantic matching; or it can be based on template matching, predefining task intent templates and identifying task intent based on the matching degree between the task intent template and task information (such as string similarity, placeholder matching). No limitation is made here. Predefined task intent conditions refer to a predefined set of rules used to determine whether a user's task intent falls within the system's processing scope. Their core function is to act as a "filter," ensuring that the system only triggers the extraction of structured data from the registration database when the identified task intent meets these conditions. Optionally, when using a Large Language Model for task intent recognition, the predefined task intent conditions can be that the computational intent includes the computational requirement, the registration database does not include the computational result of the computational requirement, and the registration database includes all the structured registration data required to complete the computational requirement. Only when all of the above conditions are met will the system extract the structured registration data required for the task information from the registration database.
[0038] Step S3: Encapsulate the structured registration data into traceable type data. The traceable type data automatically records calculation operation information through overloaded operators.
[0039] It's important to note that encapsulating structured registration data into traceable type data means placing the structured registration data into a specific custom type (class or struct), which is called a "traceable type." Traceable type data is a custom data type encapsulated through object-oriented programming. It not only contains the values of the structured registration data but also includes built-in additional information needed to trace the computation process, such as computation process information recording the operation history and pointers to expression tree nodes associated with the computation steps. Through this additional information, the system can understand which raw data and operations generated the data, enabling data traceability; it also facilitates visualization of the computation process to aid debugging and analysis.
[0040] It should be noted that operator overloading refers to redefining the behavior of operators (such as +, -, *, >, ==, etc.) for custom types based on the characteristics of programming languages (such as C++, Python, etc.). This ensures that when performing calculations (such as addition, subtraction, and comparison) on traceable data, in addition to completing the regular calculation, the "operation log" logic is automatically triggered. Optionally, the overloaded operators can be unary or binary operators.
[0041] For ease of understanding, here is an example: When two traceable data types, "a" and "b", are operated on by an overloaded operator "+", that is, when the calculation operation "c=a+b" is performed, the program does not call the built-in numerical addition, but instead calls the function overloaded for the overloaded operator corresponding to the traceable type.
[0042] Inside this overloaded function, perform the following operations:
[0043] 1. Perform the actual calculation: Calculate a.value + b.value to obtain the result value c_value.
[0044] 2. Record operation information: Create a new "Addition Operation" node. This node:
[0045] (1) The type of storage operation (addition in this example);
[0046] (2) Store the result value of the operation (c_value); where pointers to its operands "a" and "b" are stored. These operands are themselves traceable data types, and they also have their own internal nodes.
[0047] (3) Create a new traceable data type: Construct a new traceable data type object "c", store the calculation result c_value into c.value, and associate "c" with the newly created addition operation node. This new node represents the addition operation through its node attributes, and explicitly stores the nodes that point to its child nodes, which are the nodes corresponding to "a" and "b".
[0048] Through the above operations, the system can automatically record the operation information that "c" is obtained by adding "a" and "b" in the background for ordinary numerical calculation statements such as c = a + b. "c" itself also becomes a traceable data that can participate in subsequent calculations.
[0049] Step S4: Construct a code generation request. The large language model generates computational code based on the code generation request. The variables in the computational code are all obtained by accessing the structured registration data through the structured interface.
[0050] It should be noted that in existing technologies, variables in the computational code generated by large language models can be arbitrarily defined by the large language model, even using "raw values" directly, lacking effective constraints on data access paths and sources. This free variable mechanism leads to poor data traceability, easily introducing fictitious, erroneous, or unverifiable values, thus affecting the credibility of the entire computation process. Based on the code generation request constructed from the task information, serving as a prompt for the large language model, the model generates computational code. By setting variables in the computational code to access structured registration data through a structured interface, the model unifies the external data call paths of all computational code and forces access to structured registration data through the structured interface. These restrictions on data access behavior effectively ensure that the data usage process is transparent, controlled, and traceable.
[0051] Step S5: Execute the calculation code and dynamically construct the expression tree during the calculation process;
[0052] It should be noted that during the execution of the computation code, as the computation expression containing traceable data is executed step by step, the system automatically constructs an expression tree in memory to represent the entire computation process. This expression tree, based on the computation code, can be a binary tree or an n-ary tree structure.
[0053] The expression tree includes the following structure:
[0054] Leaf nodes: Represent operands, i.e., the initial structured registration data or constants input.
[0055] Internal nodes: Represent operations performed on operands (such as +, -, *, / ). Each internal node stores the type of the operation, the result of the operation, and a pointer / reference to its child nodes (operands). Child nodes can be leaf nodes or other internal nodes.
[0056] For ease of understanding, the dynamic construction process of the expression tree is illustrated below, taking the calculation of the current ratio = current assets / current liabilities as an example:
[0057] During initialization, the structured registration data is accessed through the structured interface to obtain traceable type data {"Total Current Assets_202412":14431816.66} and {"Total Current Liabilities_202412":6774966.27}. (For simplicity, x refers to {"Total Current Assets_202412":14431816.66}, y refers to {"Total Current Liabilities_202412":6774966.27}, and z refers to the current ratio to be calculated.) The corresponding leaf nodes are then created.
[0058] When performing the calculation operation "z=x / y":
[0059] The overloaded multiplication function is called to calculate x.value / y.value to obtain z.value.
[0060] Create a new " / " operation node that takes the "x" node and the "y" node as its children.
[0061] Create a new traceable data type "z", set its value to z.value, and set its associated node to this new " / " operation node.
[0062] Final result: After the calculation of "z=x / y" is completed, the following structure is formed in memory: Figure 2 The expression tree shown illustrates how "z" is derived from the original inputs "x" and "y" through computation, facilitating a transparent, traceable, and structurally represented computation process.
[0063] Step S6: Generate the calculation result and the result expression chain based on the expression tree, and visualize the output of the result expression chain.
[0064] It should be noted that the result expression chain can record the complete data transformation process based on the ordered sequence of operations from the root node to the target result node of the expression tree, thus achieving a formal representation. Taking the example in step S5, the final visualized output result expression chain is as follows:
[0065] Current ratio
[0066] = Total Current Assets_202412 / Total Current Liabilities_202412
[0067] = 14431816.66 / 6774966.27
[0068] = 2.130168045840323
[0069] ≈ 2.13
[0070] Optionally, for the visualized output expression chain, the `.visualize()` method can be called to show how the calculation result is derived step by step from which data and through which calculations, significantly improving transparency and credibility. `.visualize()` is a function or method used to transform an expression tree into an intuitive graphical result. Its core function is to present the abstract calculation chain in a visual way, making it easier for users (such as auditors and analysts) to understand and trace the calculation process. In addition, the visualized output expression chain can also be visualized using flowcharts, tree diagrams, mind maps, linked tables, interactive graphics, and other methods.
[0071] Understandably, by accessing the registration database, which stores structured registration data in key-value pair format, the source of all original data is traceable, providing a foundation for end-to-end traceability. By encapsulating the structured registration data into traceable data types, which automatically record computational operation information through overloaded operators and dynamically construct expression trees during computation, the problem of broken computational chains is solved. This ensures that the context of each computational step (such as data name, data value, etc.), operators, and data dependencies are recorded in real time, forming a continuous computational chain. Discrete computational steps are transformed into structured expression trees, achieving complete computational chain retention from original data to result, meeting the traceability requirements of intermediate processes in audit scenarios. By forcing variables in the computational code to access the registration database only through structured interfaces, the source of all variable data in the computational code is ensured to be unique and traceable. Combined with the complete dependency relationships recorded in the expression tree, a fully verifiable path from initial data to final result is constructed, achieving end-to-end traceability. By visually outputting the expression chain of the result, the logical relationships of intermediate steps and the data computation process are intuitively presented, significantly improving transparency and credibility, and facilitating users to intuitively verify the correctness of the computational logic. It effectively solves the problem that existing intelligent agent data processing methods only retain the final result and lack intermediate information, and the result cannot be traced back. In high-credibility scenarios such as financial due diligence, automatic auditing, scientific modeling, engineering analysis and compliance verification, it can trace the source of each step of the calculation result, ensure high credibility, improve interpretability and meet compliance verification requirements.
[0072] It is important to note that in scenarios such as financial due diligence, automated auditing, scientific modeling, engineering analysis, and compliance verification, where the auditability and verifiability of computational results are extremely high, intelligent agents must ensure that the entire computational chain—from raw data to the computation process and then to the result—is traceable during data processing. This ensures high credibility and improves interpretability. However, existing technologies have significant shortcomings: data usage is uncontrolled, variable definitions are arbitrary, and there is a lack of effective constraints on data access paths and sources, easily introducing unreliable values; the computation process is untraceable, retaining only the final result while lacking systematic records of intermediate steps, operational sequences, and dependencies; multi-step computations lack chain-structure support, and the transfer of results and data dependencies between steps are not systematically managed, making it impossible to establish continuous computational paths; results are difficult to verify manually, requiring manual tracing of variable sources and reconstruction of computational logic, which is inefficient and error-prone, failing to meet the auditability and verifiability requirements of trusted computing.
[0073] This invention unifies the calling paths of all computational code to external data, forcing access to the structured registered data through a structured interface. The system can restrict data access behavior, ensuring that data usage is transparent, controlled, and traceable. By encapsulating raw numerical types into traceable data types with computational tracking capabilities and overloading their operators, every computational operation during program execution can be automatically captured and recorded, dynamically constructing an expression tree or computation graph to fully reflect the computational logic chain. This mechanism provides structured support for subsequent result verification, process auditing, and interpretability analysis. This invention forms a computational path tracing and result traceability mechanism, automatically capturing and recording the input and output of each computational operation and the expression tree during agent execution, dynamically constructing a structured "computational chain." This mechanism can generate a complete execution trajectory after task completion, supporting traceability analysis, logical verification, and interpretable output of the final result, significantly improving the system's transparency and credibility. The agent system, combining structured data constraints, computational path tracing, and result verifiable mechanisms, constructs a complete credibility enhancement framework. This mechanism can effectively limit the free behavior of large languages in automatically generating computational code, significantly improving their transparency, controllability, and auditability, and laying a solid foundation for building highly reliable autonomous intelligent agent systems.
[0074] Furthermore, traceable type data includes Trackedvalue type data, and computation operation information includes the data name, data value, and operator of the computation operation.
[0075] Understandably, since traceable type data includes Trackedvalue type data, which is the basic data structure used in this invention to carry specific computational data and record operation information, the structured registration data is encapsulated into traceable type data. After encapsulation, the structured registration data is no longer in its original form, but is packaged into a new type, namely the Trackedvalue class. As a specific custom data type, Trackedvalue contains two core attributes: basic data attributes and operation tracking attributes. It stores the value of the structured registration data and additional information about how the structured registration data participates in the computation, including computational process information that records the operation history and expression tree node pointers associated with the computation steps, etc. It can automatically record its own change process and dependencies. When using TrackedValue type data for calculations, by overloading operators, the system automatically records detailed information such as the data name, data value, and operators involved in the calculation operation. During the calculation process, an expression tree is dynamically generated to reflect data flow and dependencies, ensuring that the expression tree contains key information such as data name, data value, and operators. This solves the problem of missing context in intermediate steps in existing technologies. Furthermore, it provides a standardized data foundation for subsequent parsing and visualization of the expression tree, enabling users to accurately trace the specific operational details of each calculation step and improve the accuracy of verification in high-confidence scenarios.
[0076] Please see Figure 3 Furthermore, in step S3, the traceable type data automatically records calculation operation information through overloaded operators, including:
[0077] Step S31: Obtain the structured registration data involved in the calculation and its associated data names, data values, and expression trees;
[0078] Step S32: Perform the calculation and record the operators used;
[0079] Step S33: Create a new expression tree node to represent this calculation, and link the expression tree of the structured registration data as a child node to the new expression tree node;
[0080] Step S34: Return a new Trackedvalue type data to encapsulate the calculation result, and associate the new expression tree node with the new Trackedvalue type data.
[0081] It should be noted that, for ease of understanding, an optional implementation of steps S31 to S34 based on the example in step S3 is as follows:
[0082] The system retrieves the structured registration data involved in the computation, along with its associated data names, values, and expression trees. The two operands involved in the computation are Trackedvalue type data objects "a" and "b". Object "a" currently has a value of 3.0 and is associated with the leaf node Na (identified as "a") in its expression tree; object "b" currently has a value of 2.0 and is associated with the leaf node Nb (identified as "b") in its expression tree. When the addition operation "c = a + b" is executed, the system performs the following operations:
[0083] Get the current data values (3.0 and 2.0) of operands "a" and "b" and their associated expression tree nodes (Na and Nb).
[0084] Perform the addition operation to get the result value 5.0, and record the operator as the addition operator ("+");
[0085] Create a new expression tree node Nc, which is a binary operation node with the operator "+", and make one of nodes Na and Nb the left child of Nc and the other the right child of Nc.
[0086] Create a new Trackedvalue type data "c", store the calculated value 5.0 as the base data value of "c", and associate node Nc with the new Trackedvalue type data "c".
[0087] Through the steps described above, the Trackedvalue type data "c" not only carries the calculated value 5.0, but also records the complete calculation history of how this result was obtained by adding "a" and "b" through the associated expression tree node Nc. This calculation process is completed automatically without user intervention, achieving transparent tracking of the calculation process.
[0088] Understandably, the above settings ensure that the expression tree of each calculation step is associated with the expression tree of the structured registration data participating in the calculation, forming a hierarchical relationship between the nodes. This gives the expression tree structure clear continuity and hierarchy, solving the problem of missing data dependencies in intermediate steps. Each new Trackedvalue type data is associated with a corresponding expression tree node, ensuring the binding of the calculation result with the calculation process, and providing technical support for end-to-end verification.
[0089] Furthermore, the code generation request includes the following constraints:
[0090] Provide a list of access paths to structured registration data to the large language model, but do not display the numerical values of the structured registration data; prohibit the definition of free variables not bound to the registration database or the reference of raw values; and force all variables in the calculation code to be obtained by accessing the structured registration data through the structured interface.
[0091] Understandably, the constraints include: providing a list of structured registry data access paths to the large language model; prohibiting the definition of free variables not bound to the registry database or referencing raw values; and mandating that all variables in the computation code access the structured registry data through a structured interface. This avoids generating free variables or raw values not bound to the registry database from the source of code generation, ensuring that all data in the computation comes from the registry database and eliminating the risk of data chain breaks due to unclear data sources. By mandating that variables access the structured registry data through a structured interface and not displaying the numerical values of the structured registry data, the large language model avoids using raw values when generating code, only allowing values to be retrieved from the structured registry data. This makes the data reading path of variables traceable, ensures the verifiability of the structured registry data during the computation process, and meets the requirement of verifiable data sources in high-reliability scenarios.
[0092] Furthermore, the calculation results and their corresponding expression trees are used as structured registration data and entered into the registration database in key-value pair format.
[0093] Understandably, by using the calculation results and their corresponding expression trees as structured registration data and entering them into the registration database in key-value pairs, a closed loop is achieved between the calculation results and the new structured registration data: subsequent calculations can directly use existing calculation results containing complete expression trees, solving the problem of lack of correlation between independent code fragments; all data stored in the registration database, including initial data, intermediate results, and final results in the calculation process, carries expression trees, constructing a continuously traceable calculation chain and meeting the end-to-end auditing requirements of complex multi-step calculation scenarios.
[0094] Please see Figure 4 Furthermore, acquiring task information and identifying the task intent of the task information, and if it meets the preset task intent conditions, extracting the structured registration data required for the task information from the registration database includes the following steps:
[0095] Step S21: Obtain task information and identify the task intent based on the large language model;
[0096] Step S22: When the task intent of the task information includes computational requirements, the registration database does not include the computational results of the computational requirements, and the registration database includes all the structured registration data required to complete the computation, extract the structured registration data required for the task information from the registration database.
[0097] Understandably, the specific triggering conditions for task intent recognition and data extraction of task information are: there is a computational requirement, there is no readily available computational result, and the registration database has complete required structured registration data, thus avoiding invalid computation and improving efficiency; ensuring that all necessary structured registration data has been obtained before computation, providing complete initial child nodes for subsequent complete expression tree construction, ensuring the integrity of the computation chain from the source, and avoiding the breakage of the intermediate computation step chain due to missing initial data.
[0098] Furthermore, when the task intent in the task information does not include computational requirements, the system responds to the user in a dialogue mode; when the registration database includes the computational results of the computational requirements, the system recalls and outputs the corresponding structured registration data.
[0099] Understandably, by responding with dialogue when there is no computational need, and retrieving and outputting the corresponding structured registration data from the registration database when there is a result, the system's flexibility is improved, adapting to diverse task scenarios. When retrieving existing corresponding structured registration data, since the structured registration data is associated with an expression tree, even if the data is output directly, it can still be traced back to the initial data, ensuring that the requirement for data result verifiability is still met in non-computational scenarios, covering the entire process requirements of high-reliability scenarios.
[0100] Please see Figure 5 Furthermore, extracting the structured registration data required for task information from the registration database includes the following steps:
[0101] Step S221: Based on the task information, a first candidate data set is selected from the structured registration data using a keyword matching algorithm.
[0102] Step S222: Based on semantic parsing of the large language model, the structured registration data required for the task information is selected from the first candidate data set;
[0103] The structured registration data includes data name, data value, and the expression tree corresponding to the data value.
[0104] Understandably, the two-step filtering method of extracting structured registration data using keyword matching algorithms and large language model semantic parsing first performs preliminary filtering using keyword matching algorithms, and then further refines the filtering based on large language model semantic parsing. Even if there are some differences between the data names of the task information and the corresponding key names of the structured registration data, accurate selection can still be achieved without interference. Since the structured registration data contains data names, data values, and expression trees, it provides a complete information dimension for the two-step filtering method. Preliminary filtering can be achieved based on data names, while the expression tree helps the large language model semantic parsing to further refine the filtering. This ensures that the extracted structured registration data and task requirements are doubly matched in terms of name identification and source logic, ensuring the accuracy of the matching between the extracted structured registration data and task requirements, and avoiding invalid computation links due to incorrect matching between structured registration data and task requirements. Furthermore, the extracted structured registration data carries expression trees, allowing the expression trees of subsequent calculations to be directly linked to the historical links of the structured registration data, ensuring the accuracy in multi-step calculations, and further strengthening the coherence and verifiability of the entire link.
[0105] Please see Figure 6 The second embodiment of the present invention provides an intelligent agent 100, which includes the following modules:
[0106] Input module 1 is used to obtain the registration database, which stores structured registration data in key-value pair format, as well as task information;
[0107] The structured registration data retrieval module 2 is used to identify the task intent of the task information. If it meets the preset task intent conditions, it extracts the structured registration data required for the task information from the registration database.
[0108] Encapsulation module 3 is used to encapsulate structured registration data into traceable type data, which automatically records calculation operation information through overloaded operators;
[0109] The computational code generation module 4 is used to construct code generation requests. The large language model generates computational code based on the code generation requests. The variables in the computational code are all obtained by accessing the structured registration data through the structured interface.
[0110] Calculation module 5 is used to execute calculation code and dynamically construct expression trees during the calculation process;
[0111] Output module 6 is used to generate calculation results and result expression chains based on expression trees, and to visualize the output result expression chains.
[0112] Understandably, the intelligent agent 100 has the same beneficial effects as the data processing method for optimizing agent interpretability in the first embodiment of the present invention, which will not be elaborated here.
[0113] The third embodiment of the present invention provides a computer-readable storage medium storing a computer program, which, when executed, implements a data processing method for optimizing agent interpretability according to the first embodiment of the present invention.
[0114] Understandably, computer-readable storage media have the same beneficial effects as the data processing method for optimizing agent interpretability in the first embodiment of the present invention, and will not be described in detail here.
[0115] In the embodiments provided by this invention, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information.
[0116] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the invention. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Those skilled in the art should also recognize that the embodiments described in the specification are optional embodiments, and the actions and modules involved are not necessarily essential to the invention.
[0117] In various embodiments of the present invention, it should be understood that the sequence number of each process does not necessarily imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0118] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It is particularly important to note that each block in a block diagram and / or flowchart, or a combination of blocks in a block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0119] The foregoing has provided a detailed description of a data processing method, intelligent agent, and storage medium for optimizing agent interpretability disclosed in embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention. Any modifications, equivalent substitutions, and improvements made within the principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A data processing method for optimizing agent interpretability, characterized in that, Includes the following steps: Obtain the registration database, which stores structured registration data in key-value pair format; Obtain task information and identify the task intent of the task information. If the task intent conditions are met, extract the structured registration data required for the task information from the registration database. The structured registration data is encapsulated into traceable type data, and the traceable type data automatically records calculation operation information through overloaded operators; A code generation request is constructed, and the large language model generates computational code based on the code generation request; wherein, the variables in the computational code are all obtained by accessing the structured registration data through a structured interface; Execute the computation code and dynamically construct the expression tree during the computation process; Based on the expression tree, the calculation result and the result expression chain are generated, and the result expression chain is visualized and output. The traceable type data includes the value of the structured registration data, calculation process information recording the operation history, and pointers to expression tree nodes associated with the calculation steps; the calculation result and its corresponding expression tree are recorded in the registration database as structured registration data in key-value pair form; the traceable type data automatically records calculation operation information through overloaded operators, including creating new expression tree nodes to represent the current calculation, and linking the expression tree of the structured registration data as a child node to the new expression tree node.
2. The data processing method for optimizing agent interpretability as described in claim 1, characterized in that: The traceable data type includes Trackedvalue data, and the computation operation information includes the data name, data value, and operator of the computation operation.
3. The data processing method for optimizing agent interpretability as described in claim 2, characterized in that: The traceable data type automatically records computational operation information through overloaded operators, including: Obtain the structured registration data involved in the calculation, along with its associated data names, data values, and expression tree; Perform calculations and record the operators used; Create a new expression tree node to represent this calculation, and link the expression tree of the structured registration data as a child node to the new expression tree node; Returns a new Trackedvalue type data to encapsulate the calculation result, and associates the new expression tree node with the new Trackedvalue type data.
4. The data processing method for optimizing agent interpretability as described in claim 1, characterized in that: The code generation request includes the following constraints: Provide the large language model with a list of access paths to the structured registration data, but do not display the numerical values of the structured registration data; prohibit the definition of free variables or references to raw values that are not bound to the registration database; and force all variables in the calculation code to access the structured registration data through the structured interface.
5. The data processing method for optimizing agent interpretability as described in claim 1, characterized in that: The steps of acquiring task information and identifying the task intent of the task information, and extracting the structured registration data required for the task information from the registration database if it meets preset task intent conditions, include the following: Obtain task information and identify the task intent based on a large language model; When the task intent of the task information includes computational requirements, the registration database does not include the computational results of the computational requirements, and the registration database includes all the structured registration data required to complete the computation, the structured registration data required for the task information is extracted from the registration database.
6. The data processing method for optimizing agent interpretability as described in claim 5, characterized in that: When the task intent of the task information does not include computational requirements, it responds to the user in a dialogue mode; When the registration database includes the calculation results of the calculation requirements, the corresponding structured registration data is recalled and output.
7. The data processing method for optimizing agent interpretability as described in claim 1, characterized in that: The process of extracting the structured registration data required for the task information from the registration database includes the following steps: Based on the task information, a first candidate data set is selected from the structured registration data using a keyword matching algorithm. Based on semantic parsing of a large language model, the structured registration data required for the task information is selected from the first candidate data set; The structured registration data includes a data name, a data value, and an expression tree corresponding to the data value.
8. An intelligent agent, characterized in that, The intelligent agent includes the following modules: The input module is used to obtain the registration database, which stores structured registration data in key-value pair format, and to obtain task information; The structured registration data retrieval module is used to identify the task intent of the task information. If it meets the preset task intent conditions, it extracts the structured registration data required for the task information from the registration database. An encapsulation module is used to encapsulate the structured registration data into traceable type data. The traceable type data automatically records calculation operation information through overloaded operators. The traceable type data includes the value of the structured registration data, calculation process information recording the operation history, and pointers to expression tree nodes associated with the calculation steps. The automatic recording of calculation operation information by the traceable type data through overloaded operators includes creating new expression tree nodes to represent the current calculation and linking the expression tree of the structured registration data as child nodes to the new expression tree node. The computational code generation module is used to construct a code generation request. Based on the code generation request, the large language model generates computational code. The variables in the computational code are all obtained by accessing the structured registration data through a structured interface. The calculation module is used to execute the calculation code and dynamically construct the expression tree during the calculation process; The output module is used to generate calculation results and result expression chains based on the expression tree, and to visualize and output the result expression chains; the calculation results and their corresponding expression trees are used as structured registration data and are entered into the registration database in the form of key-value pairs.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed, it implements the data processing method for optimizing agent interpretability as described in any one of claims 1-7.
Citation Information
Patent Citations
Commercial real estate digital assistant system based on large model and intelligent agent
CN119918633A