*本文為亞馬遜云科技博客文章,僅用于技術分享,不構成投資建議或金融決策支持。文中涉及的公司名稱僅用于技術示例,不代表亞馬遜云科技觀點或與這些公司的商業合作關系。
背景介紹
在當今這個信息爆炸的時代,金融市場每天都在產生海量的新聞資訊。這些新聞不僅僅是簡單的信息,更蘊含著豐富的企業動態、行業變化和潛在風險信號。一則新聞背后往往隱藏著復雜的事件鏈條——一家公司的高管變動可能與其新業務布局相關,而這個業務轉型又可能暗示著財務狀況以及股市的變化。
信息大爆炸的時代,新聞資訊對金融市場的影響力日漸加強。每一個投資者每天都需要關注大量的各類金融信息。對于金融投資機構而言,如何對海量資訊進行有效分析,提供更準確的投資決策輔助,從而增加自身金融服務的價值,提高用戶粘性,也是一個亟待解決的問題。
面對龐大的信息流,傳統的人工分析方式早已力不從心。為了有效地捕捉和分析這些復雜的關聯信息,我們需要一個智能化的解決方案。本文針對金融市場新聞資訊分析的場景,提出基于 LLM+GraphRAG 的解決方案,通過 LLM 對新聞資訊進行分析,提取圖數據的三元組信息(實體-關系-實體),并存儲于圖數據庫中。在進行知識問答時,從知識圖譜中檢索相關聯的內容,轉化為更豐富的上下文的信息提供給 LLM,以提高針對復雜金融資訊場景的智能知識問答的準確度。
需求分析
對金融資訊進行分析的目的在于全面了解金融市場及特定投資標的的動態,尤其是某些重要事件,判斷其對金融市場的影響,從而做出不同的投資決策。因此,核心的需求集中在三點:一是信息覆蓋的范圍必須廣,需要涵蓋整個市場的主要資訊;二是針對特定投資標的,需要識別事件的重要性,適當剔除對投資標的行情影響不大的信息,且可以按照重要性進行排序;三是需要識別出新聞資訊與投資標的的關系,與投資標的進行關聯,以輔助用戶針對投資標的進行分析。在具體的落地方案上,可以通過智能應答機器人,為用戶提供金融市場投資的輔助分析,基于用戶的問題將新聞資訊的分析結果整合并答復用戶。
GenAI 和知識圖譜的結合:構建可信、可解釋的 GraphRAG
在人工智能快速發展的今天,大語言模型(Large Language Model, LLM)憑借其強大的參數量和海量的訓練數據,展現出了優秀的自然語言理解和生成能力。然而,作為一個隱式生成模型,LLM 也面臨著“幻覺”問題和可解釋性不足的挑戰。為了克服這些局限性,業界普遍采用 Retrieval Augmented Generation(RAG)技術。RAG 通過檢索相關文檔片段來為模型提供知識支撐,提升回答的準確性。但在處理復雜的綜合性問題時,傳統 RAG 方法也顯得力不從心,因為它難以有效地連接和整合來自多個文檔的知識。
知識圖譜(Knowledge Graph)是通過圖結構來組織和展現知識關聯,它將實體(如企業、人物、產品)作為節點,實體間的各種關系作為邊,構建成一張信息網絡。這種結構不僅能直觀地展現數據間的關聯性,還具備極強的可解釋性。然而,知識圖譜的構建因場景而異 – 企業風控領域關注公司關聯關系,旅游服務領域側重地理景點連接,醫療領域則構建疾病癥狀知識網絡,每個領域都需要根據其特定需求來設計和構建適合的知識結構。
將 GenAI 與知識圖譜結合,我們可以實現雙向賦能:
-
利用大模型的自然語言處理能力,輔助知識圖譜的自動構建。
-
借助知識圖譜的結構化信息,增強 RAG 系統處理復雜關聯性問題的能力。
這種結合讓我們能夠構建一個既有 AI 效率,又有知識圖譜可解釋性的智能系統。通過將散落在不同新聞報道中的信息片段進行智能提取和關聯,我們構建了一個動態演進的知識圖譜。這個知識圖譜不僅能夠清晰地展現近期企業發展動態,更能夠為信用風險分析提供數據支撐,幫助分析師快速識別潛在的風險信號。
技術方案
事理圖譜的構建
為了構建一個全面的企業事理圖譜,我們首先定義了金融領域的核心實體類型和關系類型。在實體層面,我們關注五類關鍵實體:企業(Organization)、事件(Event)、時間(Date)、人物(Person)和產品(Product)。這些實體構成了圖譜的基礎節點。
在關系層面,我們構建了一個多維度的關系網絡,以捕捉企業生態系統中的復雜互動:
-
企業間關系:刻畫企業之間的競爭、合作、投資等互動
-
人事關系:追蹤企業與人物之間的雇傭、任職變動等關聯
-
事件關聯:記錄企業參與的各類事件,以及事件之間的時序關系
為了確保實體和關系抽取的準確性,我們采用了 Claude Sonnet 3.5 大語言模型作為核心引擎。Claude 通過深度語義理解,從新聞文本中識別實體并判斷其關系類型。這種方式相比傳統的規則基礎方法,能夠更好地理解文本中的隱含關系和上下文信息。
經過處理的實體和關系數據最終被存儲在 Amazon Neptune 圖數據庫中,形成一個動態更新的知識網絡。Neptune 的圖數據庫特性為我們提供了高效的圖查詢能力,使得我們能夠快速追蹤企業發展脈絡,發現潛在的風險信號。這個事理圖譜不僅記錄了靜態的企業知識,更重要的是通過事件和時序關系的刻畫,展現了企業發展的動態過程,為后續的風險分析提供了可靠的數據基礎.
我們選取了一些 LLM 進行抽取實體之后的輸出作為展示:
有了 LLM 抽取出來的實體信息并且梳理了實體之間的事件關聯之后,我們可以把這些數據灌入圖數據庫,來構建我們的知識圖譜便于后續的遍歷。
事理圖譜的信息查找和可視化
基于 Neptune 圖數據庫強大的圖查詢能力,我們實現了多維度的信息檢索和知識探索。
在查詢層面,Neptune 支持多種查詢模式:
-
實體關聯查詢:快速獲取某個企業的所有相關實體,如競爭對手、合作伙伴、核心人員等。
-
事件發展追蹤:通過”Prior Event”關系,追溯企業相關事件的完整時序脈絡。
-
競爭態勢分析:基于”Competitors”關系,繪制企業的競爭全景圖。
如從 Neptune 圖數據庫中檢索屬性 name
的值等于 “Apple” 的頂點,并返回這些頂點的屬性值映射:
gremlin> g.V().has('name', 'Apple').valueMap()
==>[name:[Apple]]
獲取與頂點‘Apple’相連接的所有邊及其相鄰頂點的路徑,篩選出競爭關系和合作關系的組織:
# 競爭關系
gremlin> g.V().has('name', 'Apple').bothE('Competitors').otherV().path()
# 合作關系
gremlin> g.V().has('name', 'Apple').bothE('Partners').otherV().path()
在可視化呈現方面,我們借助 Neptune Graph Explore 功能進行直觀的圖形化展示方式。如圖所示,以蘋果公司(Apple)為中心,我們可以清晰地看到:
-
競爭關系網絡:Google、Tesla、華為、Epic Games 等競爭對手
-
商業生態:與 Curiosity Inc 的合作伙伴關系
-
人員關聯:如 Eddy Cue 等核心管理人員
-
事件發展鏈:通過”Prior Event”關系串聯起的事件發展脈絡,從 2023 年 11 月到 2024 年 3 月的一系列關鍵事件
事理圖譜的更新
同一個事件或公司常常會出現在不同媒體的報道中,且表述方式各異。為了保持圖譜的一致性和準確性,我們需要一套有效的實體對齊和消歧機制,確保不會創建重復的實體節點。根據不同實體類型的特點,我們采用了差異化的對齊策略:
“短文本”企業對齊
對于短文本,如企業實體,由于其名稱通常較為規范且簡短(如”Apple Inc”、”AAPL”),我們主要采用字符串編輯距離(Edit Distance)進行相似度計算。這種方法能夠有效處理公司全稱與簡稱的對應、不同語言的企業名稱表述等細微的拼寫差異或格式變化。
“長文本”事件對齊
對于長文本,如事件實體,其特點是描述往往較長且形式多樣。例如,同一個企業并購事件可能有多種不同的表述方式。針對這種情況,我們采用語義相似度匹配,利用 BGE 系列 embedding 提取事件描述的核心語義特征,計算事件描述之間的語義相似度,判斷是否為同一事件。
通過這種分層的對齊策略,我們既保證了對齊的準確性,又提高了處理效率,使圖譜能夠準確反映最新的市場動態。
基于事理圖譜的知識增強問答(GraphRAG)
傳統的 RAG 方法通常只能檢索到單一文檔片段,難以處理需要多方面信息綜合分析的復雜問題。為此,我們設計了基于事理圖譜的知識增強問答系統(GraphRAG),通過圖譜的多維度查詢和關系推理,為大語言模型提供更全面的知識支撐。
多路知識檢索
我們的檢索策略采用雙重方式定位相關信息:
-
關鍵詞匹配:通過抽取問題中的關鍵實體(如公司名、人名、事件),直接定位圖譜中的相關節點。
-
語義搜索:利用向量相似度,找到語義相關但表達形式不同的實體和事件。
知識關系補充
僅有單個節點的信息是不夠的,我們通過圖的多跳查詢擴展相關關聯知識:
-
實體關系鏈接:追蹤實體之間的直接和間接關聯。時序脈絡梳理:通過事件的時序關系,構建完整的發展鏈條。
-
多維度關聯:綜合企業、人物、事件等多個維度的關聯信息。
知識融合問答
在知識融合問答階段,系統會將從圖譜中檢索到的結構化知識進行智能處理和整合,轉化為富有上下文的信息提供給 Claude。這些信息包含了實體的核心屬性與特征、實體之間的關聯類型與關系屬性,以及事件發生的時序脈絡與因果關聯。
例如,當分析一家科技公司的發展態勢時,系統不僅能提供該公司的基礎信息,還能梳理出其近期的重大事件、與競爭對手的互動關系、高管的人事變動等多維度信息。
這種基于圖譜的知識增強機制,使得系統能夠提供多角度的信息支撐,確保每個結論都能追溯到具體的圖譜數據,并通過關聯信息的整合實現更深層次的邏輯推理。這不僅提升了回答的準確性和可信度,更為復雜問題的分析提供了系統性的知識基礎。
我們截取了兩個樣例,通過例子的回答,我們發現 GraphRAG 在問題范圍比較寬泛情況下,回答的廣度上更加優秀。而這和實際海量金融行情新聞的特征是比較符合的。
Query | Answer(Vector RAG) | Answer(GraphRAG) | Accuray Winner | Comprehensive Winner |
Analyze recent trends of stock Apple? | Before I provide any analysis, please note that this information is for educational purposes only and should not be considered financial advice. Investors should always do their own research and consult with a qualified financial advisor before making investment decisions.\n\nRecent trends for Apple (AAPL) stock:\n\n1. Performance: Apple stock has shown strong performance in recent months, reaching new all-time highs.\n\n2. Product launches: The company’s recent product launches, including the iPhone 15 series and new MacBook models, have generally been well-received by the market.\n\n3. Services growth: Apple’s services segment, including Apple Music, iCloud, and the App Store, continues to show robust growth, contributing significantly to the company’s revenue.\n\n4. AI focus: Apple has been increasing its focus on artificial intelligence, particularly in its devices and software, which has garnered investor interest.\n\n5. Supply chain improvements: The company has been working on diversifying its supply chain, which may help mitigate future disruptions.\n\n6. Share buybacks: Apple continues its substantial share repurchase program, which can support the stock price.\n\n7. Dividend growth: The company has been consistently increasing its dividend, albeit at a modest rate.\n\n8. Market sentiment: As one of the largest companies by market capitalization, Apple stock is often influenced by broader market trends and macroeconomic factors.\n\nRemember, past performance does not guarantee future results, and stock prices can be volatile. Always consider your personal financial situation and risk tolerance before making investment decisions. | Before I provide any analysis, please note that this information is for educational purposes only and should not be considered financial advice. Investors should always do their own research and consult with a qualified financial advisor before making investment decisions.\n\nApple (AAPL) stock has shown some notable trends recently:\n\n1. Performance: Apple has generally outperformed the broader market in recent months, with the stock showing resilience despite some tech sector volatility.\n\n2. Product Cycle: The stock often experiences movement around new product launches and earnings reports. The anticipation of new iPhone models and other product releases can influence stock performance.\n\n3. Services Growth: There’s been increased focus on Apple’s services segment, which includes offerings like Apple Music, iCloud, and the App Store. This recurring revenue stream has been a key driver of growth.\n\n4. Market Cap Milestones: Apple has frequently traded as one of the world’s most valuable companies by market capitalization, often competing for the top spot.\n\n5. Dividend and Buybacks: Apple has maintained a dividend and share repurchase program, which can affect stock price and investor sentiment.\n\n6. Economic Factors: Like many tech stocks, Apple can be sensitive to macroeconomic factors such as interest rates, inflation, and global supply chain issues.\n\n7. AI and New Technologies: There’s growing interest in Apple’s potential moves in artificial intelligence and augmented reality, which could impact future stock performance.\n\nRemember, past performance does not guarantee future results. The stock market is inherently unpredictable, and many factors can influence a stock’s performance. | GraphRag provides a well-rounded view of Apple’s recent stock performance trends, touching on key factors like market resilience, product cycles, services growth, and external economic influences. The insights are accurate reflections of trends observed in the market, without specific inaccuracies or misleading statements. | GraphRag offers a detailed analysis of multiple aspects influencing Apple’s stock, including performance metrics, product cycles, services growth, market capitalization, dividends, macroeconomic factors, and future technology interests. This thorough examination provides a holistic view of the stock’s recent trends, making it comprehensive in its coverage. |
Who are Tesla’s competitors? | ?Tesla’s competitors??? ?Tesla faces competition from several companies in the electric vehicle (EV) and autonomous vehicle markets:\n\n1. **BYD**: A Chinese EV manufacturer that recently beat Tesla for the top spot in a competitive assessment of EV Original Equipment Manufacturers (OEMs) [citation:2].\n\n2. **SAIC Motor Corp. Ltd.**: This Chinese state-owned automobile manufacturer saw more new vehicle registrations in the European Union in July than Tesla [citation:3].\n\n3. **Volkswagen**: Europe’s best-selling car brand, which saw vehicle registrations rise by nearly 4% in the first seven months of 2024 [citation:3].\n\n4. **XPeng**: A Chinese EV maker that recently unveiled its first mass-market electric car, the MONA MO3, priced significantly lower than Tesla’s current offerings [citation:5].\n\n5. **Waymo** (Alphabet Inc.) and **Baidu Inc.**: Competitors in the robotaxi market, where Tesla is also aiming to establish dominance [citation:1].\n\n6. **General Motors (GM)** and **Ford**: Traditional automakers transitioning to EVs, though they have faced challenges in this transition [citation:6].\n\n7. **Uber**: While not a direct competitor in EV manufacturing, Uber is competing with Tesla in the autonomous vehicle market [citation:4].\n\nIt’s worth noting that the EV market is highly competitive and rapidly evolving, with both established automakers and new startups entering the field [citation:6]. | Tesla faces competition from several companies across different sectors:\n\n1. **In the electric vehicle market:**\n ? – **XPeng**, a Chinese EV manufacturer, is described as one of Tesla’s main rivals in China. XPeng has beaten Tesla to market with a mass-market electric car, competing directly in the lower-priced EV segment [citation:7].\n ? – **SAIC Motor Corp. Ltd.** surpassed Tesla in new vehicle registrations in the European Union in July 2024 [citation:11].\n ? – **Polestar** is mentioned as being impacted by Tesla’s price war in the EV market [citation:19].\n\n2. **In autonomous driving technology:**\n ? – XPeng is reportedly following Tesla’s approach by adopting pure vision driving for its Model F57 [citation:1].\n ? – **SODA.Auto** has adopted a strategy similar to Tesla’s for developing self-driving vehicle (SDV) tools [citation:13].\n\n3. **In the robotaxi market:**\n ? – **Uber Technologies** is a potential competitor, with plans to integrate GM’s Cruise vehicles into its ride-hailing network [citation:17].\n\n4. **In humanoid robotics:**\n ? – Several **Chinese companies** are developing their own humanoid robots, inspired by Tesla’s Optimus [citation:4][citation:5].\n\n5. **In the broader technology sector:**\n ? – Tesla is part of the ‘Magnificent 7’ group of influential tech companies, implying competition with other major tech firms [citation:25].\n\n6. **In energy storage:**\n ? – While not direct competitors, Tesla’s energy storage products contribute to grid management, potentially competing with traditional energy solutions [citation:6][citation:15].\n\nIt’s worth noting that Tesla maintains a strong position in brand loyalty despite this competition [citation:21]. | NaiveRag accurately highlights specific geopolitical tensions and macroeconomic challenges impacting the semiconductor industry, including U.S. export restrictions and inflation concerns. It also references the cyclical nature of the industry, providing a factual basis for its claims, which aligns with current industry trends. | GraphRag presents a more extensive list of both challenges and opportunities. It covers a variety of challenges, such as supply chain disruptions, talent shortages, and environmental concerns, and offers opportunities related to government investments and sustainability initiatives. This wider coverage provides a fuller understanding of the current landscape in the semiconductor industry. |
結語與展望
本文介紹了一個基于事理圖譜的智能金融分析系統 GraphRAG,通過將大語言模型 Claude 與知識圖譜技術相結合,為復雜的金融分析場景提供了創新解決方案。
不同于傳統 Vector RAG 方法僅能檢索單一文檔片段的局限,GraphRAG 特別適合處理需要多維度信息綜合分析的復雜問題。例如,當分析一家企業的信用風險時,系統能夠同時考慮其歷史經營事件、高管變動、競爭態勢、合作伙伴等多個維度的信息,通過圖譜的關聯關系,揭示出可能隱藏的風險信號。另外,由于金融市場強監管的特點,對基于 LLM 的智能化應用存在一定的準入門檻,而 GraphRAG 可以提高回答的可解釋性,增強答案的真實性驗證能力,對于 GenAI 在金融行業的落地推廣也有幫助。
未來,我們將繼續優化系統性能,探索更多的應用場景,為金融市場的智能分析提供更強大的技術支持。這個結合了最新 AI 技術的解決方案,展現了金融科技創新的無限可能。
*前述特定亞馬遜云科技生成式人工智能相關的服務僅在亞馬遜云科技海外區域可用,亞馬遜云科技中國僅為幫助您了解行業前沿技術和發展海外業務選擇推介該服務。
本篇作者
本期最新實驗《多模一站通 —— Amazon Bedrock 上的基礎模型初體驗》? 精心設計,旨在引導您深入探索Amazon Bedrock的模型選擇與調用、模型自動化評估以及安全圍欄(Guardrail)等重要功能。無需管理基礎設施,利用亞馬遜技術與生態,快速集成與部署生成式AI模型能力。??[點擊進入實驗] 即刻開啟 AI 開發之旅構建無限, 探索啟程!