Financial sentiment analysis method and system based on search enhancement and preference optimization

By combining a large language model with hybrid retrieval and two-stage fine-tuning, along with a "news subject priority" and "cold water" defense mechanism, the financial sentiment analysis method solves the problems of weak implicit logic recognition and noise interference in existing technologies, and achieves high accuracy and autonomous controllability in financial sentiment analysis.

CN122309747APending Publication Date: 2026-06-30SOUTH CHINA NORMAL UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SOUTH CHINA NORMAL UNIV
Filing Date
2026-03-27
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Existing technologies in financial sentiment analysis suffer from problems such as weak implicit logic recognition capabilities, untimely knowledge updates, severe noise interference, and data privacy risks, making it difficult to achieve deep integration of external knowledge retrieval and financial analysis logic.

Method used

It employs a hybrid retrieval strategy to retrieve supplementary information from a dynamic knowledge base, and performs financial sentiment analysis through a two-stage fine-tuned large language model. Combining the "news subject priority" principle and the "cold water" defense mechanism, it supports full-stack private deployment.

Benefits of technology

It significantly improves the accuracy and depth of financial sentiment analysis, effectively suppresses noise interference, ensures data security and independent controllability, and meets the stringent requirements of financial institutions.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The purpose of this invention is to address the problem of weak implicit logic recognition in financial texts by providing a system that deeply integrates external knowledge retrieval with financial analysis logic. The system includes the following steps: Step S1: Obtain the financial news text to be analyzed; Step S2: Based on a preset hybrid retrieval strategy, retrieve supplementary information related to the financial news text from a dynamic knowledge base. The hybrid retrieval strategy includes semantic retrieval and keyword retrieval, and optimizes the retrieval results through ranking fusion and re-ranking algorithms. This invention, through the synergistic effect of retrieval enhancement generation and model fine-tuning, improves the accuracy of financial sentiment analysis from 77.53% to 83.27% on the Chinese benchmark set, and by up to 12.82 percentage points on the English benchmark. Through direct preference optimization training, the model's deep thinking ratio is improved by an average of 33.3%, enabling the model to spontaneously perform multi-dimensional, forward-looking professional financial reasoning, rather than simple keyword matching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of financial sentiment analysis technology, and in particular to a financial sentiment analysis method based on retrieval enhancement and preference optimization. Background Technology

[0002] Financial sentiment analysis aims to automatically determine the sentiment polarity (positive, neutral, negative) from texts such as financial news and research reports, and is a core technology for quantitative investment and risk monitoring. Current mainstream technical approaches can be divided into three categories: The first category is based on traditional pre-trained language models, such as FinBERT. These methods achieve sentiment classification by fine-tuning financial corpora, but are limited by model capacity (typically around 300 million parameters) and context length (512 tokens), making it difficult to handle long texts and complex financial reasoning, resulting in significantly lower accuracy compared to large language models. The second category utilizes large language models for direct reasoning. While these models possess powerful semantic understanding capabilities, they lack real-time financial knowledge, have insufficient analytical depth, and exhibit unstable output formats. The third category is retrieval-enhanced generation methods, which supplement the language model by retrieving information from external knowledge bases. These methods are highly effective in question-answering scenarios, but their application in sentiment analysis tasks is still immature.

[0003] Existing technologies suffer from the following shortcomings: First, BERT-like models are weak at recognizing implicit logic in financial texts (such as "good news is bad news"), with neutral category recognition F1 scores generally below 60%. Second, the knowledge of large language models is limited to the training data time point, failing to capture the latest policies and market conditions, and often lacking professional references to financial indicators and industry chain relationships in analysis. Third, existing retrieval enhancement methods are mainly geared towards factual question answering; directly applying them to sentiment analysis introduces noise (such as contradictory historical information and irrelevant domain content), lacking effective noise filtering and conflict arbitration mechanisms. Furthermore, general model outputs do not conform to financial analysis logic, static knowledge bases cannot adapt to dynamic market changes, and solutions relying on cloud APIs face data privacy risks and deployment limitations. Therefore, there is an urgent need for a financial sentiment analysis solution that can deeply integrate external knowledge retrieval with financial analysis logic and support private deployment. Summary of the Invention

