Method for automatically generating multi-dimensional analysis comment text based on financial data driving

By constructing a dynamic causal logic graph and combining it with incremental information pruning, counterfactual intervention, and symbolic logic constraints, the problems of causal inference and logical consistency in financial analysis are solved, generating high-quality financial analysis commentary texts.

CN122154782APending Publication Date: 2026-06-05山东电子职业技术学院

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
山东电子职业技术学院
Filing Date
2026-01-29
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing automated financial analysis generation technologies struggle to accurately uncover the underlying causal drivers of indicator changes. The generated analytical conclusions lack interpretability and logical persuasiveness, and are prone to factual errors or logical contradictions when dealing with rigorous financial logic.

Method used

By constructing a dynamic causal logic graph that includes explicit accounting constraints and implicit logic transmission, and combining incremental information pruning, counterfactual intervention, and neural symbol constraints, financial analysis commentary texts are generated.

Benefits of technology

It achieves time-sensitive fusion of heterogeneous data, improves the signal-to-noise ratio of attribution inference, confirms the real causes of financial fluctuations, eradicates the logical illusion of generative models, and ensures the rigor and cross-cycle consistency of analysis reports.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122154782A_ABST
    Figure CN122154782A_ABST
Patent Text Reader

Abstract

The application relates to the field of artificial intelligence and big data processing, and discloses a multi-dimensional analysis comment text automatic generation method based on financial data driving, which comprises the following steps: firstly, the unstructured external matter data is mapped to a financial data cycle to construct a dynamic causal matter graph; the graph is intelligently pruned by using an information increment index in combination with path distance constraints to extract a core explanation subgraph; on this basis, a structural causal model is constructed, the average treatment effect is calculated through counterfactual intervention, the core motivation leading to the change of the financial index is quantified and locked; finally, the core motivation is input into a large language model, and a text is generated in the decoding process by introducing symbol logic detection and cross-cycle consistency double constraints. The application effectively fuses causal inference and generative AI, solves the problems of shallow attribution in financial analysis and the existence of fact illusion in generated content, and realizes precise, logically self-consistent and automated deep analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of artificial intelligence and big data processing technology, specifically a method for automatically generating multi-dimensional analysis comment text based on financial data. Background Technology

[0002] With the digital transformation of fintech and the in-depth application of big data technology, in-depth analysis and automated interpretation of corporate financial conditions have become crucial aspects of intelligent investment research and corporate management decision-making. In existing technological systems, the automated generation of financial analysis reports primarily relies on template-filling techniques based on predefined rules or predictive models based on statistical machine learning. However, these traditional methods have significant limitations when dealing with complex financial logic and multi-source heterogeneous data.

[0003] While rule-based template methods can ensure data accuracy, the generated text is rigid and monotonous, merely providing an objective description of superficial changes in financial indicators. They fail to delve into the underlying causes of these changes, thus failing to meet users' needs for in-depth and personalized analysis. On the other hand, statistical machine learning methods, while possessing data mining capabilities to some extent, primarily focus on capturing statistical correlations rather than causality. This makes them susceptible to spurious correlations and unable to distinguish between the true drivers of financial indicator changes and random noise, resulting in analytical conclusions lacking interpretability and logical persuasiveness.

[0004] In recent years, generative artificial intelligence technologies, represented by large language models, have made groundbreaking progress in the field of natural language processing, capable of generating fluent and semantically rich text. However, directly applying general-purpose large language models to the rigorous field of financial analysis still faces significant challenges. On the one hand, the probabilistic prediction-based generation mechanism of large language models makes them prone to "illusion" when handling precise numerical calculations and strict accounting logic. The generated analytical comments may contain factual errors or contradictory logic, seriously affecting the credibility of the report. On the other hand, financial data is characterized by low frequency and structure, while external public opinion and macroeconomic events affecting business operations are high-frequency, unstructured text streams. Existing technologies struggle to effectively align and logically correlate these two types of heterogeneous data at the causal level, making it difficult for analytical models to quantify the specific contribution of external events to financial results and generate high-quality analytical reports that are both data-supported and possess causal insights. Therefore, there is an urgent need for an automatic financial analysis comment generation solution that can integrate causal inference capabilities with the generative capabilities of large language models and strictly constrain logical consistency. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a method for automatically generating multi-dimensional analysis and commentary text based on financial data. This method solves the technical problems of existing automated financial analysis generation technologies, which struggle to accurately uncover the deep causal drivers of indicator changes and where generative models are prone to generating factual illusions and cross-cycle logical conflicts when dealing with rigorous financial logic.

[0006] To achieve the above objectives, the present invention provides the following technical solution: In its first aspect, the present invention provides a method for automatically generating multi-dimensional analysis comment text based on financial data.

