Financial analysis system and method based on retrieval enhancement generation and reflection dynamic optimization

By constructing a dynamic knowledge base and a reflective dynamic optimization module, the financial analysis system solves the problems of low efficiency, poor accuracy, and insufficient interpretability in existing financial data analysis technologies, and achieves efficient, professional, and reliable financial data processing.

CN121883189APending Publication Date: 2026-04-17HARBIN INST OF TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HARBIN INST OF TECH
Filing Date
2025-12-26
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing financial data analysis technologies are inefficient, error-prone, and costly when faced with massive data processing needs. They lack domain expertise, struggle to adapt to dynamic changes in the financial regulatory environment, and lack interpretability, resulting in inaccurate analysis results and low user trust.

Method used

A financial analysis system based on retrieval enhancement generation and reflective dynamic optimization is constructed, including a dynamic knowledge base, a retrieval enhancement generation module, and a reflective dynamic optimization module. Through hybrid retrieval strategies, soft suggestion vector optimization, and reflective suggestions, the system ensures the timeliness and professionalism of the knowledge base, and achieves process traceability and result interpretability.

Benefits of technology

It improves the timeliness and accuracy of financial analysis, enhances the professionalism and relevance of the system, ensures the reliability and auditability of the analysis results, and increases users' trust in the analysis results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121883189A_ABST
    Figure CN121883189A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of financial data analysis, and particularly relates to a financial analysis system and method based on retrieval enhancement generation and reflection dynamic optimization. The problems that in the financial data analysis field in the prior art, systematic architecture is missing due to research fragmentation, a'illusion 'phenomenon is generated due to the fact that a general large language model lacks field professional knowledge, and a static knowledge system is difficult to adapt to dynamic changes of a financial supervision environment are solved. And the problem that an existing agent system lacks a complete reflection recording mechanism, so that the auditing performance of the decision-making process is insufficient and the like is solved. The system comprises a retrieval enhancement generation module and a dynamic reflection optimization module. The financial analysis system and method based on retrieval enhancement generation and reflection dynamic optimization are suitable for enterprise financial data analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of financial data analysis technology, and in particular to a financial analysis system and method based on retrieval-enhanced generation and reflective dynamic optimization. Background Technology

[0002] As enterprises deepen their digital transformation, the volume of financial data is growing exponentially. Traditional analysis methods based on manual processes or rule engines are struggling to cope with the demands of massive data processing, exhibiting inherent drawbacks such as inefficiency, error-proneness, and high costs. The emergence of Large Language Models (LLMs) and Agent technologies has provided a new technological path for automated financial analysis, significantly lowering the barrier to entry through natural language interaction capabilities.

[0003] In the development of intelligent agent technology, researchers have proposed a variety of methodological frameworks. For example, the ReAct (Reasoning-Acting) framework explores the interleaving of reasoning trajectory generation and task action execution, simulating the human "think-act" cycle and providing a basic cognitive model for intelligent agents. Models such as Toolformer, through self-supervised learning mechanisms, enable the model to autonomously identify the timing of tool invocation and pass parameters, thus expanding the boundaries of the model's ability to handle real-time information and precise computational tasks to a certain extent.

[0004] However, despite the significant progress made in these general-purpose intelligent agent technologies, existing solutions still have obvious limitations in the specific field of professional financial data analysis.

[0005] First, existing research is fragmented, with most work focusing on optimizing single technical points or single application scenarios, lacking an end-to-end system architecture that can support a complete financial analysis process. This fragmentation leads to poor coordination between different stages when the system handles complex financial analysis tasks that involve multiple steps and span multiple cycles, making it difficult to form a coherent analysis chain.

[0006] Secondly, general-purpose large language models and existing intelligent agent systems are severely inadequate for the financial domain. The financial domain is highly specialized and complex in its rules, involving stringent accounting standards (such as Chinese Enterprise Accounting Standards and International Financial Reporting Standards), intricate cross-referencing verification, and dynamically updated regulatory policies. Existing technical solutions generally lack effective domain knowledge injection mechanisms, making it difficult to guarantee the accuracy of understanding professional terminology and the compliance of business rule processing. This leads to "illusion" phenomena in practical applications, generating analytical results that do not conform to professional standards.

[0007] More notably, existing systems exhibit significant lag in the face of rapidly changing financial regulatory environments. Taking Chinese Accounting Standards and International Financial Reporting Standards as examples, major revisions occur on average every 1.5 years. Traditional systems based on static knowledge bases or rule bases require substantial manual intervention to complete updates, resulting in excessively long response cycles and failing to meet enterprises' timeliness requirements for financial data analysis.

[0008] Furthermore, existing technical solutions suffer from serious deficiencies in interpretability. Financial data analysis, as a crucial basis for corporate decision-making, demands a high degree of transparency and auditability in the analysis process. However, most current systems focus solely on generating the final results, lacking a complete record and traceability mechanism for the analysis process. Users find it difficult to verify the source and logical derivation of analytical conclusions, significantly impacting their trust in the results of intelligent analysis.

[0009] Therefore, there is an urgent need in this field for a financial data analysis technology solution that can effectively integrate domain expertise, has dynamic adaptability, and is traceable, in order to solve the core problems of existing technologies when facing professional financial analysis tasks, such as knowledge lag, poor adaptability, and insufficient interpretability. Summary of the Invention

[0010] This invention proposes a financial analysis system and method based on retrieval-enhanced generation and reflective dynamic optimization. It solves the problems existing in the field of financial data analysis, such as the lack of systematic architecture due to fragmented research, the "illusion" phenomenon caused by the lack of domain expertise in general large language models, the difficulty of static knowledge systems to adapt to the dynamic changes in the financial regulatory environment, and the lack of auditability of decision-making processes caused by the lack of a complete reflective recording mechanism in existing intelligent agent systems.

[0011] The financial analysis system based on retrieval enhancement generation and reflective dynamic optimization of this invention includes: Data layer: includes at least three types of data storage units, namely a dynamic knowledge base for storing authoritative knowledge in the financial field, a business database for structured storage of financial data uploaded by users, and a log database for storing financial analysis task processing logs; among them, the financial analysis task processing logs are automatically updated to record the processing process and results of each financial analysis task; Interaction Layer: Receives user natural language queries and uploaded financial data; visualizes the processing results of each financial analysis task; determines the query type of user natural language queries to make routing decisions. If the query type is a query requiring financial knowledge, it will be treated as a financial analysis task, and the retrieval enhancement generation module will be called to retrieve the dynamic knowledge base. If the query type does not require financial knowledge, it will be treated as a regular question-and-answer task, and the large language model will be directly called to generate the answer without calling the retrieval enhancement generation module. Core functional layer: includes a search enhancement generation module and a reflection-based dynamic optimization module; The retrieval enhancement generation module: based on the user's natural language query, retrieves relevant knowledge blocks from the dynamic knowledge base to obtain retrieval results; based on the user's natural language query, retrieval results, and guidance prompts generated by the reflection dynamic optimization module for each financial analysis task, obtains an enhanced contextual input large language model to generate the processing results for each financial analysis task; The reflection and dynamic optimization module generates guidance prompts for each financial analysis task; evaluates the processing results of each financial analysis task; and iteratively optimizes the generation parameters of the guidance prompts based on the evaluation results to generate guidance prompts for the next financial analysis task.

[0012] Furthermore, a preferred implementation is provided, wherein the dynamic knowledge base of the data layer is constructed using the following method: Knowledge document upload steps: Receive multi-format financial knowledge documents; the multi-format financial knowledge documents store three types of financial knowledge: publicly available authoritative knowledge, internal corporate knowledge, and professionally interpreted knowledge; the multi-format financial knowledge documents are collected based on the principles of authority, timeliness, and relevance, and are obtained after integrity verification and sensitive information filtering; Knowledge structuring steps: Natural language processing technology is used to parse and segment the multi-format financial knowledge documents, and metadata is extracted to form structured knowledge blocks; Vectorization indexing steps: The structured knowledge blocks are converted into high-dimensional vectors, and a vector index is constructed to support hybrid retrieval strategies; the hybrid retrieval strategies support the hybrid retrieval of semantic information and keywords.

[0013] Furthermore, a preferred embodiment is provided, wherein the retrieval enhancement generation module includes the following sub-modules: Query rewriting submodule: Parses the natural language query into standardized task instructions; Knowledge retrieval submodule: In response to the standardized task instructions, it retrieves relevant knowledge blocks from the dynamic knowledge base and obtains retrieval results; The prompt word constraint submodule generates prompt word constraints, which are used to ensure that the answer from the large language model must be based on the search results. Enhanced Generation Submodule: The standardized task instructions, user-uploaded financial data, search results, prompt word constraints, and guidance prompts for each financial analysis task generated by the reflection and dynamic optimization module are used as the enhanced context input to the large language model to generate the processing results for each financial analysis task. Source tracing submodule: For the processing results of each financial analysis task, mark the corresponding knowledge block source identifier.

[0014] Furthermore, a preferred implementation is provided, wherein the generation parameters of the guidance prompts include soft prompt vectors and reflective prompts; the financial analysis task is divided into multiple task types; the soft prompt vectors and reflective prompts correspond one-to-one with each task type; The retrieval enhancement generation module includes the following sub-modules: The soft cue vector optimization submodule evaluates the processing results of each financial analysis task for each task type generated by the large language model. If the evaluation results do not meet the given requirements, the soft cue vector corresponding to each task type is iteratively updated, and multiple reflection cue vectors corresponding to each task type are generated. The initial soft cue vector corresponding to each task type is randomly generated. The reflection example library update submodule: During the iterative update of the soft cue vectors corresponding to each task type, several reflection cue vectors corresponding to each task type are selected to form a reflection example sample corresponding to each task type, and the sample is automatically updated and recorded in the reflection example library. Controlled prompt generation submodule: Generates guidance prompts based on soft prompt vectors and reflective prompts corresponding to the task type of the financial analysis task.

