Financial question and answer intelligent planning and retrieval system and method based on big data
By introducing task planning modules and semantic-based vector search technology into the financial question and answer system, the problem of inaccurate answers in complex queries in the financial field is solved, and fast and accurate answer generation is achieved, improving the practicality and reliability of the system.
Patent Information
- Application Number
- CN202510143793.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-10
- Publication Date
- 2025-05-30
AI Technical Summary
When facing specific high-complex tasks in the financial field, existing financial question-and-answer systems have hallucinations and lack of domain knowledge support, resulting in inaccurate answers. It is difficult for traditional RAG models to accurately understand user intentions in the financial field, resulting in inaccurate search results.
A financial question-and-answer intelligent planning and retrieval system based on big data is proposed. Through the task planning module, complex queries are disassembled into multiple subtasks, combined with large language models and semantic-based vector search technology, relevant information is retrieved from external data sources, and answers are integrated through the generation module to ensure the accuracy and relevance of the answers.
It achieves rapid and accurate extraction and generation of required answers from a large number of information sources, meets the needs of complex queries in the financial field, reduces the cognitive burden of a single model, reduces the emergence of "illusion" situations, and improves the practicality and reliability of the system.
Smart Images

Figure CN120067260A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of question - answering planning and retrieval. Specifically, it particularly relates to a financial question - answering intelligent planning and retrieval system and method based on big data. Background Art
[0002] Most current AI question-answering systems rely on large pre-trained language models (such as GPT, etc.) to generate answers; these models are pre-trained with large-scale data, can understand and generate natural language, and have strong generality; however, when facing specific high-complexity tasks in the financial field, existing large language models still have obvious limitations: Hallucination phenomenon: The large language model itself relies on its knowledge base during pre-training, but this knowledge base is not updated in real time; therefore, when encountering queries that require the latest financial data (such as stock market quotes, macroeconomic changes, etc.), the model may generate inaccurate or even wrong answers; this phenomenon is called "hallucination" and is a major challenge for question-answering systems in the financial field; Lack of domain knowledge support: Although the large language model has been exposed to a large amount of text data during pre-training, for some in-depth knowledge in specific fields, especially the detailed knowledge in the financial field, the model does not have direct support; therefore, when dealing with questions involving complex financial knowledge, existing generation models often cannot provide accurate answers or require a large amount of computation, resulting in low efficiency; RAG is a question-answering technology that combines information retrieval and large language models; its working principle is usually: when a user asks a question, first, the retrieval module obtains relevant information from external data sources (such as databases, web pages, documents, etc.), and then the generation module generates an answer based on the retrieved information; this method can utilize the supplement of external knowledge to improve the accuracy of question-answering, especially when facing common factual questions; however, the application of existing RAG models in the financial field faces many challenges; in the traditional RAG architecture, the retrieval module and the generation module are relatively independent, and the model does not have a deep understanding and analysis of the user's query; the retrieval module often only performs simple retrieval based on the input query through keyword matching or semantic similarity, ignoring the in-depth analysis of the context and potential intention of the query; for example, when the query involves multi-level financial tasks (such as stock market analysis, financial forecasting, etc.), traditional RAG systems often have difficulty accurately understanding the specific intention of the user, resulting in inaccurate retrieval results and the generation module being unable to provide effective answers; Although RAG enhances the model's generation ability by combining the retrieval module, the traditional retrieval mechanism (such as keyword-based retrieval) still has limitations; for the financial field, information retrieval not only depends on keyword matching but also needs to consider the timeliness, accuracy, and domain relevance of the data; traditional retrieval modules usually fail to handle these challenges well, making it difficult to retrieve accurate answers for specific financial questions; on the other hand, information such as financial market data and company financial indicators has strong timeliness and volatility, so the retrieval system needs to be able to obtain and integrate the latest external knowledge in real time; however, the current technical framework still has obvious shortcomings in obtaining real-time data;Although some systems use external databases or Internet search engines for information retrieval, due to the wide range and complexity of information sources, how to quickly and accurately screen out relevant data from a vast amount of financial information remains a technical challenge. Summary of the Invention
[0003] In view of the problems in the related art, the present invention provides a financial Q&A intelligent planning and retrieval system and method based on big data to overcome the above-mentioned technical problems existing in the prior related art.
[0004] To solve the above technical problems, the present invention is implemented through the following technical solutions:
[0005] The present invention provides a financial Q&A intelligent planning and retrieval method based on big data, comprising the following steps:
[0006] S1. Obtain the input question content of the user's retrieval of financial knowledge, perform word and sentence segmentation, and then calculate the similarity between each word and sentence and other words and sentences according to the word and sentence segmentation result to obtain the current attention weight set;
[0007] S2. Analyze the user's question according to the current attention weight set, extract the key information in the query and convert it into an operable task plan to obtain a question sub-task set;
[0008] S3. Retrieve information related to the user's query according to the question sub-task set to obtain a retrieval information set;
[0009] S4. Generate an answer that meets the user's needs according to the question sub-task set, the retrieval information set, the information obtained from the retrieval module, and the context of the user's query;
[0010] It can quickly and accurately extract and generate the required answers from a large number of information sources according to the user's query intention. Through reasonable task decomposition, retrieval strategies and generation methods, it can meet the needs of complex queries in the financial field.
[0011] Preferably, the S1 includes the following steps:
[0012] S11. Obtain the input question content of the user's retrieval of financial knowledge, denoted as the user input question content;
[0013] S12. Perform word and sentence segmentation on the user input question content to obtain the current input word set; calculate the similarity (i.e., attention weight) between each word and sentence in the current input word set and other words and sentences to obtain the current attention weight set; the calculation formula is as follows,
[0014]
[0015] Wherein, Q is the query matrix, representing the query vector of the current word; K is the key matrix, representing the key vectors of all words; K T represents the transpose of K; V is the value matrix, representing the value vectors of all words; d k represents the dimension of the key vector; softmax represents the normalized exponential function.
[0016] Preferably, in S12, the calculation of the similarity between each sentence in the current input word set and other sentences uses a generative language model based on the Transformer architecture.
[0017] Preferably, the S2 includes the following steps:
[0018] S21. In cooperation with the current attention weight set, use a large language model to deeply think about the user's problem and form a thinking process, obtain the key information required to solve the problem, and obtain a problem-solving keyword set;
[0019] S22. Further perform named entity recognition according to the problem-solving keyword set to extract key elements, and obtain a key element set; the extraction formula is as follows,
[0020] Entities = NER(Query);
[0021] Wherein, Entities represents the recognized entity information; NER represents the named entity recognition process; Query represents the user's problem;
[0022] S23. Decompose the user's problem into multiple subtasks according to the key element set, and obtain a problem subtask set Subtasks = {Task 1 ,..., Task i ,..., Task n}; Task i represents the i-th subtask obtained by decomposition, and n represents the total number of subtasks obtained by decomposition.
[0023] Preferably, the S3 includes the following steps:
[0024] S31. Retrieve information related to the user's query from an external data source according to the problem subtask set, and obtain a retrieval information set.
[0025] Preferably, the retrieval method in S31 includes a keyword-based retrieval method and a semantic-based vector retrieval technique;
[0026] In the financial field, due to the complexity of data types and structures, the retrieval module not only relies on traditional keyword-based retrieval methods, but also combines semantic-based vector retrieval techniques to improve retrieval efficiency and accuracy.
[0027] Preferably, S4 includes the following steps:
[0028] S41. Integrate the descriptions of each task in the problem sub-task set and the retrieval information set into a unified input format;
[0029] S42. After the input format integration is completed, generate an answer that meets the user's needs;
[0030] For queries involving multiple information sources, the generation module needs to use a weighting strategy to combine information from different sources. Through the method of prompt engineering, higher weights are assigned to fact-based query results with higher confidence, and the generated answers rely more on this information.
[0031] Preferably, in S41, a large-scale pre-trained generative model is adopted in the process of generating an answer that meets the user's needs;
[0032] To ensure that the generated answer has high accuracy and fluency, the generation module usually relies on a large-scale pre-trained generative model and shares the underlying model weights with the task planning module.
[0033] Preferably, the unified input format in S41 includes the query content, retrieval results, and the context of the query;
[0034] By integrating the task description and retrieval information into a unified input format during the generation process; the integrated input not only includes the query content and retrieval results, but also the context of the query to ensure that the generated answer is logically coherent and content complete.
[0035] A financial Q&A intelligent planning and retrieval system based on big data, including an input question sentence similarity calculation module, a task planning module, a retrieval module, and a generation module;
[0036] The input question sentence similarity calculation module is used to obtain the input question content for the user to retrieve financial knowledge and perform sentence segmentation, and then calculate the similarity between each sentence and other sentences according to the sentence segmentation result to obtain the current attention weight set;
[0037] The task planning module is used to analyze the user's question according to the current attention weight set, extract the key information in the query and convert it into an actionable task plan to obtain a problem sub-task set;
[0038] The retrieval module is used to retrieve information related to the user's query from an external data source according to the problem sub-task set to obtain a retrieval information set;
[0039] The generation module is used to generate an answer that meets the user's needs according to the set of problem subtasks, the retrieved information set, the information obtained from the retrieval module, and the context of the user's query.
[0040] The present invention has the following beneficial effects:
[0041] 1. In the present invention, through the financial intelligent question-answering system based on task planning and database retrieval, first, the system precisely disassembles through the task planning module, converting complex query tasks into multiple refined subtasks, so as to be able to retrieve and process information more efficiently; this multi-level and modular design not only improves the query efficiency, but also ensures the accuracy and comprehensiveness of the answer. Combining the large language model and the semantic-based vector retrieval technology, the system can quickly locate the most relevant information in the massive data, and efficiently integrate and output an answer that meets the user's needs through the generation module, ensuring that the user gets a fast and accurate solution.
[0042] 2. In the present invention, the system's dynamic adaptability and scalability enable it to cope with the constantly changing and updated data environment in the financial field; through the retrieval and in-depth analysis of real-time news and information, the system can process queries with strong time sensitivity and provide the latest market dynamics and company information. In addition, the system adopts a variety of intelligent retrieval and generation methods, such as ElasticSearch and semantic rearrangement algorithms, etc., and further improves the relevance and quality of the answer by optimizing the ranking of candidate answers; the modular processing of financial problems in the present invention significantly reduces the cognitive burden of a single model and reduces the occurrence of the "hallucination" situation of the large model, which makes the present invention show strong practicality and reliability when dealing with complex and multi-dimensional financial problems.
[0043] 3. In the present invention, the task planning module, the retrieval module, and the generation module together constitute an efficient query processing system, which can quickly and accurately extract and generate the required answers from a large number of information sources according to the user's query intention; through reasonable task decomposition, retrieval strategies, and generation methods, the present invention can meet the needs of complex queries in the financial field.
[0044] Of course, it is not necessary for any product implementing the present invention to achieve all the above-mentioned advantages simultaneously. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions of the embodiments of the invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0046] Figure 1Schematic flowchart of a method for intelligent planning and retrieval of financial Q&A based on big data according to the present invention;
[0047] Figure 2 Schematic diagram of modules of a system for intelligent planning and retrieval of financial Q&A based on big data according to the present invention. Detailed implementation manners
[0048] Next, the technical solutions in the embodiments of the invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the invention. Obviously, the described embodiments are only a part of the embodiments of the invention, rather than all the embodiments. Based on the embodiments of the invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the invention.
[0049] Embodiment 1
[0050] Please refer to Figure 1 , this embodiment is a method for intelligent planning and retrieval of financial Q&A based on big data, including the following steps:
[0051] S1. Obtain the input question content for the user to retrieve financial knowledge, perform word and sentence segmentation, and then calculate the similarity between each word and sentence and other words and sentences according to the word and sentence segmentation result to obtain the current attention weight set;
[0052] The S1 includes the following steps:
[0053] S11. Obtain the input question content for the user to retrieve financial knowledge, denoted as the user input question content;
[0054] S12. Perform word and sentence segmentation on the user input question content to obtain the current input word set; calculate the similarity (i.e., attention weight) between each word and sentence in the current input word set and other words and sentences to obtain the current attention weight set; the calculation formula is as follows,
[0055]
[0056] In the formula, Q is the query matrix, representing the query vector of the current word; K is the key matrix, representing the key vectors of all words; K T represents the transpose of K; V is the value matrix, representing the value vectors of all words; d kdenotes the dimension of the key vector; softmax denotes the normalized exponential function; by calculating the dot product of the query vector and all key vectors, the similarity between each word and other words (i.e., attention weights) is obtained; in the actual calculation process, each layer of the decoder in the model usually contains multiple attention heads (Multi-Head Attention), that is, multiple independent attention mechanisms calculate in parallel and concatenate their results; then use the softmax function to convert the similarity into a probability distribution, and finally sum all value vectors weighted to obtain the output representation of the word;
[0057] In S12, calculating the similarity between each sentence in the current input word set and other sentences adopts a generative language model based on the Transformer architecture;
[0058] Generative language models based on the Transformer architecture have been widely used in tasks such as text generation, question answering systems, and text summarization. The present invention selects a large language model based on this architecture; the Transformer architecture uses the self-attention mechanism (Self-Attention) and positional encoding to process sequence data, thus overcoming the limitations of traditional RNN and LSTM models on long sequences. This architecture consists of two basic parts:
[0059] Encoder: Used to process the input sequence and generate a context-related representation;
[0060] Decoder: Decodes the content generated by the encoder and is used to generate the output sequence;
[0061] In current mainstream large models (such as the GPT series), only the decoder part is used; the input of the model is a text sequence, which enters the multi-layer Transformer decoder after being processed by the embedding layer (Embedding Layer); each layer of the decoder contains the self-attention mechanism (Self-Attention) and the feedforward neural network (Feedforward Network);
[0062] S2. According to the current attention weight set, analyze the user's question, extract the key information in the query and convert it into an actionable task plan to obtain the problem sub-task set;
[0063] The said S2 includes the following steps:
[0064] S21. In cooperation with the current attention weight set, use the large language model to deeply think about the user's question and form a thinking process, obtain the key information required to solve the problem, and obtain the problem-solving keyword set;
[0065] S22. Further name entity recognition according to the problem-solving keyword set to extract key elements, obtaining a key element set. The extraction formula is as follows:
[0066] Entities = NER(Query);
[0067] In the formula, Entities represents the recognized entity information, including company names, time ranges, etc.; NER represents the name entity recognition process; Query represents the user's question.
[0068] S23. Decompose the user's question into multiple subtasks according to the key element set, obtaining a problem subtask set Subtasks = {Task 1 ,..., Task i ,..., Task n}; Task i represents the i-th subtask obtained by decomposition, and n represents the total number of subtasks obtained by decomposition. Each subtask Task i contains specific query instructions, such as database queries, news retrievals, etc. Complex questions may contain multiple query dimensions. For example, for the question "How is the business situation of a certain company in recent years", the task planning module may decompose the following subtasks: (1) Database query of the operating income, net profit, and asset-liability ratio of a certain company in 2022; (2) Database query of the operating income, net profit, and asset-liability ratio of a certain company in 2023; (3) Search engine query of news related to a certain company, etc.
[0069] S3. Retrieve information related to the user's query from external data sources according to the problem subtask set, obtaining a retrieval information set.
[0070] The S3 includes the following steps:
[0071] S31. Retrieve information related to the user's query from external data sources according to the problem subtask set, obtaining a retrieval information set. The external data sources include databases and web documents, etc.
[0072] The retrieval methods described in S31 include keyword-based retrieval methods and semantic-based vector retrieval techniques. The specific effects of the retrieval are as follows:
[0073] (1) Database retrieval based on ElasticSearch
[0074] For standard financial data (such as company basic information, financial indicators, stock market related data, etc.), the retrieval module will retrieve relevant records from the established financial database; As a powerful distributed search engine, ElasticSearch can precisely generate appropriate retrieval requests according to the user's query information (such as time range, company name, etc.) through the DSL (Domain Specific Language) query language; Suppose a sub-query task is "the net profit of Company A in the first quarter of 2022", the large language model will automatically generate the following DSL query:
[0075]
[0076] Suppose a query task is "the stock price of Company B on a certain trading day", the large language model will automatically generate the following DSL query:
[0077]
[0078]
[0079] During the query generation process, regular expression decoding is adopted to ensure that the output of the large language model is in the standard json dictionary format;
[0080] (2) Real-time news and information retrieval
[0081] For queries with strong real-time requirements, such as company news, market dynamics, etc., the retrieval module will combine traditional search engines and vector retrieval techniques to achieve; Through natural language queries, the system first uses search engines (such as Google, Bing) to obtain relevant web page content, then divides the web page content into blocks and converts it into vector representations, and uses vector retrieval methods to process this content to find the most relevant information, and the similarity calculation method uses cosine similarity; Suppose a query Q 1 and the retrieved document block D are embedded as vectors and The similarity calculation is as follows:
[0082]
[0083] Among them, represents the dot product of vector and , and respectively represent and The modulus of, Similarity(Q 1 ,D) represents the vector and Cosine similarity; the closer the value of the cosine similarity is to 1, the higher the similarity between the two vectors, and the stronger the relevance between the document and the query;
[0084] After retrieving multiple candidate text blocks, the system also needs to re-rank these answers to ensure that the most relevant information is finally returned; the re-ranking algorithm usually calculates the relevance of candidate documents based on the semantic information of the retrieved content; assume the retrieved candidate result set is R = {R 1 , R 2 , …, R m}, where R m represents the m-th candidate result retrieved; this module will use the semantic re-ranking model (Rerank model) to calculate the relevance score of each candidate; the calculation formula is as follows,
[0085] Relevance(Q 1 , R i ) = f(Sim(Q 1 , R i ), Features(R i ));
[0086] Among them, R i represents the i-th candidate result retrieved; Relevance(Q 1 , R i ) represents the relevance score between Q 1 and R i ; Sim(Q 1 , R i ) represents the semantic similarity between Q 1 and R i ; f represents the semantic re-ranking model, which combines the semantic similarity Sim(Q 1 , R i ) of the query and the candidate result and the features Features(R i ) of the candidate result itself to output a relevance score; finally, the candidate results are sorted according to the relevance score, and the most relevant document is returned;
[0087] S4. Generate an answer that meets the user's needs according to the problem sub-task set, the retrieval information set, and the information obtained from the retrieval module and the context of the user's query;
[0088] The S4 includes the following steps:
[0089] S41. Integrate the descriptions of each task in the problem sub-task set and the retrieval information set into a unified input format;
[0090] In the process of generating an answer that meets the user's needs as described in S41, a large-scale pre-trained generative model is adopted; the unified input format described in S41 includes the query content, retrieval results, and the context of the query.
[0091] S42. After the input format is integrated, an answer that meets the user's needs is generated.
[0092] For queries involving multiple information sources, the generation module needs to use a weighting strategy to combine information from different sources. Through the method of Prompt Engineering, higher weights are assigned to factual query results with higher confidence, and the generated answers rely more on this information.
[0093] Embodiment 2
[0094] Please refer to Figure 2 , this embodiment discloses a financial Q&A intelligent planning and retrieval system based on big data. The system can implement the method of the above embodiment, including an input question sentence similarity calculation module, a task planning module, a retrieval module, and a generation module.
[0095] The input question sentence similarity calculation module is used to obtain the input question content for the user to retrieve financial knowledge and perform sentence segmentation, and then calculate the similarity of each sentence with other sentences according to the sentence segmentation result to obtain the current attention weight set.
[0096] The task planning module is used to analyze the user's question according to the current attention weight set, extract the key information in the query and convert it into an operable task plan to obtain a question sub-task set.
[0097] The retrieval module is used to retrieve information related to the user's query from an external data source according to the question sub-task set to obtain a retrieval information set.
[0098] The generation module is used to generate an answer that meets the user's needs according to the question sub-task set, the retrieval information set, the information obtained from the retrieval module, and the context of the user's query.
[0099] In the description of this specification, the descriptions referring to terms such as "one embodiment", "example", "specific example", etc. mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.
[0100] The preferred embodiments of the invention disclosed above are only used to help illustrate the invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made according to the content of this specification. These embodiments are selected and specifically described in this specification to better explain the principle and practical application of the invention, so that those skilled in the art can well understand and utilize the invention.
Claims
1. A financial question-answering intelligent planning and retrieval method based on big data, characterized in that: The following steps are involved: S1. Obtain the input question content of the user for searching financial knowledge and divide it into words and sentences, and then calculate the similarity between each word and sentence and other words and sentences according to the word and sentence division results to obtain the current attention weight set; S2. parse the user's question according to the current attention weight set, extract key information from the query and convert it into an actionable task plan to obtain a problem subtask set; S3, retrieving information related to the user query from an external data source according to the problem subtask set to obtain a retrieval information set; S4. Generate an answer that meets the user's needs based on the question subtask set, the retrieval information set, the information obtained from the retrieval module, and the context of the user's query.
2. According to claim 1, a financial question-answering intelligent planning and retrieval method based on big data is characterized in that: The S1 comprises the following steps: S11, obtaining the input question content of the user for searching financial knowledge, and recording it as the user input question content; S12, dividing the question content input by the user into words and sentences to obtain a current input word set; calculating the similarity between each word and sentence in the current input word set and other words and sentences to obtain a current attention weight set.
3. The method for intelligent planning and retrieval of financial questions and answers based on big data according to claim 2, characterized in that: The calculation of the similarity between each word and other words in the current input word set in S12 adopts a generative language model based on the Transformer architecture.
4. The method for intelligent planning and retrieval of financial questions and answers based on big data according to claim 3, characterized in that: The S2 comprises the following steps: S21, using a large language model to deeply think about the user's question and form a thinking process in conjunction with the current attention weight set, to obtain key information required to solve the problem, and to obtain a problem-solving keyword set; S22, further naming entity recognition is performed based on the problem-solving keyword set to extract key elements, thereby obtaining a key element set; S23. Decompose the user problem into multiple subtasks according to the key element set to obtain a problem subtask set.
5. The method for intelligent planning and retrieval of financial questions and answers based on big data according to claim 4, characterized in that: The S3 comprises the following steps: S31. Retrieve information related to the user query from an external data source according to the problem subtask set to obtain a retrieval information set.
6. The method for intelligent planning and retrieval of financial questions and answers based on big data according to claim 5, characterized in that: The retrieval method described in S31 includes a keyword-based retrieval method and a semantic-based vector retrieval technology.
7. The method for intelligent planning and retrieval of financial questions and answers based on big data according to claim 6, characterized in that: The S4 comprises the following steps: S41, integrating the description of each task in the problem subtask set and the retrieval information set into a unified input format; S42. After the input format is integrated, an answer that meets the user's needs is generated.
8. The method for intelligent planning and retrieval of financial questions and answers based on big data according to claim 7, characterized in that: The process of generating answers that meet user needs described in S41 uses a large-scale pre-trained generative model.
9. The method for intelligent planning and retrieval of financial questions and answers based on big data according to claim 8, characterized in that: The unified input format in S41 includes query content and search results as well as the context of the query.
10. A system for implementing a financial question-answering intelligent planning and retrieval method based on big data as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Question and answer method and system based on BERT and knowledge base
CN112115238A
Database AI question answering system and method based on large language model and retrieval enhancement
CN118981522A