[0007] This method mainly includes: First, acquiring structured financial data and unstructured external reasoning data for the target company's current and historical periods, and mapping the unstructured external reasoning data to the time period of the structured financial data to achieve temporal alignment of heterogeneous data. Next, constructing a dynamic causal reasoning graph containing financial indicator nodes, external reasoning nodes, and edges connecting each node. Then, based on the current analysis objective, calculating the information increment index of each predecessor node in the graph relative to the analysis objective, and pruning the dynamic causal reasoning graph based on the information increment index to obtain a core explanatory subgraph. Constructing a structural causal model in the core explanatory subgraph, and performing counterfactual intervention for the analysis objective, calculating the average treatment effect of each candidate cause to determine the core driver leading to changes in financial indicators. Finally, inputting the core driver and related financial indicator data into a pre-trained large language model, and combining symbolic logic constraints during the decoding process to generate financial analysis commentary text.

[0008] In a preferred embodiment, to simulate the time-varying characteristics of information influence in financial markets, when constructing a dynamic causal logic graph, the edges connecting each node are divided into explicit accounting constraint edges and implicit logic transmission edges. The weights of the implicit logic transmission edges are dynamically calculated. The specific calculation rules comprehensively consider semantic relevance and time decay, i.e., calculating the semantic similarity between the source node and the target node, and the time lag between the event occurrence time of the source node and the financial reporting time of the target node. The edge weights decay exponentially with increasing time lag, and the calculation formula is expressed as follows:

[0009]

[0010] in, For a moment edge weights, and These are the semantic vectors of the source node and the target node, respectively. Indicates time delay, The time decay coefficient, This is the normalization coefficient.

[0011] In a preferred embodiment, to sift through massive amounts of data to identify the most explanatory causal paths, this invention introduces an information theory-based pruning mechanism. The process of calculating the information increment index specifically involves: firstly, discretizing the changes in the financial indicators of the analytical target into state variables. And calculate its information entropy. Then calculate the state of the known predecessor node. Under changing conditions, the conditional entropy of the target state variable being analyzed. Ultimately, the information gain index (i.e., information increment) is obtained by the difference between the two. ):

[0012]

[0013] This indicator objectively quantifies the contribution of the precursor node to eliminating the uncertainty of the target indicator.

[0014] Furthermore, to avoid being misled by statistical correlation alone and to consider the distance cost of causal transmission, a distance penalty mechanism is introduced in the step of pruning the dynamic causal graph. The system calculates the shortest path length from the predecessor node to the analysis target. The information increment index is then corrected using this length to obtain the significance score of the explanatory path. :

[0015]

[0016] in This is the distance penalty factor. By setting a scoring threshold, the system retains only nodes and connections with scores higher than the threshold, thereby constructing a core interpretive subgraph with a high signal-to-noise ratio.

[0017] In a preferred embodiment, to achieve accurate causal attribution, the present invention employs a structural causal model (SCM) on the core explanatory subgraph. Specifically, for each node... Establish a nonlinear additive noise model:

[0018]

[0019] in For the set of parent nodes, This is considered exogenous noise. Based on this, the average treatment effect (ATE) is calculated through counterfactual intervention to distinguish between correlation and causation. Specifically, candidate causal nodes are selected. Each of them is set as the true observed value. (Factual input) and counterfactual benchmark values ​​generated according to preset benchmark rules (Counterfactual input, such as historical mean), calculate the impact of both on the analysis objective. Difference in expected value:

[0020]

[0021] This difference directly reflects the net contribution of this factor to the change in financial indicators.

[0022] In a preferred embodiment, to ensure the rigor and reliability of the generated text content, this invention employs a neural symbol-based decoding strategy. During the large language model generation process, text fragments are converted into structured logical expressions containing numerical values ​​and variable relationships, such as triples or arithmetic equations, in real time using preset semantic parsing rules or models, and compared with structured financial data and core drivers. If logical violations such as numerical calculation errors, directional description errors, or attribution contradictions are detected, a penalty vector is constructed. For words that cause violations, their penalty values ​​are set to preset masking thresholds. (A very large value). The final controlled sampling distribution. The calculation is as follows:

[0023]

[0024] in This is the penalty vector. When the penalty value of the corresponding word is the masking threshold, it is in... The probability of this is close to zero, thus preventing logical errors from occurring at the source at the generation end.

[0025] Furthermore, to ensure the consistency of analytical viewpoints over time, the symbolic logic constraints also include cross-period consistency checks. The system obtains the vector representation of the semantics of the comment text generated in the previous reporting period. And calculate its semantic vector with the currently generated content. Cosine similarity:

[0026]