[0004] The purpose of this invention is to address the problem of weak implicit logic recognition in financial texts by providing a system that can deeply integrate external knowledge retrieval and financial analysis logic.

[0005] The above-mentioned technical objective of the present invention is achieved through the following technical solution:

[0006] The present invention discloses a financial sentiment analysis method based on retrieval enhancement and preference optimization, comprising the following steps: Step S1: Obtaining the financial news text to be analyzed; Step S2: Retrieving supplementary information related to the financial news text from a dynamic knowledge base based on a preset hybrid retrieval strategy; the hybrid retrieval strategy includes semantic retrieval and keyword retrieval, and the retrieval results are optimized through ranking fusion and re-ranking algorithms; Step S3: Inputting the financial news text and the retrieved supplementary information into a financial sentiment analysis model, wherein the financial sentiment analysis model is a large language model that has undergone two-stage fine-tuning, the two-stage fine-tuning including a first-stage supervised fine-tuning to align the output format, and a second-stage direct preference optimization to align the analysis logic, wherein the training data for the direct preference optimization covers multiple retrieval enhancement scenarios; Step S4: Obtaining the sentiment analysis results output by the financial sentiment analysis model, wherein the sentiment analysis results include at least a sentiment polarity judgment and its analysis basis.

[0007] Preferably, the hybrid retrieval strategy in step S2 specifically includes: rewriting and expanding the financial news text to generate multiple semantically equivalent extended queries; performing coarse recall on each extended query through a semantic retrieval path and a keyword retrieval path, wherein the semantic retrieval path calculates vector similarity based on the Embedding model, and the keyword retrieval path calculates word frequency matching scores based on the BM25 algorithm; using a reciprocal ranking fusion algorithm to merge and rank the two retrieval results; and using a cross-encoder re-ranking model to fine-rank the merged candidate documents, selecting the top-ranked documents as the supplementary information.

[0008] Preferably, the dynamic knowledge base in step S2 supports automatic import and timed updates of multi-source data, including knowledge graph triples, financial news, and annual report data.

[0009] Preferably, in step S3, when the financial news text and the retrieved supplementary information are input into the financial sentiment analysis model, a sentiment-oriented search enhancement prompt strategy is adopted. The strategy includes: the news subject priority principle, that is, taking the current news facts as the core basis for sentiment judgment and the search information as an auxiliary reference; and a "cold water" defense mechanism, which is used to handle the contradiction between the search information and the news facts, and to execute the processing logic of ignoring, adopting or preventing overly conservative judgments according to the degree of contradiction.

[0010] Preferably, the first stage of supervised fine-tuning adopts a low-rank adaptive parameter efficient fine-tuning method, so that the model learning includes a standardized output format that includes key information identification, multi-dimensional in-depth analysis and final sentiment conclusion; the training data for the second stage of direct preference optimization covers six scenarios: retrieval consistency, retrieval contradiction, retrieval supplementation, no retrieval results, retrieval noise and information overload, and contains preference pairs for at least 11 sub-scenarios.

[0011] A financial sentiment analysis system based on retrieval enhancement and preference optimization is characterized by comprising: a dynamic knowledge base management subsystem for storing and managing financial domain knowledge and supporting automatic import and periodic updates of multi-source data; a hybrid retrieval enhancement subsystem for retrieving relevant supplementary information from the dynamic knowledge base in response to input financial news text, including a query rewriting module, a semantic retrieval module, a keyword retrieval module, a fusion ranking module, and a fine-ranking module; and a financial sentiment analysis model subsystem equipped with a large language model finely tuned in two stages for analyzing the financial news text and the supplementary information and outputting sentiment analysis results; the two-stage fine-tuning includes supervised fine-tuning for format alignment and direct preference optimization for analysis logic alignment.

[0012] Preferably, the system supports full-stack private deployment, with all components deployed on local servers, eliminating the need to call external cloud application interfaces; wherein, the financial sentiment analysis model and the embedded model are optimized for video memory through quantization techniques, and can run on a single consumer-grade graphics processor.

[0013] Preferably, the hybrid retrieval enhancement subsystem further includes a tool invocation workflow module, which is used to autonomously decide whether to perform a retrieval based on the tool invocation capability of the large language model, and to forcibly trigger a retrieval when a keyword is detected but the model has not invoked a tool.