[0015] Furthermore, a preferred embodiment is provided, wherein the soft cue vector optimization submodule is used to perform the following steps: Define performance rewards The processing results of each financial analysis task of each task type generated by the large language model are evaluated, and performance rewards are given. If the value is less than the given performance reward threshold, the soft cue vector is iteratively updated. Define diversity rewards , which represents the overlap rate of the reflective prompts generated by the large language model to evaluate the generated results during the multiple iterations of the processing results of each financial analysis task for each task type in the large language model. Performance bonus and diversity rewards Perform weighted combinations to obtain comprehensive rewards. ; Comprehensive rewards The soft cue vector is updated iteratively as the objective function; In each iteration update process: The CMA-ES algorithm is used to optimize the soft cue vectors corresponding to each task type in the previous iteration to obtain the soft cue vectors corresponding to each task type in the current iteration. The controlled prompt generation submodule is invoked to generate guidance prompts for this iteration update based on the soft prompt vectors corresponding to each task type in this iteration update and the reflection prompts extracted from the reflection example library. The retrieval enhancement generation module is invoked to generate an enhanced contextual input large language model for this iteration based on the guidance prompts of this iteration update, thereby obtaining the processing results of this iteration update for the financial analysis task; The large model used to evaluate the generated results is used to evaluate the processing results of this iteration of the financial analysis task, and the evaluation results and reflection prompts of this iteration are obtained. Based on the evaluation results of this iteration, the objective function for this iteration is calculated; The iteration ends when the given number of iterations is reached or the objective function value of the current iteration reaches the given objective function threshold. The soft cue vector corresponding to each task type that maximizes the objective function value is taken as the optimal soft cue vector corresponding to each task type at the end of the iteration update.

[0016] Furthermore, a preferred implementation method is provided, in which the financial analysis task is divided into three task types: data preprocessing task, financial indicator calculation task, and anomaly detection task; for each task type, a corresponding soft hint vector is designed: For data preprocessing tasks, the corresponding soft cue vector design is as follows: V fin1 = [Data integrity, data consistency, accounting period alignment, outlier detection, missing value imputation, account matching, format standardization, unit uniformity, data traceability, compliance, timeliness, accuracy, relevance, redundancy, effectiveness, logic]; For the task of calculating financial indicators, the corresponding soft cue vector is designed as follows: V fin2 = [Formula correctness, data source compliance, calculation steps transparency, unit conversion accuracy, beginning and ending data matching, year-on-year / month-on-month benchmark correctness, indicator caliber consistency, abnormal fluctuation identification, calculation result verification, rule compliance, parameter setting rationality, result reproducibility, logical coherence, error range control, basis traceability, result rationality]; For anomaly detection tasks, the corresponding soft hint vector is designed as follows: V fin3= [Balance of cross-references, consistency of trends, reasonable numerical range, identification of anomaly causes, completeness of verification rules, comparison of historical data, matching of industry benchmarks, compliance, risk level assessment, analysis of the impact of anomalies, transparency of verification steps, interpretability of results, data traceability, timeliness of rules, error tolerance, and feasibility of correction suggestions].

[0017] This invention also proposes a financial analysis method based on retrieval enhancement generation and reflective dynamic optimization, the method comprising the following steps: Obtain users' natural language queries and uploaded financial data; The system determines the query type of a user's natural language query in order to make routing decisions. If the query type does not require financial knowledge, it will be treated as a regular question-and-answer task, and the large language model will be used to generate the answer directly. If the query type is a query requiring financial knowledge, it will be treated as a financial analysis task. Based on the user's natural language query, relevant knowledge blocks from authoritative financial experts will be retrieved to obtain the search results. The guidance prompts for this financial analysis task are generated using soft cue vectors and reflective prompts. The soft cue vectors are first randomly generated and then iteratively updated based on the evaluation results of previous financial analysis tasks and in conjunction with the CMA-ES algorithm. The reflective prompts are generated when the processing results of previous financial analysis tasks are evaluated using a large model used to evaluate the generated results. Based on the user's natural language query, retrieval results, and guidance prompts for this financial analysis task, an enhanced contextual input large language model is obtained to generate the processing results for this financial analysis task. The processing results of this financial analysis task are evaluated using a large model for evaluating the generated results. If the evaluation results do not meet the given requirements, the CMA-ES algorithm is used to iteratively update the soft cue vector and generate new reflection cue.

[0018] The present invention also proposes a computer device comprising: a processor and a memory, the memory for storing executable instructions of the processor, the processor being configured to execute the aforementioned financial analysis method based on retrieval enhancement generation and reflective dynamic optimization by executing the executable instructions.

[0019] The present invention also proposes a computer storage medium storing a computer program, which, when executed, performs the aforementioned financial analysis method based on retrieval enhancement generation and reflective dynamic optimization.

[0020] The present invention also proposes a computer program product, including a computer program / instruction that, when executed by a processor, implements the steps of the financial analysis method based on retrieval enhancement generation and reflective dynamic optimization described above.

[0021] The present invention has the following beneficial effects: 1. The financial analysis system based on retrieval-enhanced generation and reflective dynamic optimization described in this invention constructs a domain knowledge-enhanced retrieval-enhanced generation (RAG) module, including the construction of a dynamic knowledge base (collecting multi-format financial knowledge documents based on the principles of authority, timeliness, and relevance, and then parsing, segmenting, and vectorizing the documents) and a hybrid retrieval strategy (hybrid retrieval of semantic information and keywords). This ensures that the professional knowledge injected into the context of a large language model is updated in real time and of high quality, thus solving the problem of knowledge lag. Specifically, the dynamic knowledge base dynamically integrates the latest policies (such as revisions to accounting standards) and financial knowledge data, avoiding the inability to obtain the latest information due to outdated data and improving the timeliness of financial analysis.