[0027] If the similarity is lower than the preset consistency threshold, the system determines that there is a cross-cycle logical conflict and applies the corresponding generation penalty.

[0028] A second aspect of the present invention provides an electronic device.

[0029] The electronic device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method for automatically generating multi-dimensional analysis and commentary text based on financial data as described in the first aspect. By executing the above method, the electronic device can automatically generate analysis reports that possess both deep causal insights and comply with strict financial logic standards.

[0030] This invention provides a method for automatically generating commentary text based on multi-dimensional analysis driven by financial data. It has the following beneficial effects:

[0031] 1. Breaking down heterogeneous data barriers to achieve time-sensitive data-event fusion. This invention creatively solves the problem of structured financial statements and unstructured external news interacting on the same logical plane by constructing a dynamic graph that includes explicit accounting constraints and implicit event transmission. In particular, by introducing an edge weight mechanism that decays exponentially over time, it simulates the "forgetting curve" of information influence in the financial market, enabling the system to accurately capture the lagging impact of external events on financial indicators. This design gives static financial figures a dynamic external environmental context, so that machine-generated comments are no longer just a dry accumulation of numbers, but a deep analysis with environmental awareness.

[0032] 2. Adaptive Pruning Based on Information Increment Improves the Signal-to-Noise Ratio of Attribution Reasoning. Addressing the problem of excessive noise in the full contextual graph leading to divergent reasoning, this invention utilizes an "information increment index" to dynamically prune the graph. This is not merely simple dimensionality reduction, but an attention-focusing mechanism based on information theory—the system can automatically sift out statistically relevant but lacking substantial explanatory power redundant events based on the current analytical focus. This mechanism ensures that subsequent reasoning processes are conducted only on the most informative "core explanatory subgraph," significantly reducing computational overhead and guaranteeing concise and insightful analytical conclusions, avoiding the common problem of lengthy but superficial explanations.

[0033] 3. Introducing a counterfactual intervention mechanism to confirm the true drivers of financial fluctuations. Unlike traditional methods that rely solely on correlation analysis, this invention introduces counterfactual intervention within the framework of a structural causal model (SCM). By calculating the average treatment effect (ATE), the system can mathematically simulate "what would have happened if the event had not occurred," thereby quantifying the net contribution of each candidate factor. This process endows the AI ​​with the dialectical thinking ability of a seasoned analyst, effectively eliminating coincidental false associations and ensuring that the final generated commentary has a rigorous scientific basis in logical attribution.

[0034] 4. Neural Symbolic Dual Constraints: Curbing the "Logical Illusion" of Generative Models. Addressing the inherent problem of large language models easily generating numerical errors or logical contradictions when processing rigorous financial data, this invention innovatively embeds a symbolic logic verification layer during the decoding stage. By parsing the generated text in real time and calculating the logical violation penalty vector, the system transforms rigid accounting identities and causal chains into "hard constraints" of generated probability distributions. This "soft and hard" strategy preserves the language model's fluent text organization capabilities while forcibly correcting potential computational fallacies through a masking threshold, thus ensuring the absolute mathematical consistency of the analysis report.

[0035] 5. Cross-period consistency verification to construct a coherent historical analytical perspective. This invention also pays special attention to the historical coherence of analytical viewpoints. Through a cross-period semantic vector comparison mechanism, it prevents the system from making contradictory evaluations of the same business situation in different reporting periods. This design ensures that the generated financial commentary is not merely an isolated interpretation of a single period's report, but rather forms a logically coherent timeline narrative. For investors, this analytical text with historical memory is more valuable, clearly demonstrating the continuity of corporate business strategies and their long-term impact. Attached Figure Description

[0036] Figure 1 This is a schematic diagram of the hardware structure of the electronic device of the present invention;

[0037] Figure 2 This is an overall flowchart of the method of the present invention;

[0038] Figure 3 This is a schematic diagram illustrating the principle of dynamic causal event graph construction and edge weight calculation in this invention;

[0039] Figure 4 This is a schematic diagram of the graph pruning and core interpretation subgraph generation based on information increment of the present invention.

[0040] Figure 5 This is a schematic diagram illustrating the calculation principle of counterfactual intervention and average treatment effects in the structural causal model of this invention.

[0041] Figure 6 This is a diagram illustrating the decoding and generation architecture of a large language model that incorporates symbolic logic constraints, as presented in this invention. Detailed Implementation

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

[0043] Please see the appendix Figures 1-6This invention provides a method for automatically generating multi-dimensional analysis commentary text based on financial data, which is applied to an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the above method. In a specific hardware implementation, the processor is configured to perform complex tensor operations and graph neural network inference, and the memory is configured to store large-scale pre-trained language model parameters and constructed dynamic causal reasoning graph data. The electronic device communicates with external financial databases and news data sources through a data interface to obtain the required heterogeneous data in real time.