[0014] The present invention has the following beneficial effects:

[0015] Significantly improves analytical accuracy and reasoning depth.

[0016] 1. This invention, through the synergistic effect of retrieval enhancement generation and model fine-tuning, improves the accuracy of financial sentiment analysis from 77.53% to 83.27% on the Chinese benchmark set, and by up to 12.82 percentage points on the English benchmark. Through direct preference optimization training, the model's deep thinking ratio is improved by an average of 33.3%, enabling the model to spontaneously perform multi-dimensional, forward-looking professional financial reasoning, rather than simple keyword matching.

[0017] 2. Effectively suppresses retrieval noise and enhances analytical robustness. This invention designs a retrieval enhancement strategy for sentiment analysis tasks, including a "news subject priority" principle and a "cold water" defense mechanism. Through a three-level conflict arbitration strategy (A / B / C), it effectively prevents retrieval noise such as historical contradictory information and irrelevant content from interfering with sentiment judgment, thus solving the core problem in existing technologies where retrieval information may mislead the model.

[0018] 3. Ensuring data security and achieving independent control. All components of this invention support full-stack private deployment without calling any third-party cloud APIs. Through model quantization and multi-GPU automatic allocation technology, the entire system can run offline on a single consumer-grade GPU (such as an RTX 4090), with a memory usage as low as 4-6GB, completely eliminating the risk of data leakage during data transmission, avoiding API call costs and network latency, and meeting the stringent requirements of financial institutions for data sovereignty and regulatory compliance. Detailed Implementation

[0019] A financial sentiment analysis method based on retrieval enhancement and preference optimization includes the following steps: Step S1: Obtain the financial news text to be analyzed; Step S2: Based on a preset hybrid retrieval strategy, retrieve supplementary information related to the financial news text from a dynamic knowledge base; the hybrid retrieval strategy includes semantic retrieval and keyword retrieval, and optimizes the retrieval results through ranking fusion and re-ranking algorithms; Step S3: Input the financial news text and the retrieved supplementary information into a financial sentiment analysis model, the financial sentiment analysis model being a large language model that has undergone two-stage fine-tuning, the two-stage fine-tuning including a first-stage supervised fine-tuning to align the output format, and a second-stage direct preference optimization to align the analysis logic, wherein the training data for the direct preference optimization covers multiple retrieval enhancement scenarios; Step S4: Obtain the sentiment analysis results output by the financial sentiment analysis model, the sentiment analysis results including at least sentiment polarity judgment and its analysis basis.

[0020] Preferably, the hybrid retrieval strategy in step S2 specifically includes: rewriting and expanding the financial news text to generate multiple semantically equivalent extended queries; performing coarse recall on each extended query through a semantic retrieval path and a keyword retrieval path, wherein the semantic retrieval path calculates vector similarity based on the Embedding model, and the keyword retrieval path calculates word frequency matching scores based on the BM25 algorithm; using a reciprocal ranking fusion algorithm to merge and rank the two retrieval results; and using a cross-encoder re-ranking model to fine-rank the merged candidate documents, selecting the top-ranked documents as the supplementary information.

[0021] Preferably, the dynamic knowledge base in step S2 supports automatic import and timed updates of multi-source data, including knowledge graph triples, financial news, and annual report data.

[0022] Preferably, in step S3, when the financial news text and the retrieved supplementary information are input into the financial sentiment analysis model, a sentiment-oriented search enhancement prompt strategy is adopted. The strategy includes: the news subject priority principle, that is, taking the current news facts as the core basis for sentiment judgment and the search information as an auxiliary reference; and a "cold water" defense mechanism, which is used to handle the contradiction between the search information and the news facts, and to execute the processing logic of ignoring, adopting or preventing overly conservative judgments according to the degree of contradiction.

[0023] Preferably, the first stage of supervised fine-tuning adopts a low-rank adaptive parameter efficient fine-tuning method, so that the model learning includes a standardized output format that includes key information identification, multi-dimensional in-depth analysis and final sentiment conclusion; the training data for the second stage of direct preference optimization covers six scenarios: retrieval consistency, retrieval contradiction, retrieval supplementation, no retrieval results, retrieval noise and information overload, and contains preference pairs for at least 11 sub-scenarios.