[0022] 2. The financial analysis system based on retrieval enhancement generation and reflective dynamic optimization described in this invention, through the query rewriting submodule (which parses the user's natural language query into standardized task instructions), the knowledge retrieval submodule (which retrieves Top-K relevant knowledge blocks from a dynamic knowledge base), and the prompt word constraint submodule (which generates constraints such as "the answer must be based on the retrieval results") in the retrieval enhancement generation module, forces the output of the large language model to strictly depend on the retrieval results, avoiding the illusion phenomenon; by retrieving authoritative knowledge bases in real time to replace the model's built-in memory, it reduces output bias and ensures the accuracy and reliability of financial analysis results.

[0023] 3. The financial analysis system based on retrieval enhancement generation and reflective dynamic optimization described in this invention incorporates publicly available authoritative knowledge (such as the "Accounting Standards for Business Enterprises"), internal corporate knowledge (such as corporate financial systems), and professionally interpreted knowledge (such as accounting firm manuals) into the construction of a dynamic knowledge base. Combined with the standardized processing of the query rewriting sub-module, the knowledge base covers both general norms and adapts to specific corporate needs, thereby enhancing its professionalism and specialization. Through the diversity and personalized configuration of knowledge sources, it ensures that the language model's answers conform to industry standards while closely integrating with internal corporate practices, thus improving the relevance of financial analysis.

[0024] 4. The financial analysis system based on retrieval enhancement generation and reflective dynamic optimization described in this invention automatically marks the knowledge block source identifier corresponding to each key conclusion in the financial analysis task processing results through the source tracing submodule, and records the complete operation trajectory (including data input, processing steps and intermediate results) in combination with the log database, which can realize the transparency and traceability of the decision-making process; through visualized sources and complete logs, it supports users to reverse verify the analysis conclusions, enhancing the auditability and trustworthiness of the results.

[0025] 5. The financial analysis system based on retrieval enhancement generation and reflective dynamic optimization described in this invention enhances the ability to correct complex tasks through a soft cue vector optimization submodule (which iteratively updates the soft cue vector using the CMA-ES algorithm and optimizes the distribution parameters based on performance rewards and diversity rewards), a controlled cue generation submodule (which generates dynamic guidance cue based on the soft cue vector and the reflective example library), and task type adaptive design. Through continuous self-examination and error correction, the system dynamically adapts to changes in the financial environment (such as standard updates), solving the problem of the universality of static cue and enhancing the stability of multi-step analysis tasks.

[0026] The financial analysis system and method based on retrieval enhancement generation and reflective dynamic optimization described in this invention are applicable to scenarios such as enterprise financial data analysis, regulatory compliance inspection, and multi-source structured financial data processing. They can effectively handle natural language queries, accounting standard updates, complex multi-step reasoning tasks, and financial decision support requiring high interpretability. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the embodiments 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 from these drawings without creative effort.

[0028] Figure 1 This is a schematic diagram of the structure of a financial analysis system based on retrieval enhancement generation and reflective dynamic optimization in one embodiment of the present invention; Figure 2 This is a flowchart of the soft hint vector optimization submodule of the reflection dynamic optimization module in one embodiment of the present invention. Detailed Implementation

[0029] To make the technical solutions and advantages of the present invention clearer, the specific embodiments of the present invention will be described in further detail and completely below with reference to the accompanying drawings. The various embodiments described below are only some preferred embodiments of the present invention, and not all of them; the various embodiments described below are intended to explain the present invention and should not be construed as limiting the present invention; reasonable combinations of the technical features defined in the various embodiments of the present invention, as well as all other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort, are all within the scope of protection of the present invention.

[0030] Implementation Method 1: A financial analysis system based on retrieval enhancement generation and reflective dynamic optimization, the system comprising: Data layer: includes at least three types of data storage units, namely a dynamic knowledge base for storing authoritative knowledge in the financial field, a business database for structured storage of financial data uploaded by users, and a log database for storing financial analysis task processing logs; among them, the financial analysis task processing logs are automatically updated to record the processing process and results of each financial analysis task; Interaction Layer: Receives user natural language queries and uploaded financial data; visualizes the processing results of each financial analysis task; determines the query type of user natural language queries to make routing decisions. If the query type is a query requiring financial knowledge, it will be treated as a financial analysis task, and the retrieval enhancement generation module will be called to retrieve the dynamic knowledge base. If the query type does not require financial knowledge, it will be treated as a regular question-and-answer task, and the large language model will be directly called to generate the answer without calling the retrieval enhancement generation module. Core functional layer: includes a search enhancement generation module and a reflection-based dynamic optimization module; The retrieval enhancement generation module: based on the user's natural language query, retrieves relevant knowledge blocks from the dynamic knowledge base to obtain retrieval results; based on the user's natural language query, retrieval results, and guidance prompts generated by the reflection dynamic optimization module for each financial analysis task, obtains an enhanced contextual input large language model to generate the processing results for each financial analysis task; The reflection and dynamic optimization module generates guidance prompts for each financial analysis task; evaluates the processing results of each financial analysis task; and iteratively optimizes the generation parameters of the guidance prompts based on the evaluation results to generate guidance prompts for the next financial analysis task.

[0031] In this embodiment, the financial analysis system is built on an intelligent agent, and therefore can also be called a financial analysis intelligent agent system, or simply a financial intelligent agent.

[0032] In this embodiment, the financial analysis system adopts a "layered modular" architecture, which is divided into an interaction layer, a core function layer, and a data layer from top to bottom. Each layer realizes data flow (or data interaction) and function call through the workflow orchestration function of the cognitive AIP platform.

[0033] In this implementation, the data layer is divided into three types of data storage units: a dynamic knowledge base (stores authoritative knowledge in the financial field), a business database (stores financial data uploaded by users), and a log database (stores financial analysis task processing logs), and supports hierarchical access according to user permissions.

[0034] In this embodiment, the log database of the data layer is implemented based on the log recording function of the cognitive AIP platform.

[0035] In this embodiment, the processing logs of financial analysis tasks in the log database are automatically updated to record the processing process and results of each financial analysis task. Through the logging function of the AIP platform, the complete operation trajectory of each financial analysis task is automatically collected, including the following information: data input information, processing step information, intermediate result information, and execution result information. Among these: Data input information: The data entered by the user when processing each financial analysis task, such as the natural language query entered by the user; Processing step information: Information on intermediate processing steps when processing each financial analysis task, such as calling the retrieval enhancement generation module; Intermediate result information: During each financial analysis task, intermediate processing result information, such as search results, keyword constraints, and standardized task instructions; Execution result information: The final output information for each financial analysis task, such as the financial analysis task processing result.

[0036] In this implementation, the interaction layer provides natural language input (text box input), file upload (supports file formats such as .xlsx / .xls / .txt / docx, with a maximum single file size of 50MB, and the file stores the uploaded financial data), and result output (text reports, interactive charts, i.e., visually displaying the processing results of financial analysis tasks).

[0037] Among them, the natural language input supports common financial language, and the system automatically performs subsequent intent recognition (i.e. query type judgment for routing decision) and language standardization (i.e., parsing the natural language query into standardized task instructions).

[0038] In this implementation, the user's natural language query is analyzed to determine the query type in order to make routing decisions: After a user inputs a natural language query through the interaction layer, before searching the dynamic knowledge base, the "routing decision-maker" (implemented based on the prompt word arrangement function of the cognitive AIP platform) first determines the query type and decides whether to call the search enhancement generation module for retrieval. If the query type requires financial knowledge (such as general financial knowledge or enterprise-specific knowledge), the retrieval enhancement generation module will be triggered. If the query type does not require financial knowledge (such as ordinary chat or simple calculations that do not require financial knowledge), the large language model (such as qwen3-72B) will be directly called to generate the answer without triggering a search.

[0039] In routing decisions, a pre-packaged question classifier in the cognitive AIP platform can be used for classification, and the query type can be determined based on the classification results; for example, user-submitted questions can be divided into the following three categories: ①Users require calculations, analysis, graphing, or report generation based on file data and accounting standards; ② The questions raised by users are essentially inquiries about accounting standards; the document data is merely used as background or examples for the questions. ③ The user requests that a diagram be drawn based on the file data.

[0040] Among them, questions of type ① and ② require financial knowledge; questions of type ③ do not require financial knowledge.

[0041] In this embodiment, the core functional layer includes two core modules: the retrieval enhancement generation module and the reflection dynamic optimization module. The retrieval enhancement generation module, or RAG (retrieval enhancement generation) based domain knowledge enhancement module, is also referred to as the domain knowledge enhancement module.

[0042] The aforementioned reflection-based dynamic optimization module, also known as the reflection-based dynamic optimization prompt module or the reflection-based optimization and prompt generation module.

[0043] Each module is linked together through the workflow orchestration function of the cognitive AIP platform to achieve a closed-loop process of "data input → preprocessing → knowledge enhancement analysis → reflection and verification → result generation".

[0044] In this embodiment, the guidance prompts are used to instruct the large language model on how to handle different types of financial analysis tasks (financial analysis tasks are divided into many different types).

[0045] In this embodiment, the cognitive AIP platform is an integrated low-code / no-code platform for building, deploying, and managing AI agents. The core goal of this type of platform is to lower the barrier to AI application development, enabling the rapid construction of domain-specific agents through visual tools (such as workflow orchestration, knowledge base management, and prompt word design). Common cognitive AIP platforms include dify, Coze, and Palantir AIP. Cognitive AIP platforms offer a variety of modular functionalities: Ontology-driven architecture: Transforms enterprise data and business logic into a unified digital twin, enabling AI to understand business semantics.

[0046] Multi-model collaboration: Supports the integration of multiple AI models (such as LLM and SLM) and dynamic scheduling according to tasks.

[0047] Security and Governance: Provides functions such as data access control and audit trail.

[0048] In this embodiment, the modular functions provided by the cognitive AIP platform include network service request function, workflow orchestration function, problem classifier function, knowledge base function, knowledge retrieval node (or large model node) function, prompt word orchestration function, and log recording function.

[0049] Implementation Method 2: The dynamic knowledge base of the data layer is constructed using the following method: Knowledge document upload steps: Receive multi-format financial knowledge documents; the multi-format financial knowledge documents store three types of financial knowledge: publicly available authoritative knowledge, internal corporate knowledge, and professionally interpreted knowledge; the multi-format financial knowledge documents are collected based on the principles of authority, timeliness, and relevance, and are obtained after integrity verification and sensitive information filtering; Knowledge structuring steps: Natural language processing technology is used to parse and segment the multi-format financial knowledge documents, and metadata is extracted to form structured knowledge blocks; Vectorization indexing steps: The structured knowledge blocks are converted into high-dimensional vectors, and a vector index is constructed to support hybrid retrieval strategies; the hybrid retrieval strategies support the hybrid retrieval of semantic information and keywords.

[0050] In this embodiment, the dynamic knowledge base is a dynamic knowledge base of financial knowledge.

[0051] In this embodiment, the principle of authority means that multi-format financial knowledge documents are collected from authoritative sources.

[0052] For publicly available authoritative knowledge, its multi-format financial knowledge documents are collected from the official websites of relevant regulatory organizations (such as the government and securities regulatory commissions).

[0053] For internal corporate knowledge, its multi-format financial knowledge documents are collected from the company's finance department.

[0054] For professional interpretation of knowledge, its multi-format financial knowledge documents are collected from well-known accounting firms (professional interpretation channels).

[0055] In this embodiment, the timeliness principle refers to the fact that multi-format financial knowledge documents are collected from data from the most recent few years (such as one year or five years).

[0056] In this embodiment, the relevance principle means that the multi-format financial knowledge documents record financial knowledge-related content.

[0057] In this implementation, the original multi-format financial knowledge documents are collected based on the principles of authority, timeliness and relevance. These documents need to be verified for integrity and filtered for sensitive information before they can be used to build a dynamic knowledge base.

[0058] In this embodiment, the acquisition and filtering of the multi-format financial knowledge documents can be summarized as follows: Collect original, multi-format financial knowledge documents related to financial knowledge that have been published in recent years from authoritative sources (such as official sources, internal corporate channels, and professional interpretation channels); The original multi-format financial knowledge document is subjected to integrity verification and sensitive information filtering to obtain a multi-format financial knowledge document.

[0059] In this embodiment, the knowledge sources of the dynamic knowledge base must meet the principles of "authoritativeness, timeliness, and relevance," specifically including the following categories and acquisition methods: Publicly available authoritative knowledge includes: the Accounting Standards for Business Enterprises and its application guidelines (such as the latest version from the Ministry of Finance's official website; where "Ministry of Finance's official website" meets the principle of authority, "Accounting Standards for Business Enterprises and its application guidelines" meets the principle of relevance, and "the latest version" meets the principle of timeliness), the General Rules for Corporate Finance, International Financial Reporting Standards (such as IFRS 202x, i.e., the latest version), and the financial information disclosure rules issued by the China Securities Regulatory Commission. These documents are downloaded in batches in PDF format and manually verified to ensure completeness (no missing pages, no garbled characters), i.e., completeness verification.

[0060] Internal corporate knowledge includes: the company's internal financial management system (such as expense reimbursement standards and fixed asset depreciation policies), annual financial statements (such as the balance sheets, profit and loss statements, and cash flow statements for the most recent 5 years, audited versions), and historical financial analysis reports. The above financial knowledge data is provided by the company's finance department in Excel or Word format, and sensitive information is removed (i.e., sensitive information filtering, such as removing employee salary details) before being included in the knowledge base.

[0061] Professional interpretation of knowledge: Financial indicator interpretation manuals and industry financial analysis white papers published by well-known accounting firms are available through official websites or authorized databases, ensuring that the content was published within the last year (to avoid outdated knowledge).

[0062] In this embodiment, the structured processing and vectorization of multi-format financial knowledge documents are performed as follows: For the structural features of financial documents (such as tables, clause-style paragraphs, and multi-chapter logic), the knowledge is processed through "blocking - metadata annotation - vectorization". The specific steps and parameters are as follows: Document parsing and segmentation: Utilizing the knowledge base function of the Cognitive AIP platform to parse PDF / Word / Excel format documents (i.e., multi-format financial knowledge documents), extracting text content (converting tables to Markdown format text, retaining row and column headings); manually annotating data ensures the integrity of knowledge in each chapter during segmentation.

[0063] Dynamic knowledge base settings: adopt the high-quality indexing mode of the bge-m3 model, execute a hybrid retrieval scheme, set the weight of semantic (information) to keywords to 0.7:0.3, and select the top 5 retrieval scheme.

[0064] Implementation Method 3: The retrieval enhancement generation module includes the following sub-modules: Query rewriting submodule: Parses the natural language query into standardized task instructions; Knowledge retrieval submodule: In response to the standardized task instructions, it retrieves relevant knowledge blocks from the dynamic knowledge base and obtains retrieval results; The prompt word constraint submodule generates prompt word constraints, which are used to ensure that the answer from the large language model must be based on the search results. Enhanced Generation Submodule: The standardized task instructions, user-uploaded financial data, search results, prompt word constraints, and guidance prompts for each financial analysis task generated by the reflection and dynamic optimization module are used as the enhanced context input to the large language model to generate the processing results for each financial analysis task. Source tracing submodule: For the processing results of each financial analysis task, mark the corresponding knowledge block source identifier.

[0065] In this implementation, query rewriting and standardization are performed as follows: To address the "ambiguity" of users' natural language queries, the query rewriting submodule (or query rewriter) converts users' natural language queries into standardized queries with "technical terms + clear requirements," thereby improving retrieval accuracy.

[0066] In this implementation, the query rewriting submodule (or query rewriter) is implemented using a large language model specifically designed for writing standardized queries. The user's natural language query and the prompt words used to transcribe the natural language query into a standardized query are input into a large language model specifically designed for writing standardized queries, which then generates a standardized query as a standardized task instruction. The large language model specifically designed for writing standardized queries is generated by the standardized query suggestion word generation module.

[0067] The standardized query suggestion generation module, the reflective dynamic optimization module, and other various suggestion generation modules together form a "suggestion generator"; the "suggestion generator" is used to generate various suggestion words for use by large language models that process different question-answering tasks.

[0068] In this embodiment, the knowledge retrieval submodule: utilizes the knowledge retrieval nodes within the cognitive AIP platform to achieve hybrid retrieval based on pre-configured schemes in the dynamic knowledge base. Specifically: The standardized task instructions are subjected to deep semantic parsing and reconstruction to generate standardized query vectors suitable for knowledge base retrieval. A hybrid retrieval strategy is executed, which performs semantic similarity matching and keyword matching between the normalized query vector and the knowledge blocks in the dynamic knowledge base, and selects the most relevant given knowledge blocks (such as the top-K most relevant knowledge blocks) as relevant knowledge blocks to obtain retrieval results.

[0069] In this implementation, the prompt word constraint is as follows: To ensure that the large language model's answers are strictly based on relevant knowledge blocks retrieved from the dynamic knowledge base, enhanced generation is achieved by combining prompt word constraints.

[0070] The cue word constraint itself is also a cue word, which is generated by the constraint cue word generation module, for example: "Answer must be based on search results".

[0071] The constraint prompt word generation module is integrated into the "Prompt Word Generator".

[0072] In this embodiment, the source tracing submodule is as follows: To ensure that the answers from the large language model are traceable to their sources, after the answers are generated, the source tracing submodule automatically marks the source identifier of the knowledge block corresponding to each key statement at the end of the answer result. Users can click on the source identifier to view the original text of the relevant knowledge block in the dynamic knowledge base (visualized in the interactive layer).

[0073] In this embodiment, the knowledge retrieval process of the dynamic knowledge base is as follows: A three-step strategy of "routing decision-query rewriting-hybrid retrieval" is adopted to ensure accurate location of knowledge blocks (or knowledge fragments) that match the user's question from the dynamic knowledge base. The specific implementation logic is as follows: (1) Routing decision: After a user inputs a natural language query through the interaction layer, the system first analyzes the user's intent to determine the query type and makes a routing decision to determine whether a retrieval from the dynamic knowledge base is necessary. If the query type is a query requiring financial knowledge, then a search of the dynamic knowledge base will be triggered; If the query type does not require financial knowledge, the large language model will be used directly to generate the answer without triggering a search.

[0074] (2) Query rewriting and standardization: To address the "ambiguity" of users' natural language queries, a query rewriter is used to transform them into standardized queries (standardized task instructions) that combine "technical terms + clear requirements," thereby improving retrieval accuracy.

[0075] (3) Hybrid retrieval and result filtering: Based on standardized queries, a hybrid retrieval is performed on the dynamic knowledge base, and the retrieval results are filtered based on the pre-configuration of the dynamic knowledge base.

[0076] Implementation Method 4: The parameters for generating guidance prompts include soft prompt vectors and reflective prompts; financial analysis tasks are divided into multiple task types; the soft prompt vectors and reflective prompts correspond one-to-one with each task type. The retrieval enhancement generation module includes the following sub-modules: The soft cue vector optimization submodule evaluates the processing results of each financial analysis task for each task type generated by the large language model. If the evaluation results do not meet the given requirements, the soft cue vector corresponding to each task type is iteratively updated, and multiple reflection cue vectors corresponding to each task type are generated. The initial soft cue vector corresponding to each task type is randomly generated. The reflection example library update submodule: During the iterative update of the soft cue vectors corresponding to each task type, several reflection cue vectors corresponding to each task type are selected to form a reflection example sample corresponding to each task type, and the sample is automatically updated and recorded in the reflection example library. Controlled prompt generation submodule: Generates guidance prompts based on soft prompt vectors and reflective prompts corresponding to the task type of the financial analysis task.

[0077] In this embodiment, the initial soft cue vector corresponding to each task type, that is, the soft cue vector generated by the large language model before the processing result of the first financial analysis task of each task type, is randomly generated.

[0078] For example, let's say financial analysis tasks are divided into three types: data preprocessing tasks, financial indicator calculation tasks, and anomaly detection tasks. Before the processing result of the first data preprocessing task generated by the large language model, the initial soft cue vector corresponding to the data preprocessing task is randomly generated; thereafter, the soft cue vector corresponding to the data preprocessing task is iteratively updated based on the evaluation result of each data preprocessing task. Similarly, the initial soft hint vectors for the financial indicator calculation task and the initial soft hint vectors for the anomaly verification task are also randomly generated.

[0079] It should be noted that the initial soft hint vector does not refer to the soft hint vector at the start of the iteration. The soft hint vector at the start of this iteration is the soft hint vector after the previous iteration update.

[0080] For example, suppose this iteration update is after the 21st data preprocessing task; in the 20th and 19th data preprocessing tasks, no iteration update was performed because the evaluation results met the predetermined requirements; then the last iteration update of the soft cue vector was performed after the 18th data preprocessing task; then the soft cue vector obtained by the iteration update after the 18th data preprocessing task is used as the soft cue vector at the beginning of this iteration update.

[0081] In this implementation, the controlled prompt generation submodule is invoked in two situations to generate guidance prompts: In one scenario, when the retrieval enhancement generation module needs to generate enhanced context, it calls the controlled generation prompt submodule to generate guidance prompts, which, along with other types of prompt words, form an enhanced context input to the large language model to obtain the processing results of this financial analysis task.

[0082] Another scenario involves the soft cue vector optimization submodule iteratively updating the soft cue vector: It calls the controlled cue generation submodule to generate guidance cue, which, along with other types of cue words, forms an enhanced contextual input to the large language model to obtain the iterative processing results for this financial analysis task; then, the iterative processing results are evaluated, and the soft cue vector is adjusted based on the evaluation results. New guidance cue is then generated based on the adjusted soft cue vector, and this is input into the large language model again, iterating repeatedly until a given number of iterations is reached or a given condition is met, resulting in the updated soft cue vector.

[0083] In this embodiment, the log database is also used to store a reflection example library. The reflection example library is automatically updated to record reflection prompts obtained after each financial analysis task. During the iterative optimization of soft cue vectors, several reflection cue are selected to construct reflection example samples for each financial analysis task and stored in the reflection example library.

[0084] In this implementation, since the prompt words of the large language model have limited length, the main selection criteria for constructing reflection example samples are short length and few words.

[0085] In this implementation, the processing results of each financial analysis task for each task type generated by the large language model are evaluated: The large model used to evaluate the generated results is used for evaluation to obtain evaluation results and reflection prompts.

[0086] If the evaluation results do not meet the given requirements, the CMA-ES algorithm is used to iteratively optimize the soft cue vectors corresponding to each task type, thereby indirectly optimizing the generated guidance cue.

[0087] In this embodiment, the controlled prompt generation submodule uses a small language model (such as SLM) to generate guidance prompts based on soft prompt vectors and reflective prompts.

[0088] Before iteratively updating (optimizing) the soft cue vector: Task type identification: Before the start of iterative optimization, the task type (such as data preprocessing) is automatically identified based on the current workflow node (such as the data preprocessing completion node or the indicator calculation completion node). Soft cue selection and activation: In the initial stage of iterative optimization, select the corresponding soft cue vector according to the task type, and activate the vector element representing the "key constraint point of the task" (using a value between 0 and 1 to express the importance of the constraint point). Example selection: Randomly select several sets of reflection example samples of the same task type from the reflection example library, extract the "reflection tips" part of the reflection example samples, and use them as demonstration examples; Dynamic cue concatenation: The activated soft cue vector, demonstration example, and current task information (such as the current task type) are concatenated and then input into a small language model (such as SLM) to generate dynamically optimized guidance cue.

[0089] The guidance prompts are used to construct an enhanced contextual input large language model, and the output results of the large language model are obtained for further evaluation.

[0090] Implementation Method 5: The soft cue vector optimization submodule is used to perform the following steps: Define performance rewards The processing results of each financial analysis task of each task type generated by the large language model are evaluated, and performance rewards are given. If the value is less than the given performance reward threshold, the soft cue vector is iteratively updated. Define diversity rewards , which represents the overlap rate of the reflective prompts generated by the large language model to evaluate the generated results during the multiple iterations of the processing results of each financial analysis task for each task type in the large language model. Performance bonus and diversity rewards Perform weighted combinations to obtain comprehensive rewards. ; Comprehensive rewards The soft cue vector is updated iteratively as the objective function; In each iteration update process: The CMA-ES algorithm is used to optimize the soft cue vectors corresponding to each task type in the previous iteration to obtain the soft cue vectors corresponding to each task type in the current iteration. The controlled prompt generation submodule is invoked to generate guidance prompts for this iteration update based on the soft prompt vectors corresponding to each task type in this iteration update and the reflection prompts extracted from the reflection example library. The retrieval enhancement generation module is invoked to generate an enhanced contextual input large language model for this iteration based on the guidance prompts of this iteration update, thereby obtaining the processing results of this iteration update for the financial analysis task; The large model used to evaluate the generated results is used to evaluate the processing results of this iteration of the financial analysis task, and the evaluation results and reflection prompts of this iteration are obtained. Based on the evaluation results of this iteration, the objective function for this iteration is calculated; The iteration ends when the given number of iterations is reached or the objective function value of the current iteration reaches the given objective function threshold. The soft cue vector corresponding to each task type that maximizes the objective function value is taken as the optimal soft cue vector corresponding to each task type at the end of the iteration update.

[0091] In this embodiment, the soft suggestion vector optimization submodule generates dynamic guidance prompts that "adapt to the task type of the current financial analysis task", avoiding the "general redundancy" of static prompts.

[0092] In this implementation, performance bonus The value range is from 0 to 1 (inclusive). In this implementation, performance bonus Evaluation can be based on a single generation result of a large language model, or on multiple generation results of a large language model.

[0093] Each evaluation is conducted either manually or using a large model to evaluate the generated results.

[0094] In this implementation, if performance bonus Evaluation is based on the single-generation results of a large language model: The large model used to evaluate the generated results scores the processing results of this financial analysis task generated by the large language model. The score ranges from 0 to 1 (inclusive). The score is based on the degree of fit between the processing results of this financial analysis task generated by the large language model and the rules, i.e., rule verification is performed, which includes three categories of rules: "correctness of financial formulas, data compliance, and logical coherence". If the rules are fully compliant, the score is 1.

[0095] If the score is lower than a given performance reward threshold (a score value), the soft cue vector is iteratively optimized.

[0096] In this implementation, if performance bonus Evaluation is based on the single-generation results of a large language model: Performance Bonus The success rate of the task is calculated based on reflection, and its value ranges from 0 to 1, including both 0 and 1.

[0097] The success rate of the task after reflection = the number of times the result generated by the large language model passes the rule validation / the number of times the large language model is generated (or the total number of reflections).

[0098] In this situation: Based on the same enhanced context, the large language model generates the processing results of this financial analysis task multiple times.

[0099] The degree of matching between the result generated by the large language model and the rule is evaluated (e.g., by scoring the result using the large model used to evaluate the generated result). If the evaluation result is greater than the given value, the result generated by the large language model is considered to have passed the rule validation. The number of times the generated results of the large language model pass the rule validation is summarized and compared with the total number of large language model generation times. If the ratio is lower than the given performance reward threshold (a ratio), the soft suggestion vector is iteratively optimized.

[0100] In this embodiment, during the process of using a large model to evaluate the generated results to score the processing results of the financial analysis task generated by the large language model, the large model used to evaluate the generated results will also generate reflection prompts (expressed in natural language), or reflection suggestions, which are suggestions given by the large model used to evaluate the generated results. The purpose of these suggestions is to make the processing results of the financial analysis task generated by the large language model more in line with the rules.

[0101] In this implementation, diverse rewards The value range is from 0 to 1 (inclusive). In this implementation, diverse rewards Calculated based on the "keyword diversity of reflection prompts": Extract keywords from the reflection prompts and calculate the keyword overlap rate between the reflection prompts and the keywords from the previous 10 reflection prompts in the iteration. The lower the overlap rate, the higher the diversity. When the overlap rate = 0, a diversity bonus is awarded. =1; When overlap rate = 1, diversity reward =0.

[0102] In this implementation method, comprehensive rewards Performance bonus and diversity rewards The weighted combination yields, where: The balancing factor is set to 0.3, prioritizing performance.

[0103] In this implementation, the soft cue vector is updated iteratively: Optimization parameters: The soft cue vector to be optimized is a low-dimensional continuous vector, denoted as: ℝ d , of which: ℝ d Let represent the d-dimensional real space, ℝ represent the set of all real numbers, and d represent the dimension of a low-dimensional continuous vector.

[0104] Objective function: Define the objective function ℝ d This function indicates when soft cue vectors (or strategy encoding) are used. ) At that time, the processing results of this financial analysis task generated by the large language model are evaluated, and the comprehensive reward obtained is determined. (Including performance bonuses and diversity bonuses).

[0105] Optimization objective: Find the optimal soft cue vector This maximizes the objective function value.

[0106] In this implementation, the CMA-ES algorithm is used to optimize the soft cue vectors corresponding to each task type updated in the previous iteration. Specifically, the soft cue vector optimization employs a covariance matrix adaptive evolution strategy (CMA-ES) for iterative optimization, maximizing the overall reward through the objective function. The CMA-ES algorithm (or CMA-ES optimization engine) optimizes soft cue vectors by simulating natural evolutionary processes such as selection, mutation, and recombination. Its core is to iteratively update a multivariate normal distribution describing the solution distribution: ,in, For algebra; to gradually shift the distribution toward the high-performance region: Initialization: Before optimization begins (the first...) (e.g., initialize a multivariate normal distribution); distribution parameters include: mean vector (Usually set as the zero vector or the soft hint vector at the start of an iteration, representing the current search center point), step size (Set the initial step size to a small value (e.g., 1.0) to control the sampling radius / search range; a larger step size results in a wider search range, but may reduce efficiency), and the covariance matrix. (Usually set as an identity matrix, representing independent dimensions with equal variance, i.e., isotropic distribution, used to provide a uniform starting point for the search); The population size is also set. (i.e., the number of candidate solutions generated in each generation); Sampling: in each generation (i.e., each iteration update) from the current distribution Medium sampling Each candidate solution (offspring) generates (Candidate) soft cue vectors Each candidate soft cue vector is obtained through the formula The result is equivalent to a random perturbation around the current mean; Evaluation: For each candidate soft cue vector Call the controlled generation prompt submodule to generate each child... In conjunction with reflective prompts, guidance prompts for natural language descriptions are generated; then, a financial analysis task is performed by retrieving the enhanced generation module (generating enhanced context) and the large language model to obtain the processing results. The objective function value of the results (i.e., the comprehensive reward R, including performance and diversity rewards) is evaluated as follows: objective function value This indicates the fitness of the vector; Selection: Based on the objective function value Sort the children from largest to smallest, and select the optimal one (i.e., the one with the largest objective function value). indivual( The solution is composed of a dominant group; these vectors represent the current high-performance region. Distribution Update: The distribution parameters (mean, step size, and covariance matrix) are updated using the dominant population to make the distribution more focused on high-performance areas; the update formula includes: (1) Mean update: New mean The distribution center is shifted towards high-performance regions by calculating a weighted average of the dominant groups; where the weights... Based on fitness; (2) Step size control: The step size is updated through the "evolutionary path". This enables adaptive adjustment of the search range; when the update directions of consecutive generations are consistent, the step size is increased (to accelerate convergence), otherwise the step size is decreased (to avoid oscillation and to perform a fine search). (3) Covariance matrix update: The covariance matrix is ​​also updated using the evolutionary path. This allows it to learn the shape of the objective function in space; for example, if the dominant group is distributed along a certain direction, the updated covariance matrix will give higher variance to that direction, thus enabling more searches along that direction in the future. ; in, , where are the learning rate parameters, This represents the evolutionary path (cumulative update direction) of the covariance matrix. This is the transformation vector for the dominant group.

[0107] By repeating the above steps, CMA-ES progressively optimizes the soft cue vector, ultimately outputting the historically optimal vector for generating efficient guidance cues. This process ensures the dynamic adaptability of reflective cues and solves the problem of static cue fixation.

[0108] In this embodiment, the CMA-ES algorithm optimizes the soft cue vector by sampling and updating using a multivariate normal distribution.

[0109] The multivariate normal distribution maintained by CMA-ES defines the probability distribution of the soft cue vector. The distribution parameters (mean, covariance matrix, and step size) collectively determine the search direction and solution space exploration strategy. For example, the covariance matrix encodes the correlation between variables; if certain constraints in the financial task (such as "data integrity" and "compliance") are correlated, covariance updates will guide the search along these correlations.

[0110] Each distribution update (mean, step size, covariance matrix) is based on the fitness feedback of the dominant group: Mean updates shift the distribution center toward the high-performance soft cue vector, essentially performing a "local search" that directly optimizes the vector's expected value. Covariance matrix updates learn the local shape of the objective function (like valleys or ridges), directing the search along high-performance directions and avoiding ineffective exploration. For example, if "formula correctness" is critical in a reflection task, covariance updates increase the variance in that direction. Step size controls the balance between global exploration and local development: increasing the step size broadens the search range, potentially discovering new optimal solutions; decreasing the step size focuses on fine-tuning local optimization. This updating gradually converges the distribution to the vicinity of the global optimum, optimizing the soft cue vector and maximizing the objective function (overall reward).

[0111] The distribution update in CMA-ES is essentially an adaptive adjustment of the soft cue vector optimization strategy. Through iteration, the distribution "learns" high-performance patterns of the soft cue vectors (such as which task constraints are important), thereby generating more effective guidance cues. This solves the aforementioned "static reflection pattern solidification problem," enabling the system to dynamically adapt to changes in the financial environment.

[0112] In this embodiment, in each generation of the CMA-ES algorithm, the candidate vectors sampled by the CMA-ES algorithm are... The vector is fed into the controlled generation prompt submodule; the controlled generation prompt submodule will then... Combined with reflection prompts, specific natural language guidance is generated. Reflection prompts are dynamically selected from a reflection example library to ensure professionalism.

[0113] In this implementation, during the evaluation process of the CMA-ES algorithm, the large language model uses the generated guidance prompts to perform a financial analysis task and obtains a reward score. .

[0114] In this embodiment, during the optimization loop process of the CMA-ES algorithm, the CMA-ES algorithm collects all optimization loops. Yes, update its internal distribution according to the above distribution update process; the updated distribution is used to sample the candidate vectors for the next generation.

[0115] In this implementation, during the optimization loop of the CMA-ES algorithm, the algorithm terminates when a given number of iterations is reached or the objective function value reaches a given objective function threshold, and outputs the historical best soft hint vector. And several corresponding reflection prompts.

[0116] In this embodiment, the soft cue vector optimization submodule (or optimizer) has the core function of "dynamically adjusting the soft cue vector used to generate guidance cue based on the evaluation feedback (or reflection) of the processing results of the financial analysis task", so as to ensure the "balance between effectiveness and diversity" of the obtained reflection cue.

[0117] Implementation Method 6: Financial analysis tasks are divided into three types: data preprocessing tasks, financial indicator calculation tasks, and anomaly detection tasks; for each task type, a corresponding soft hint vector is designed: For data preprocessing tasks, the corresponding soft cue vector design is as follows: V fin1 = [Data integrity, data consistency, accounting period alignment, outlier detection, missing value imputation, account matching, format standardization, unit uniformity, data traceability, compliance, timeliness, accuracy, relevance, redundancy, effectiveness, logic]; For the task of calculating financial indicators, the corresponding soft cue vector is designed as follows: V fin2 = [Formula correctness, data source compliance, calculation steps transparency, unit conversion accuracy, beginning and ending data matching, year-on-year / month-on-month benchmark correctness, indicator caliber consistency, abnormal fluctuation identification, calculation result verification, rule compliance, parameter setting rationality, result reproducibility, logical coherence, error range control, basis traceability, result rationality]; For anomaly detection tasks, the corresponding soft hint vector is designed as follows: V fin3= [Balance of cross-references, consistency of trends, reasonable numerical range, identification of anomaly causes, completeness of verification rules, comparison of historical data, matching of industry benchmarks, compliance, risk level assessment, analysis of the impact of anomalies, transparency of verification steps, interpretability of results, data traceability, timeliness of rules, error tolerance, and feasibility of correction suggestions].

[0118] In this embodiment, the vector elements in the soft hint vector (such as balanced correlation, consistent trend, reasonable numerical range, etc.) are the key constraints of the task, and the value range of each vector element is 0 to 1 (including the two endpoints 0 and 1).

[0119] For the initial soft cue vector corresponding to each task type, that is, the soft cue vector generated by the large language model before the processing result of the first financial analysis task of each task type, the values ​​of its vector elements are randomly generated.

[0120] Subsequently, the values ​​of the vector elements are iteratively updated using the soft hint vector optimization submodule.

[0121] In this implementation, the value of each vector element represents its importance in the soft hint vector; the higher the value, the more important it is. When the value of a vector element is 1, it indicates that the key constraint of the task represented by that vector element (such as formula correctness, accurate unit conversion, etc.) is the focus of the current financial analysis task. In this embodiment, the soft cue vector is a low-dimensional soft cue vector with a dimension d=16, which is suitable for optimizing the efficiency of structured financial tasks.

[0122] Implementation Method 7: The reflection prompts include the task type corresponding to the reflection prompts, the focus of the reflection prompts, and the keywords of the reflection prompts.

[0123] In this embodiment, the reflection prompt is generated during the evaluation and feedback process of the large model used to evaluate the processing results of the financial analysis task generated by the large language model.

[0124] The large model used to evaluate the generated results, or reflector, has the core function of "analyzing the historical operation trajectory of the large language model and generating actionable reflection suggestions (i.e., reflection prompts)".

[0125] In this embodiment, the reflection prompt is used to ensure that the guidance prompts generated by the controlled generation prompt submodule have "financial professionalism".

[0126] In this implementation, the reflection example sample composed of reflection prompts includes four parts: "user needs, initial analysis results of the large language model, reflection prompts, and revised results," wherein: User needs: such as standardized task instructions and user-uploaded financial data; Initial analysis results of the large language model: The output results of the large language model before this iteration update; Reflection Tips: This iteration update includes reflection tips for evaluating the generation of large models. Corrected results: The results obtained from the large language model analysis after this iteration update.

[0127] In this implementation, the reflection example samples correspond one-to-one with the task types: Sample source: 120 valid samples were extracted from historical financial analysis cases of enterprises, covering three major task types (40 data preprocessing tasks, 40 indicator calculation tasks, and 40 anomaly verification tasks).

[0128] In this implementation, we provide an example of the processing flow of a financial analysis system: The CFO of a medium-sized manufacturing company wants to use the system to analyze the reasons for the year-on-year decline in profit margin in the first quarter of 2024.

[0129] I. User Input and System Routing Decisions: User input: Natural language query: "System, please analyze why our company's gross profit margin in the first quarter of 2024 (18.5%) decreased by 3.8 percentage points compared to the same period last year (22.3%)?" Upload file: 2024_Q1_Financial Data.xlsx (including income statement, trial balance, etc.).

[0130] Routing decision: After receiving the query and the file, the interaction layer determines that the question is "calculation and analysis based on file data and accounting standards," which is a query requiring financial knowledge. Therefore, the routing decision-maker decides to trigger this task as a complete financial analysis task and calls the Retrieval Enhancement Generation (RAG) module to perform the query.

[0131] II. First execution of the Retrieval Enhancement Generation (RAG) module: Query rewriting and standardization: User's original query: "System, please analyze why our company's gross profit margin in the first quarter of 2024 (18.5%) decreased by 3.8 percentage points compared to the same period last year (22.3%)?" Standardized task instructions (generated by the query rewrite submodule): Instruction: Perform a year-on-year difference analysis of gross profit margin; parameter: Analysis period: Q1 2024 vs Q1 2023; Key metric: Gross profit margin = (Operating revenue - Operating cost) / Operating revenue; Given data: Current gross profit margin is 18.5%, compared to 22.3% year-on-year, a difference of -3.8 percentage points; Output requirements: Analyze the reasons for the discrepancies, covering both revenue (such as changes in sales volume and unit price) and cost (such as changes in direct materials, direct labor, and manufacturing overhead), and cite relevant accounting standards (such as Accounting Standard for Business Enterprises No. 14 - Revenue) as the basis for analysis.

[0132] Knowledge retrieval and prompt keyword constraints: Search results (the two most relevant knowledge blocks retrieved from the dynamic knowledge base): Knowledge Block A (Source: Application Guide to Accounting Standard for Business Enterprises No. 14—Revenue): "Enterprises shall recognize revenue when they have fulfilled their performance obligations under the contract, that is, when the customer obtains control of the relevant goods. Analysis of revenue changes needs to consider factors such as contract arrangements, progress of performance, and variable consideration." Knowledge Block B (Source: Company's internal "Cost Accounting Management System"): "The proportion of energy and power costs in manufacturing expenses increased by 15% year-on-year this quarter, mainly due to rising global energy prices and high energy consumption during the trial production of new production lines."

[0133] Prompt word constraints (generated by the prompt word constraint submodule): "The following answers must be strictly based on the above search results (knowledge blocks A and B) and the financial data files provided by the user. All key arguments, such as those involving revenue recognition principles or cost drivers, must clearly indicate the knowledge block number (e.g., [knowledge block A]) or data source (e.g., [data file: income statement]). It is forbidden to make assumptions or use experience outside of the system training data."

[0134] The reflection and dynamic optimization module is invoked to generate guidance prompts: Task type identification: Identifies the current task as "financial indicator calculation" type; Reflection Example Library: Suppose there are multiple reflection example samples for the current task type in the library. One of the reflection example samples has the following reflection prompt: "Initial analysis often overlooks the fluctuations of manufacturing overhead details. It is necessary to focus on checking the 'Energy and Power' and 'Depreciation Expense' items under manufacturing overhead." Controlled cue generation submodule: Combining the soft cue vector of the current task type and the aforementioned reflective cue, it generates specific guidance cue, which is then input into the Large Language Model (LLM). "You are a financial analyst. Please conduct a year-on-year analysis of gross profit margin based on the standardized task instructions and provided financial data. Special note: This analysis should prioritize checking the changes in detailed items under 'Manufacturing Expenses,' such as 'Energy & Power' and 'Depreciation Expenses.' Ensure that your conclusions are supported by solid data and standards."

[0135] Enhanced generation and initial output: The enhanced context for inputting LLM includes: standardized task instructions + user-uploaded financial data + search results (knowledge blocks A and B) + prompt keyword constraints + guidance and prompts generated by the reflection dynamic optimization module.

[0136] Preliminary analysis report of LLM: "The gross profit margin decreased by 3.8 percentage points in the first quarter of 2024. The preliminary analysis of the reasons is as follows:" Revenue: Operating revenue remained stable year-on-year [Data file: Profit and Loss Statement].

[0137] On the cost side: Operating costs increased significantly year-on-year. According to the company's "Cost Accounting Management System" [Knowledge Block B], energy and power costs in manufacturing expenses were the main driver of cost increases this quarter.

[0138] Source citation (Source Tracing Submodule): [Knowledge Block B], [Data File: Profit and Loss Statement]. III. Reflection on the evaluation and iteration of the dynamic optimization module: Initial Assessment and Reflection: Evaluation Results: The large model used to evaluate the generated results assessed the preliminary report and determined that it failed to fully pass rule validation; the performance reward was low (e.g., below the threshold of 0.8), and the main issues were: Insufficient data insights: The report only points out the rise in energy costs, but fails to quantify its specific impact or explore whether revenue is truly "stable" (whether there is a situation where unit prices are lowered to maintain market share?). Lack of logical coherence: The analysis is superficial, failing to effectively link rising costs to macroeconomic trends (such as energy prices) or internal management (new production lines). The generated reflection prompts: "The report failed to delve deeply into the correlation of data. Recommendations: 1. Quantify the specific percentage impact of rising energy and power costs on gross profit margin; 2. Explain the underlying reasons for cost increases by combining macroeconomic data (such as the PPI index) or internal operating data (such as the commissioning status of new production lines); 3. Re-examine the 'stability' of revenue and analyze the offsetting effect of sales volume and unit price."

[0139] Iterative optimization: CMA-ES algorithm startup: Since the evaluation results do not meet the requirements, the soft cue vector optimization submodule initiates iterative optimization based on the CMA-ES algorithm.

[0140] Optimization process: The CMA-ES algorithm will fine-tune the weights of vector elements in the soft hint vector corresponding to the "financial indicator calculation task". For example, it will increase the weights of elements such as "transparent calculation steps", "interpretable results", and "data traceability", while slightly reducing the weight of "calculation speed". Generate new guidance tips: The controlled tip generation submodule generates second-generation, more targeted guidance tips based on optimized soft tip vectors and new reflective tips. "(Based on the results and reflections of the first round) Please conduct a second round of in-depth analysis. Core requirements:" Quantitative impact: Calculate the contribution of increased energy and power costs to the decline in gross profit margin.

[0141] Attribution analysis: Assess external impacts by combining external market data (such as the increase in the industrial PPI index in Q1 2024).

[0142] Further analyze revenue: Verify the conclusion of 'stable revenue' by analyzing changes in sales volume and unit price to confirm whether there is a situation of trading volume for price.

[0143] Secondary enhancement generation and final output: The search enhancement generation module is working again, and based on the new guidance, it may retrieve new knowledge blocks about "Producer Price Index (PPI)".

[0144] With stronger guidance, LLM generates new reports: In-depth analysis report on gross profit margin in the first quarter of 2024 Key findings: The 3.8 percentage point decrease in gross margin was mainly driven by a 16% increase in operating costs, which was completely offset by the positive impact of a slight 2% increase in revenue.

[0145] Detailed attribution analysis: Cost pressures (main factors): Impact of Energy Costs: Energy and power costs in manufacturing expenses increased by 15% year-on-year [Knowledge Block B]. Calculations show that this alone led to a decrease in gross profit margin of approximately 2.1 percentage points [Data File: Balance Sheet]. This change aligns with the upward trend in the "Power and Fuel" sub-item of the National Producer Price Index (PPI) in the first quarter of 2024 [Knowledge Block C: Data from the National Bureau of Statistics].

[0146] Impact of new production lines: The newly commissioned intelligent production lines are in the break-in period, and their low energy efficiency is the main internal factor.

[0147] A re-examination of the revenue side: Although total operating revenue remained stable, in-depth analysis revealed that while sales volume increased by 5%, the average selling price decreased by 3%. This suggests that the company may have adopted a slight price reduction strategy to maintain market share [Data file: Sales Details], partially offsetting the gross profit pressure caused by rising costs. Revenue recognition complies with the relevant standards [Knowledge Block A].

[0148] Conclusion: The decline in gross profit margin this period is the result of the combined effects of external energy market price fluctuations and the fact that the efficiency of the new production lines was not optimal in the initial stage of operation. At the same time, the company adopted an active pricing strategy to cope with market competition.

[0149] Sources cited: [Knowledge Block A], [Knowledge Block B], [Knowledge Block C], [Data Files: Profit and Loss Statement, Account Balance Sheet, Sales Details].

[0150] Source tracing: Every key data point and conclusion in the report is clearly linked to its source. In the actual system, users can click on [Knowledge Block B] to directly view the relevant paragraphs of the "Cost Accounting Management System," and click on [Knowledge Block C] to view a snapshot of PPI data, achieving true traceability.

[0151] Based on the current iteration number and the updated objective function value, determine whether to continue iterating; after the iteration ends, select the soft cue vector that maximizes the objective function value.

[0152] Implementation Method 8: A financial analysis method based on retrieval enhancement generation and reflective dynamic optimization, the method comprising the following steps: Obtain users' natural language queries and uploaded financial data; The system determines the query type of a user's natural language query in order to make routing decisions. If the query type does not require financial knowledge, it will be treated as a regular question-and-answer task, and the large language model will be used to generate the answer directly. If the query type is a query requiring financial knowledge, it will be treated as a financial analysis task. Based on the user's natural language query, relevant knowledge blocks from authoritative financial experts will be retrieved to obtain the search results. The guidance prompts for this financial analysis task are generated using soft cue vectors and reflective prompts. The soft cue vectors are first randomly generated and then iteratively updated based on the evaluation results of previous financial analysis tasks and in conjunction with the CMA-ES algorithm. The reflective prompts are generated when the processing results of previous financial analysis tasks are evaluated using a large model used to evaluate the generated results. Based on the user's natural language query, retrieval results, and guidance prompts for this financial analysis task, an enhanced contextual input large language model is obtained to generate the processing results for this financial analysis task. The processing results of this financial analysis task are evaluated using a large model for evaluating the generated results. If the evaluation results do not meet the given requirements, the CMA-ES algorithm is used to iteratively update the soft cue vector and generate new reflection cue.

[0153] In this embodiment, the financial analysis method is implemented based on the financial analysis system based on retrieval enhancement generation and reflective dynamic optimization described in the above embodiments.

[0154] In summary, to address the problems existing in the current technology, a financial analysis system based on retrieval-enhanced generation and reflective dynamic optimization is proposed.

[0155] The financial analysis system integrates RAG with a dynamic reflective optimization mechanism to achieve highly accurate, reliable, and interpretable intelligent analysis of financial data.

[0156] The financial analysis system can process multi-source structured financial data, understand user intent through natural language interaction, perform dynamic task planning and execution based on a three-tier architecture, and ultimately generate accurate, reliable, and interpretable financial analysis results. It is also capable of self-correction and iteration.

[0157] The core innovations of the financial analysis system mainly include: (1) Retrieval Enhancement Generation Module (RAG Architecture with Domain Knowledge Enhancement): A dynamic knowledge base dedicated to the financial domain has been constructed, with sources including the Accounting Standards for Business Enterprises, internal company regulations, and annual financial reports. Through optimized text segmentation strategies, query rewriting, and hybrid retrieval mechanisms, the professional knowledge injected into the context of the large language model is both high-quality and timely, avoiding illusions as much as possible. The answers are traceable and auditable through strict prompt word constraints and source tracing.

[0158] (2) Reflection Dynamic Optimization Module (Dynamic Reflection Optimization Mechanism): In view of the characteristics of financial analysis tasks, a task-adaptive reflection dynamic optimization module is designed; low-dimensional soft hints are combined with a reflection example library, and guidance hints are dynamically generated through a small language model (SLM); using the covariance matrix adaptive optimization algorithm, the reflection strategy is continuously optimized based on task execution feedback (performance reward and diversity reward), so that the system has the ability to continuously self-examine, correct errors and iteratively optimize in complex multi-step financial analysis tasks, effectively solving the problem of the solidification of static reflection mode.

[0159] Compared with existing financial data analysis agents, the financial analysis system has the following beneficial technical effects: (1) Solving the problem of knowledge lag: By introducing RAG technology and dynamic knowledge base, the problem of not being able to know the latest policies, data, market and other information due to the outdated training data of large models is avoided.

[0160] (2) Avoids hallucinations: The language big model’s answers rely strictly on the latest, validated dynamic knowledge base, no longer relying on the model’s built-in memory, but retrieving information from designated authoritative documents in real time, ensuring the accuracy of information and minimizing hallucinations.

[0161] (3) High professionalism and specialization: The relevant documents are uploaded into a dynamic knowledge base, so that the answers of the language model not only conform to the general norms, but also closely integrate with the company's internal practices.

[0162] (4) Transparent and traceable decision-making process: The source document is clearly marked for each key statement in the output answer. Users can immediately find the original report and specific page referenced when making decisions.

[0163] (5) Introduce a reflection and optimization mechanism to improve the ability to correct complex tasks: solve the problem of traditional static prompts being "general-purpose but not specific"; and have greater stability when dealing with dynamic financial environments and complex analysis tasks.

[0164] The above description of several specific embodiments further details the technical solution provided by the present invention in order to highlight the advantages and benefits of the technical solution provided by the present invention. However, the above-described specific embodiments are not intended to limit the present invention. Any reasonable modifications and improvements to the present invention, reasonable combinations of embodiments, and equivalent substitutions based on the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A financial analysis system based on retrieval enhancement generation and reflective dynamic optimization, characterized in that, The system includes: Data layer: includes at least three types of data storage units, namely a dynamic knowledge base for storing authoritative knowledge in the financial field, a business database for structured storage of financial data uploaded by users, and a log database for storing financial analysis task processing logs; among them, the financial analysis task processing logs are automatically updated to record the processing process and results of each financial analysis task; Interaction Layer: Receives user natural language queries and uploaded financial data; visualizes the processing results of each financial analysis task; determines the query type of user natural language queries to make routing decisions. If the query type is a query that requires financial knowledge, it will be treated as a financial analysis task, and the retrieval enhancement generation module will be called to retrieve the dynamic knowledge base. If the query type does not require financial knowledge, it will be treated as a regular question-and-answer task, and the large language model will be directly called to generate the answer without calling the retrieval enhancement generation module. Core functional layer: includes a search enhancement generation module and a reflection-based dynamic optimization module; The retrieval enhancement generation module: based on the user's natural language query, retrieves relevant knowledge blocks from the dynamic knowledge base to obtain retrieval results; based on the user's natural language query, retrieval results, and guidance prompts generated by the reflection dynamic optimization module for each financial analysis task, obtains an enhanced contextual input large language model to generate the processing results for each financial analysis task; The reflection and dynamic optimization module generates guidance prompts for each financial analysis task; evaluates the processing results of each financial analysis task; and iteratively optimizes the generation parameters of the guidance prompts based on the evaluation results to generate guidance prompts for the next financial analysis task.

2. The financial analysis system based on retrieval enhancement generation and reflective dynamic optimization according to claim 1, characterized in that, The dynamic knowledge base of the data layer is constructed using the following method: Knowledge document upload steps: Receive multi-format financial knowledge documents; the multi-format financial knowledge documents store three types of financial knowledge: publicly available authoritative knowledge, internal corporate knowledge, and professionally interpreted knowledge; the multi-format financial knowledge documents are collected based on the principles of authority, timeliness, and relevance, and are obtained after integrity verification and sensitive information filtering; Knowledge structuring steps: Natural language processing technology is used to parse and segment the multi-format financial knowledge documents, and metadata is extracted to form structured knowledge blocks; Vectorization indexing steps: The structured knowledge blocks are converted into high-dimensional vectors, and a vector index is constructed to support hybrid retrieval strategies; the hybrid retrieval strategies support the hybrid retrieval of semantic information and keywords.

3. The financial analysis system based on retrieval enhancement generation and reflective dynamic optimization according to claim 1, characterized in that, The retrieval enhancement generation module: Includes the following sub-modules: Query rewriting submodule: Parses the natural language query into standardized task instructions; Knowledge retrieval submodule: In response to the standardized task instructions, it retrieves relevant knowledge blocks from the dynamic knowledge base and obtains retrieval results; The prompt word constraint submodule generates prompt word constraints, which are used to ensure that the answer from the large language model must be based on the search results. Enhanced Generation Submodule: The standardized task instructions, user-uploaded financial data, search results, prompt word constraints, and guidance prompts for each financial analysis task generated by the reflection and dynamic optimization module are used as the enhanced context input to the large language model to generate the processing results for each financial analysis task. Source tracing submodule: For the processing results of each financial analysis task, mark the corresponding knowledge block source identifier.

4. The financial analysis system based on retrieval enhancement generation and reflective dynamic optimization according to claim 1, characterized in that, The parameters for generating guidance prompts include soft prompt vectors and reflective prompts; financial analysis tasks are divided into multiple task types; The soft cue vectors and reflective cue vectors correspond one-to-one with each task type; The retrieval enhancement generation module includes the following sub-modules: The soft cue vector optimization submodule evaluates the processing results of each financial analysis task for each task type generated by the large language model. If the evaluation results do not meet the given requirements, the soft cue vector corresponding to each task type is iteratively updated, and multiple reflection cue vectors corresponding to each task type are generated. The initial soft cue vector corresponding to each task type is randomly generated. The reflection example library update submodule: During the iterative update of the soft cue vectors corresponding to each task type, several reflection cue vectors corresponding to each task type are selected to form a reflection example sample corresponding to each task type, and the sample is automatically updated and recorded in the reflection example library. Controlled prompt generation submodule: Generates guidance prompts based on soft prompt vectors and reflective prompts corresponding to the task type of the financial analysis task.

5. The financial analysis system based on retrieval enhancement generation and reflective dynamic optimization according to claim 4, characterized in that, The soft suggestion vector optimization submodule is used to perform the following steps: Define performance rewards The processing results of each financial analysis task of each task type generated by the large language model are evaluated, and performance rewards are given. If the value is less than the given performance reward threshold, the soft cue vector is iteratively updated. Define diversity rewards , which represents the overlap rate of the reflective prompts generated by the large language model to evaluate the generated results during the multiple iterations of the processing results of each financial analysis task for each task type in the large language model. Performance bonus and diversity rewards Perform weighted combinations to obtain comprehensive rewards. ; Comprehensive rewards The soft cue vector is updated iteratively as the objective function; In each iteration update process: The CMA-ES algorithm is used to optimize the soft cue vectors corresponding to each task type in the previous iteration to obtain the soft cue vectors corresponding to each task type in the current iteration. The controlled prompt generation submodule is invoked to generate guidance prompts for this iteration update based on the soft prompt vectors corresponding to each task type in this iteration update and the reflection prompts extracted from the reflection example library. The retrieval enhancement generation module is invoked to generate an enhanced contextual input large language model for this iteration based on the guidance prompts of this iteration update, thereby obtaining the processing results of this iteration update for the financial analysis task; The large model used to evaluate the generated results is used to evaluate the processing results of this iteration of the financial analysis task, and the evaluation results and reflection prompts of this iteration are obtained. Based on the evaluation results of this iteration, the objective function for this iteration is calculated; The iteration ends when the given number of iterations is reached or the objective function value of the current iteration reaches the given objective function threshold. The soft cue vector corresponding to each task type that maximizes the objective function value is taken as the optimal soft cue vector corresponding to each task type at the end of the iteration update.

6. The financial analysis system based on retrieval enhancement generation and reflective dynamic optimization according to claim 4, characterized in that, Financial analysis tasks are divided into three types: data preprocessing tasks, financial indicator calculation tasks, and anomaly detection tasks; for each task type, a corresponding soft cue vector is designed: For data preprocessing tasks, the corresponding soft cue vector design is as follows: V fin1 = [Data integrity, data consistency, accounting period alignment, outlier detection, missing value imputation, account matching, format standardization, unit uniformity, data traceability, compliance, timeliness, accuracy, relevance, redundancy, effectiveness, logic]; For the task of calculating financial indicators, the corresponding soft cue vector is designed as follows: V fin2 = [Formula correctness, data source compliance, calculation steps transparency, unit conversion accuracy, beginning and ending data matching, year-on-year / month-on-month benchmark correctness, indicator caliber consistency, abnormal fluctuation identification, calculation result verification, rule compliance, parameter setting rationality, result reproducibility, logical coherence, error range control, basis traceability, result rationality]; For anomaly detection tasks, the corresponding soft hint vector is designed as follows: V fin3 = [Balance of cross-references, consistency of trends, reasonable numerical range, identification of anomaly causes, completeness of verification rules, comparison of historical data, matching of industry benchmarks, compliance, risk level assessment, analysis of the impact of anomalies, transparency of verification steps, interpretability of results, data traceability, timeliness of rules, error tolerance, and feasibility of correction suggestions].

7. A financial analysis method based on retrieval enhancement generation and reflective dynamic optimization, characterized in that, The method includes the following steps: Obtain users' natural language queries and uploaded financial data; The system determines the query type of a user's natural language query in order to make routing decisions. If the query type does not require financial knowledge, it will be treated as a regular question-and-answer task, and the large language model will be used to generate the answer directly. If the query type is a query requiring financial knowledge, it will be treated as a financial analysis task. Based on the user's natural language query, relevant knowledge blocks from authoritative financial experts will be retrieved to obtain the search results. The guidance prompts for this financial analysis task are generated using soft cue vectors and reflective prompts. The soft cue vectors are first randomly generated and then iteratively updated based on the evaluation results of previous financial analysis tasks and in conjunction with the CMA-ES algorithm. The reflective prompts are generated when the processing results of previous financial analysis tasks are evaluated using a large model used to evaluate the generated results. Based on the user's natural language query, retrieval results, and guidance prompts for this financial analysis task, an enhanced contextual input large language model is obtained to generate the processing results for this financial analysis task. The processing results of this financial analysis task are evaluated using a large model for evaluating the generated results. If the evaluation results do not meet the given requirements, the CMA-ES algorithm is used to iteratively update the soft cue vector and generate new reflection cue.

8. A computer device, comprising: A processor and a memory, characterized in that the memory is used to store executable instructions of the processor, the processor being configured to execute the financial analysis method based on retrieval enhancement generation and reflective dynamic optimization as described in claim 8 by executing the executable instructions.

9. A computer storage medium, characterized in that, The storage medium stores a computer program, which, when executed, performs the financial analysis method based on retrieval enhancement generation and reflective dynamic optimization as described in claim 8.

10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the financial analysis method based on retrieval enhancement generation and reflective dynamic optimization as described in claim 8.