[0044] The method for automatically generating multi-dimensional analysis commentary text based on financial data first involves acquiring structured financial data and unstructured external event data of the target company for the current and historical periods, and then mapping the unstructured external event data to the time period of the structured financial data.

[0045] Specifically, the data acquisition module extracts the target company's periodic financial reports, including balance sheets, income statements, and cash flow statements, from stock exchanges or professional financial databases. The system timestamps this structured data according to the reporting period (e.g., quarterly Q1, Q2, etc.), forming a time series of financial data. Simultaneously, the system collects unstructured text data related to the company through web crawlers or API interfaces, covering industry news, regulatory announcements, macroeconomic policies, and supply chain dynamics.

[0046] For unstructured data, the system utilizes natural language processing (NLP) techniques to extract events, retrieving event tuples containing a "subject-predicate-object" structure. The key lies in time-series alignment; the system parses the publication or event occurrence time from the text and maps it to the most recent financial reporting period. For example, if a raw material price increase occurred on March 15th, it is mapped to the first quarter (Q1) financial analysis period. This mapping mechanism ensures that the subsequently constructed graph accurately reflects the potential impact of external events on specific periodic financial indicators.

[0047] Next, a dynamic causal logic graph is constructed, which includes financial indicator nodes, external logic nodes, and edges connecting the nodes. During the graph initialization phase, the system defines two types of node sets: the financial indicator node set... and external principle node set For each node The system uses pre-trained deep language models (such as BERT or RoBERTa) to transform its text descriptions into high-dimensional semantic vectors. ,in It is a vector dimension. This allows heterogeneous financial items (such as "operating revenue") and news events (such as "surge in market demand") to be projected into the same semantic space, laying the mathematical foundation for calculating the strength of the association between the two.

[0048] In constructing the edge connections in the graph, the system distinguishes between two different types of connections: explicit accounting constraint edges and implicit logical transmission edges. Explicit accounting constraint edges are built based on generally accepted accounting identities, such as "Assets = Liabilities + Owner's Equity" or "Net Profit = Revenue - Total Costs." These edges exist to solidify the hard logical constraints within the financial data in the graph; their weights are set to fixed values ​​that do not change over time or context, ensuring that the model does not violate basic accounting principles during reasoning.

[0049] Implicit causal transmission edges are used to connect external causal nodes with financial indicator nodes, or to connect financial indicators that do not have a direct accounting relationship. These edges represent potential causal transmission paths, and their weights reflect the strength of the impact of external events on financial results. Considering the significant timeliness and attenuation of information transmission in financial markets, this invention employs a dynamic weighting mechanism.

[0050] The weights of the implicit event propagation edges are dynamically changing, and their calculation rules include: calculating the semantic similarity between the source node and the target node; calculating the time lag between the event occurrence time of the source node and the financial reporting time of the target node; calculating the edge weights based on the semantic similarity and the time lag, wherein the edge weights decrease exponentially with the increase of the time lag.

[0051] Specifically, for the source node (For example, a historical event) points to the target node (e.g., current financial indicators) at the current moment of analysis Dynamic weights Calculated using the following formula:

[0052]

[0053] In this formula, and These represent the semantic vectors of the source node and the target node, respectively. The dot product of the two elements is used to quantify the semantic relevance of the node content. If the two elements are highly semantically related, a larger dot product value indicates that the event is logically more likely to affect the financial metric.

[0054] In the formula Indicates the time lag period, i.e., the current analysis time. Time of occurrence of the source node event The difference between them. The preset time decay coefficient, and The exponential decay term The study simulates the characteristic that the influence of information gradually diminishes over time. For recent events, this factor approaches 1, with the weight primarily determined by semantic similarity; while for distant events, the factor approaches 0, causing the weight to decrease rapidly. This mechanism effectively filters outdated information from interfering with current financial analysis, allowing the graph to focus on recent and relevant core drivers.

[0055] In the formula The normalization coefficient is used to adjust the calculated weight values ​​to the range required by the model, preventing gradient explosion caused by excessively large vector magnitudes. Through the above steps, the system constructs a complex heterogeneous graph that incorporates both static accounting logic and dynamic spatiotemporal features, providing complete data structure support for subsequent pruning and causal inference.

[0056] In this embodiment, based on the constructed dynamic causal reasoning graph, the system performs a core explanatory subgraph extraction operation targeting a specific analytical objective. Since the initially constructed graph contains a massive number of external reasoning nodes and complex connections, directly performing full-graph reasoning not only incurs enormous computational overhead but also easily introduces irrelevant noise, leading to attribution divergence. Therefore, this invention intelligently prunes the graph by calculating information increment indicators and combining them with path distance constraints to select core paths that have substantial explanatory power for the analytical objective.