[0024] A financial sentiment analysis system based on retrieval enhancement and preference optimization is characterized by comprising: a dynamic knowledge base management subsystem for storing and managing financial domain knowledge and supporting automatic import and periodic updates of multi-source data; a hybrid retrieval enhancement subsystem for retrieving relevant supplementary information from the dynamic knowledge base in response to input financial news text, including a query rewriting module, a semantic retrieval module, a keyword retrieval module, a fusion ranking module, and a fine-ranking module; and a financial sentiment analysis model subsystem equipped with a large language model finely tuned in two stages for analyzing the financial news text and the supplementary information and outputting sentiment analysis results; the two-stage fine-tuning includes supervised fine-tuning for format alignment and direct preference optimization for analysis logic alignment.

[0025] Preferably, the system supports full-stack private deployment, with all components deployed on local servers, eliminating the need to call external cloud application interfaces; wherein, the financial sentiment analysis model and the embedded model are optimized for video memory through quantization techniques, and can run on a single consumer-grade graphics processor.

[0026] Preferably, the hybrid retrieval enhancement subsystem further includes a tool invocation workflow module, which is used to autonomously decide whether to perform a retrieval based on the tool invocation capability of the large language model, and to forcibly trigger a retrieval when a keyword is detected but the model has not invoked a tool.

[0027] The present invention has the following beneficial effects:

[0028] Significantly improves analytical accuracy and reasoning depth.

[0029] 1. This invention, through the synergistic effect of retrieval enhancement generation and model fine-tuning, improves the accuracy of financial sentiment analysis from 77.53% to 83.27% on the Chinese benchmark set, and by up to 12.82 percentage points on the English benchmark. Through direct preference optimization training, the model's deep thinking ratio is improved by an average of 33.3%, enabling the model to spontaneously perform multi-dimensional, forward-looking professional financial reasoning, rather than simple keyword matching.

[0030] 2. Effectively suppresses retrieval noise and enhances analytical robustness. This invention designs a retrieval enhancement strategy for sentiment analysis tasks, including a "news subject priority" principle and a "cold water" defense mechanism. Through a three-level conflict arbitration strategy (A / B / C), it effectively prevents retrieval noise such as historical contradictory information and irrelevant content from interfering with sentiment judgment, thus solving the core problem in existing technologies where retrieval information may mislead the model.

[0031] 3. Ensuring data security and achieving independent control. All components of this invention support full-stack private deployment without calling any third-party cloud APIs. Through model quantization and multi-GPU automatic allocation technology, the entire system can run offline on a single consumer-grade GPU (such as an RTX 4090), with a memory usage as low as 4-6GB, completely eliminating the risk of data leakage during data transmission, avoiding API call costs and network latency, and meeting the stringent requirements of financial institutions for data sovereignty and regulatory compliance.

[0032] Example 1: Sentiment Analysis of Financial News Based on Retrieval Consistency Scenarios

[0033] This embodiment uses a news report published by a technology company stating that "net profit in the third quarter of 2024 increased by 20% year-on-year" as an example to demonstrate the processing flow of this invention when the retrieved information is consistent with the original text.

[0034] First, the system receives the news text as input. The hybrid retrieval enhancement subsystem queries and rewrites the news, generating extended queries such as "net profit of a certain technology company in Q3 2024". Then, semantic retrieval and BM25 keyword retrieval are used to coarsely retrieve relevant documents from the dynamic knowledge base, such as the company's previous quarterly financial report and industry average growth rate. After fusing the two retrieval results using the RRF algorithm, the CrossEncoder re-ranking model performs fine ranking, ultimately selecting the three most relevant supplementary information items.

[0035] Next, the financial sentiment analysis model receives the original news and supplementary search information. The model integrates preference optimization training data for RAG scenarios. For the "search consistency" scenario, its positive example strategy is "deep multidimensional analysis." Based on this, the model generates the following analysis results: "Key information identification: A technology company's net profit increased by 20% year-on-year in Q3 2024, exceeding market expectations; multidimensional deep analysis: Combining search information, the company's net profit growth exceeded 15% for two consecutive quarters, and its gross profit margin steadily improved, indicating enhanced profitability of its core business; final sentiment: positive." This output format is standardized, the analysis logic is clear, and it fully utilizes search information to verify and deepen the judgment of the original text, validating the effectiveness of this invention in the search consistency scenario.