[0057] Based on the current analytical objectives, the system first identifies the target node in the graph, such as "net profit" or "operating cash flow." To quantify the degree to which the preceding node eliminates uncertainty about the target node, the system employs an information theory-based computational method. Given that financial data is typically represented as continuous time-series values, while the calculation of information entropy relies on discrete probability distributions, the system performs state variable discretization. Specifically, the system acquires the numerical sequences of the analytical target and each preceding node in the graph over historical periods, and uses statistical quantiles or preset volatility interval rules to map continuous values ​​into discrete state variables. For example, the changes in financial indicators are divided into state spaces such as "significant growth," "stable fluctuation," and "significant decline."

[0058] After completing the state discretization, the system calculates and analyzes the state variables of the target. Information entropy, an indicator that reflects the uncertainty of a target indicator's changing state in the absence of any prior information. The calculation formula is as follows:

[0059]

[0060] in, express The possible first a state, This represents the marginal probability of this state occurring in historical data.

[0061] Subsequently, the system traverses all predecessor nodes in the graph that point to the target of analysis. (Including nodes directly connected and nodes connected via multi-hop paths), calculate the state variables of the known predecessor node. Under the given conditions, analyze the conditional entropy of the target state variable. Conditional entropy reflects the remaining uncertainty of the analytical objective after knowing about a certain external event or change in a preceding financial indicator. Its calculation formula is:

[0062]

[0063] in, Represents the predecessor node The a state, Its marginal probability, Given that the predecessor node is in a certain state At that time, the target node is in state The conditional probability.

[0064] Based on the above calculation results, the system derives the predecessor node. Information increment index relative to the analysis target This indicator is numerically equal to the difference between information entropy and conditional entropy, directly quantifying the net contribution of the information carried by the predecessor node to explaining changes in the target node. The formula for calculating the information increment indicator is:

[0065]

[0066] To further optimize the screening results, this invention fully considers the distance attenuation effect of causal transmission. In complex causal graphs, even if two nodes have high statistical mutual information, if their topological distance in the graph is too great and there are too many intermediate transmission links, the probability of a strong causal relationship between them is low, and they are easily affected by noise from intermediate nodes. Therefore, the system introduces a penalty mechanism based on the shortest path length to correct the information increment index.

[0067] The system uses graph search algorithms (such as Dijkstra's algorithm or breadth-first search algorithm) to calculate the predecessor node. To the analysis target Shortest path length in the graph Using the path length as a penalty term, the explanatory path saliency score of the predecessor node is calculated. The calculation formula is as follows:

[0068]

[0069] In this formula, This is a preset distance penalty factor used to adjust the weight of the impact of path length on the score. The larger the value of , the stronger the system's penalty for long paths, thus tending to preserve direct or short-distance causal relationships. (Denominator term) This ensures that the saliency score decreases non-linearly as the path length increases.

[0070] Finally, the system optimizes the graph structure according to a preset pruning strategy. The system sets a global scoring threshold and compares the significance scores of the explanatory paths of all predecessor nodes with this threshold. Nodes and their connecting edges with scores greater than the threshold are retained, while nodes and their connecting edges with scores lower than the threshold are removed. Through this process, the original massive dynamic causal graph is simplified into a core explanatory subgraph. This subgraph contains only key nodes with high informational value to the current analysis objective and compact logical transmission paths, providing a high-quality data foundation for subsequently building a high-precision structural causal model and effectively avoiding inference distortion caused by the curse of data dimensionality.

[0071] In this embodiment, for the constructed core explanatory subgraph, the system further constructs a structural causal model, aiming to go beyond traditional statistical correlation analysis and delve deeper into the true causal mechanisms behind changes in financial indicators. Although the core explanatory subgraph removes noisy nodes with low information content, only topological connections are retained between the remaining nodes, and the functional generation relationships between nodes have not yet been quantified. Therefore, the system establishes a nonlinear additive noise model for each node in the subgraph, formalizing the causal relationship into a functional equation.

[0072] Specifically, for any node in the core explanatory subgraph The numerical generation process is modeled as the sum of a nonlinear function of its parent node set and exogenous noise. This modeling approach can flexibly capture the complex nonlinear interactions between financial variables and external macroeconomic indicators. The mathematical expression of the nonlinear additive noise model is as follows:

[0073]

[0074] In this formula, Representing nodes in the graph The observation vector of all direct parent nodes (i.e. causal predecessors); These represent mutually independent exogenous noise variables, used to cover potential influencing factors not observed in the model. It is a nonlinear function. In the specific implementation of this invention, a multilayer perceptron or Gaussian process regression is used to fit this function. The system uses historical periodic data to... The training process learns the nonlinear mapping relationship between parent nodes and child nodes by minimizing the prediction error.

[0075] After the structural causal model training converges, the system performs counterfactual interventions to achieve the current analytical objective. The core of this step is to simulate "how financial results would change if a specific cause had not occurred or remained at a normal level," thereby isolating the net effect of individual factors. The system first selects candidate causal nodes to be analyzed. (For example, "raw material prices"), two input states are set: one is the fact input, which is the actual observation value of the node in the current reporting period. Another type is counterfactual input, which is the counterfactual baseline value of the node. .

[0076] The counterfactual benchmark Generated based on preset benchmark rules, the system obtains the historical average or industry standard value of the candidate cause node as a benchmark, representing the theoretical normal state of the indicator under "no sudden events". Subsequently, the system introduces causal inference... Operator, forced to The values ​​are fixed as follows: and And keeping other exogenous noise in the model constant, using the trained function Layer-by-layer forward deduction, calculating the target under two conditions respectively. The value.

[0077] Based on the above deduction results, the system calculates the average treatment effect of each candidate cause, thereby quantifying the actual contribution of that cause to changes in financial indicators. The formula for calculating the average treatment effect is as follows:

[0078]

[0079] in, This represents the mathematical expectation operator. The first term... The second item represents the expected value of the target analyzed under the current real-world environment. This represents the expected value of the target analysis when the cause is assumed to be in the baseline state. The difference between the two is the marginal impact of the candidate cause.

[0080] Finally, the system ranks all candidate causal nodes by the absolute value of their average treatment effect (ATE). Nodes with larger absolute ATE values ​​indicate stronger explanatory power and more significant causal attributes for fluctuations in financial indicators. The system selects the nodes with the highest ATE ranking as the core drivers of changes in financial indicators. This process transforms previously vague qualitative attribution into precise quantitative calculations, ensuring that subsequent analysis and commentary are not based on superficial data co-occurrence but on deep causal logic, effectively identifying the key elements that truly drive changes in corporate performance.

[0081] In this embodiment, the system uses a set of core drivers and their associated structured financial indicator data determined in the preceding steps as contextual prompts, inputting them into a pre-trained large language model. To address the tendency of generative artificial intelligence to produce factual errors when processing rigorous financial text, this invention does not directly use the model's raw output, but instead introduces an immediate symbolic logic constraint mechanism during the decoding and generation process. During the model's word-by-word generation, the system monitors and parses the generated text fragments in real time, constructing a controlled generation environment tightly coupled with neural computation and symbolic logic.

[0082] Specifically, at each time step of the large language model's autoregressive decoding process, the system uses pre-defined semantic parsing rules or a lightweight syntactic analyzer to convert the currently generated text fragment into a structured logical expression containing numerical entities, variable objects, and operational relationships. For example, when the model generates the fragment "net profit increased by 20% year-on-year," the system parses it into the logical expression Profit_Growth=0.20. Subsequently, the system performs a consistency comparison between this logical expression and the structured financial truth values ​​stored in the database and the previously calculated causal strength of the core drivers.

[0083] If the comparison results show a conflict between the logical expression and the structured data (e.g., the database shows an actual growth rate of 5%), or a contradiction with the attribution direction of the core drivers (e.g., the model incorrectly attributes profit growth to increased costs, while the causal model shows the driver as increased sales), the system determines that the currently generated word or phrase contains a logical violation. To prevent errors at the probabilistic level, the system applies a hard intervention to the model's output probability distribution before sampling.

[0084] This invention employs a probability correction method based on penalty vectors. The system first obtains the large language model at the current time step. The original log probability vector of the output At the same time, for each word in the vocabulary list... The system constructs a penalty vector based on the logical verification results. For candidate words that cause logical violations, place them in... The corresponding component is set to a preset shielding threshold. ( For example, a very large positive number For logically consistent candidate words, their corresponding components are set to 0. The final controlled sampling distribution... Calculated using the following formula:

[0085]

[0086] In this formula, Words The log probability in the original output, This indicates the penalty value corresponding to the word. This is the model vocabulary set. Due to the masking threshold... Extremely large, when At that time, the numerator The probability of the erroneous word being sampled is mathematically forced to zero, thus ensuring that the generated text strictly adheres to the objective facts of the financial data and the inference conclusions of the causal model.

[0087] Furthermore, to ensure the consistency of analytical viewpoints across time and avoid contradictory evaluations from the system within consecutive reporting periods, symbolic logic constraints also include cross-period consistency constraints. The system retrieves the semantic vector representation of the comment text generated in the previous reporting period from the historical storage module. After the currently generated content completes a full semantic unit (such as a sentence or paragraph), the system calculates the semantic vector of the currently generated content in real time. Cosine similarity with historical vectors.

[0088] Cosine similarity The calculation formula is as follows:

[0089]

[0090] in, Represents the dot product of two vectors. This represents the Euclidean norm (magnitude) of a vector. The system sets a consistency threshold. If the calculated similarity If the semantics fall below this threshold, and the current semantics do not contain explicit "turning point" or "abrupt change" signal words (such as "however" or "through reform"), a cross-cycle logical conflict is identified. In this case, the system triggers a backtracking mechanism, penalizing the currently generated semantic units and requiring the model to regenerate until the cross-cycle consistency requirement is met. Through these dual constraints, the system ultimately outputs a high-quality analytical commentary text that conforms to current financial facts and possesses historical logical coherence.

[0091] This embodiment systematically describes the overall execution flow of the aforementioned method for automatically generating multi-dimensional analysis commentary text based on financial data. This process, through the close integration of its various functional steps, transforms heterogeneous raw data into a logically rigorous analysis report with deep causal insights, forming a closed-loop automated analysis system.

[0092] This method begins with data acquisition and preprocessing. The system concurrently accesses the enterprise's internal structured financial database and external internet public opinion interface to obtain the target enterprise's financial statement data and unstructured event text for the current and multiple historical accounting periods. To overcome the misalignment of the two types of data in the time dimension, the system performs a time-series mapping operation, parsing the time entities in the unstructured text and aligning them to the standard financial reporting window. Based on this, the system constructs a dynamic causal event graph. This graph not only includes nodes representing financial indicators and nodes representing external events, but also explicit accounting constraint edges and implicit event transmission edges connecting these nodes. The weights of the implicit event transmission edges are not statically set, but dynamically calculated based on the semantic similarity and time lag between nodes, ensuring that the graph can accurately capture the instantaneous impact of recently highly correlated events.

[0093] Subsequently, the system enters the graph optimization and feature selection stage. Faced with the potentially massive number of nodes and complex connections in the graph, the system initiates an information theory-based pruning mechanism based on the current specific analysis objective (e.g., "explaining the reasons for the decline in net profit"). The system traverses all predecessor nodes, calculates their information increment index relative to the analysis objective through discretization, i.e., the uncertainty reduction brought about by conditional entropy. Simultaneously, the system introduces a penalty term based on the shortest path length to correct this index, calculating the significance score of the explanatory path. Based on a preset scoring threshold, the system removes redundant nodes with low information content or long distances, retaining highly significant nodes and their connections, thereby extracting the core explanatory subgraph from the full graph. This step effectively reduces the dimensionality of subsequent reasoning, ensuring that computational resources are concentrated on the most explanatory causal paths.

[0094] Next, the system performs in-depth causal inference based on the core explanatory subgraph. Moving beyond shallow statistical correlation, the system constructs a nonlinear additive noise model for each node in the subgraph, fitting the functional generation relationships between nodes. Within this model framework, the system performs counterfactual intervention, simulating the impact of candidate causes on the expected value of the analysis target under different values ​​(factual observations and counterfactual baseline values). By calculating the average treatment effect (ATE), the system quantifies the net contribution of each candidate cause to the financial results and ranks the causes accordingly, identifying the core drivers leading to changes in financial indicators. This process represents a qualitative leap from "correlation discovery" to "causal confirmation."

[0095] Finally, the system inputs the identified core drivers, key financial indicators, and analytical objectives into a pre-trained large language model to initiate the text generation process. During the decoding and generation phase, the system does not directly adopt the model's raw output but instead applies real-time constraints through a combination of neural symbols. The system parses the generated content into logical expressions in real time and performs consistency comparisons with structured financial truth values. Once a logical conflict is detected, the system immediately constructs a penalty vector, uses a masking threshold to correct the model's output probability distribution, and forcibly blocks the sampling of erroneous information. Simultaneously, the system incorporates cross-period consistency constraints to ensure that the currently generated commentary maintains semantic coherence with historical reports. Ultimately, the electronic device outputs a financial analysis commentary text that is supported by accurate data, possesses profound causal logic, and is self-consistent across time.

[0096] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for automatically generating commentary text based on multi-dimensional analysis driven by financial data, characterized in that: Includes the following steps: Obtain structured financial data and unstructured external event data of the target enterprise for the current and historical periods, and map the unstructured external event data to the time period of the structured financial data; A dynamic causal logic graph is constructed, which includes financial indicator nodes, external logic nodes, and edges connecting each node. Based on the current analysis objective, calculate the information increment index of each predecessor node in the graph relative to the analysis objective, and prune the dynamic causal logic graph based on the information increment index to obtain the core explanatory subgraph; A structural causal model is constructed in the core explanatory subgraph, and counterfactual interventions are performed for the analysis objective to calculate the average treatment effect of each candidate cause in order to identify the core drivers of changes in financial indicators. The core driving forces and related financial indicator data are input into a pre-trained large language model. During the decoding process, symbolic logic constraints are incorporated to generate financial analysis commentary text.

2. The method for automatically generating multi-dimensional analysis commentary text based on financial data-driven approach according to claim 1, characterized in that, In the step of constructing a dynamic causal logic graph, the edges connecting each node include explicit accounting constraint edges and implicit logic transmission edges; The weights of the implicit reasoning propagation edges are dynamically changing, and their calculation rules include: Calculate the semantic similarity between the source node and the target node; Calculate the time lag between the occurrence time of the source node event and the financial reporting time of the target node; Edge weights are calculated based on the semantic similarity and the time delay, wherein the edge weights decrease exponentially with the increase of the time delay.

3. The method for automatically generating multi-dimensional analysis commentary text based on financial data as described in claim 1, characterized in that, The step of calculating the information increment index of each precursor node in the graph relative to the analysis target based on the current analysis target specifically includes: The changes in the financial indicators of the analytical target are discretized into state variables; Calculate the information entropy of the state variables of the analysis target; Calculate the conditional entropy of the state variables of the target under the condition that the state changes of the predecessor node are known; Subtracting the conditional entropy from the information entropy yields the information increment index of the predecessor node relative to the analysis target.

4. The method for automatically generating multi-dimensional analysis commentary text based on financial data as described in claim 3, characterized in that, The step of pruning the dynamic causal logic graph based on the information increment index to obtain the core explanatory subgraph specifically includes: Calculate the shortest path length from the predecessor node to the target in the graph; The shortest path length is used as a penalty term to correct the information increment index, and the explanatory path significance score is calculated. Set a scoring threshold, retain nodes and their connecting edges where the significance score of the explanatory path is greater than the scoring threshold, and construct the core explanatory subgraph.

5. The method for automatically generating multi-dimensional analysis commentary text based on financial data as described in claim 1, characterized in that, The steps involved in constructing a structural causal model specifically include: For each node in the core explanation subgraph, a nonlinear additive noise model is established; The nonlinear additive noise model represents the value of a node as the sum of the nonlinear function of its parent node and the exogenous noise.

6. The method for automatically generating multi-dimensional analysis commentary text based on financial data-driven approach according to claim 5, characterized in that, The steps of performing counterfactual intervention and calculating the average treatment effect of each candidate cause specifically include: Select candidate cause nodes, set their true observation values ​​as fact inputs, and generate counterfactual baseline values ​​as counterfactual inputs according to preset baseline rules; Using the aforementioned structural causal model, the expected value of the analytical objective is calculated under both factual and counterfactual input conditions. The average treatment effect is obtained by calculating the difference between the expected value under the stated factual input condition and the expected value under the stated counterfactual input condition.

7. The method for automatically generating multi-dimensional analysis commentary text based on financial data-driven approach according to claim 1, characterized in that, The step of generating financial analysis commentary text by incorporating symbolic logic constraints during the decoding process specifically includes: During the process of generating text using a large language model, the generated text fragments are parsed in real time; The text fragments are converted into logical expressions containing numerical values ​​and variable relationships using preset semantic parsing rules or models, and then compared with the structured financial data and the core driving forces for consistency. If the logical expression conflicts with the structured financial data or the core motivation, the words that cause the conflict are penalized in the probability distribution of the model to correct the output probability.

8. The method for automatically generating multi-dimensional analysis commentary text based on financial data as described in claim 7, characterized in that, The specific method for imposing punishment is as follows: A logic verification function is constructed. When a numerical calculation error, a directional description error, or an attribution that contradicts the core motivation is detected, it is determined to be a logic violation. Define a penalty vector, and set the penalty value of a word that causes a logical violation to a preset blocking threshold. The penalty vector is subtracted from the original log probabilities of the large language model and normalized to obtain the final controlled sampling distribution, wherein the masking threshold makes the sampling probability of the corresponding word approach zero.

9. The method for automatically generating multi-dimensional analysis commentary text based on financial data as described in claim 7, characterized in that, The symbolic logic constraints also include cross-cycle consistency constraints, specifically including: Obtain the vector representation of the semantics of the comment text generated in the previous reporting period; Calculate the cosine similarity between the semantic vector of the currently generated content and the vector representation of the semantics of the comment text from the previous reporting period; If the cosine similarity is lower than a preset consistency threshold, a cross-cycle logical conflict is determined and a penalty is imposed.

10. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 9.