[0036] Example 2: Sentiment Analysis of Financial News Based on Contradictory Retrieval Scenarios

[0037] This embodiment uses a news report from a bank stating that "the non-performing loan ratio will drop to 1.2% in 2024" as an example. However, the dynamic knowledge base contains a recently released historical information stating that "the bank was punished by regulatory authorities for illegal lending," demonstrating the ability of this invention to handle information contradictions.

[0038] After retrieving the aforementioned contradictory information, the system did not simply ignore it as noise. Instead, it triggered the "cold water" defense mechanism within the RAG (Relational Aggregator) strategy for sentiment analysis. This mechanism determined that the retrieved "regulatory penalty" information directly relates to the bank's compliance operations and future risks, falling under "Scenario B: The search result directly refutes the current news fact." Therefore, the system adopted the contradictory information and executed the corresponding logic in the A / B / C three-level conflict arbitration strategy.

[0039] Ultimately, the financial sentiment analysis model outputs the following results: "Key information identification: The non-performing loan ratio has decreased to 1.2%, superficially indicating improved asset quality; however, the retrieved information shows that the bank was recently penalized for illegal lending, indicating that potential risks still exist. Multi-dimensional in-depth analysis: The decrease in the non-performing loan ratio may have been achieved through write-offs or transfers, failing to fully reflect the true asset quality. Regulatory penalties are important forward-looking indicators, suggesting deficiencies in the company's internal controls, and future profitability may be affected by fines and confiscations. Final sentiment: Negative." This embodiment demonstrates that the present invention can effectively identify and rationally utilize contradictory information to make a final judgment consistent with the deep logic of finance, overcoming the shortcomings of existing technologies that are misled or simply ignored by retrieved information.

[0040] Example 3: Full-Stack Private Deployment and Dynamic Knowledge Base Update

[0041] This embodiment describes the deployment and operation of the present invention in a financial institution's intranet environment. A securities firm's risk control department wants to conduct real-time sentiment analysis on thousands of newly added internal news items and regulatory announcements daily without connecting to the external network.

[0042] According to the privatization deployment scheme of this invention, the brokerage firm completed the system installation on a server equipped with a single NVIDIA RTX 4090 (24GB VRAM). The 9-parameter financial sentiment analysis model runs in INT4 quantization format, consuming approximately 5GB of VRAM; the 4-parameter embedding model runs in INT8 quantization, consuming approximately 4GB of VRAM; the Reranker and query rewriting models share the remaining VRAM. All model weights are pre-downloaded locally, and offline environment variables are set at system startup to ensure no network connection.

[0043] The scheduled task of the dynamic knowledge base management subsystem is configured to run daily at 2:00 AM. This task automatically crawls newly added research reports and announcements from the brokerage's internal database, while simultaneously using a local OCR model to recognize the latest annual report PDF. After text cleaning and segmentation, the data is vectorized by the Embedding model and stored in the local Qdrant vector database. Before the start of trading the following day, the system automatically updates the knowledge base. When a risk control analyst inputs "A listed company released a preliminary loss announcement for the first quarter of 2025," the system retrieves the latest supply chain information and industry regulatory updates for the company that were added to the database the previous night within milliseconds. It then analyzes the information in conjunction with the news text and outputs a sentiment analysis report including professional financial indicators and the impact on the industrial chain. The entire process involves data remaining within the internal network and requires no manual intervention, fully demonstrating the advantages of this invention in data security, autonomy, and real-time performance.

Claims

1. A financial sentiment analysis method based on retrieval enhancement and preference optimization, characterized in that, Includes the following steps: Step S1: Obtain the financial news text to be analyzed; Step S2: Based on a preset hybrid retrieval strategy, retrieve supplementary information related to the financial news text from the dynamic knowledge base; the hybrid retrieval strategy includes semantic retrieval and keyword retrieval, and optimizes the retrieval results through ranking fusion and re-ranking algorithms; Step S3: Input the financial news text and the retrieved supplementary information into the financial sentiment analysis model, which is a large language model that has undergone two-stage fine-tuning. The two-stage fine-tuning includes a first-stage supervised fine-tuning to align the output format and a second-stage direct preference optimization to align the analysis logic, wherein the training data for the direct preference optimization covers a variety of retrieval enhancement scenarios; Step S4: Obtain the sentiment analysis results output by the financial sentiment analysis model. The sentiment analysis results include at least the sentiment polarity judgment and its analytical basis.

2. The financial sentiment analysis method based on retrieval enhancement and preference optimization according to claim 1, characterized in that, The hybrid retrieval strategy in step S2 specifically includes: rewriting and expanding the financial news text to generate multiple semantically equivalent expanded queries; performing coarse recall on each expanded query through semantic retrieval path and keyword retrieval path respectively, wherein the semantic retrieval path calculates vector similarity based on the Embedding model, and the keyword retrieval path calculates word frequency matching score based on the BM25 algorithm; using a reciprocal ranking fusion algorithm to merge and rank the two retrieval results; and using a cross-encoder re-ranking model to fine-rank the merged candidate documents, selecting the top-ranked documents as the supplementary information.

3. The financial sentiment analysis method based on retrieval enhancement and preference optimization according to claim 1, characterized in that, The dynamic knowledge base in step S2 supports automatic import and timed updates of multi-source data, including knowledge graph triples, financial news, and annual report data.

4. The financial sentiment analysis method based on retrieval enhancement and preference optimization according to claim 1, characterized in that, In step S3, when the financial news text and the retrieved supplementary information are input into the financial sentiment analysis model, a retrieval enhancement prompt strategy oriented towards sentiment analysis is adopted. The strategy includes: the news subject priority principle, that is, taking the current news facts as the core basis for sentiment judgment and the retrieval information as an auxiliary reference; and a "cold water" defense mechanism, which is used to handle the contradiction between the retrieval information and the news facts, and to execute the processing logic of ignoring, adopting or preventing overly conservative judgments according to the degree of contradiction.

5. The financial sentiment analysis method based on retrieval enhancement and preference optimization according to claim 1, characterized in that, The first stage of supervised fine-tuning employs a low-rank adaptive parameter efficient fine-tuning method, enabling the model learning to include a standardized output format encompassing key information identification, multi-dimensional in-depth analysis, and final sentiment conclusions. The second stage of direct preference optimization uses training data covering six scenarios: retrieval consistency, retrieval contradiction, retrieval supplementation, no retrieval results, retrieval noise, and information overload, containing preference pairs for at least 11 sub-scenarios.

6. A financial sentiment analysis system based on retrieval enhancement and preference optimization, characterized in that, include: The dynamic knowledge base management subsystem is used to store and manage knowledge in the financial field, and supports automatic import and scheduled updates of multi-source data; The hybrid retrieval enhancement subsystem, in response to input financial news text, retrieves relevant supplementary information from the dynamic knowledge base, and includes a query rewriting module, a semantic retrieval module, a keyword retrieval module, a fusion ranking module, and a fine ranking module; The financial sentiment analysis model subsystem is equipped with a large language model that has undergone two-stage fine-tuning. It is used to integrate the financial news text with the supplementary information for analysis and output sentiment analysis results. The two-stage fine-tuning includes supervised fine-tuning for format alignment and direct preference optimization for analysis logic alignment.

7. The financial sentiment analysis system based on retrieval enhancement and preference optimization according to claim 6, characterized in that, The system supports full-stack private deployment, with all components deployed on local servers, eliminating the need to call external cloud application interfaces; the financial sentiment analysis model and the embedded model are optimized for video memory using quantization techniques, enabling them to run on a single consumer-grade graphics processor.

8. The financial sentiment analysis system based on retrieval enhancement and preference optimization according to claim 6, characterized in that, The hybrid retrieval enhancement subsystem also includes a tool invocation workflow module, which is used to autonomously decide whether to perform a retrieval based on the tool invocation capability of the large language model, and to force a retrieval when a keyword is detected but the model has not invoked a tool.