《Database Copilot 在數據庫領域的落地-李粒.pdf》由會員分享,可在線閱讀,更多相關《Database Copilot 在數據庫領域的落地-李粒.pdf(63頁珍藏版)》請在三個皮匠報告上搜索。
1、Database Copilot 在數據庫領域的應用李粒,PingCAP AI LabAgenda數據庫運維領域的挑戰LLM 帶來的機遇PingCAP 的實踐Database Copilot 的未來挑戰數據庫運維領域的挑戰來自業務的挑戰故障恢復數據規模增長更低的延遲在線分析來自業務的挑戰數據規模增長更低的延遲來自業務的挑戰數據規模增長更低的延遲最佳實踐選用更合適的數據庫設計庫表結構索引優化并發控制內存管理HintBinding來自業務的挑戰TiDB Cloud 文檔:582TiDB 文檔:1095數據規模增長更低的延遲來自業務的挑戰在線分析來自業務的挑戰在線分析HTAPPMFinanceOpe
2、rationMarketing不熟悉 SQL來自業務的挑戰故障恢復來自業務的挑戰故障恢復MetricsLogsQueriesProfilingTiDB1000+1000+/sSlow QueriesSQL StatementTopSQL1min來自業務的挑戰故障恢復數據規模增長更低的延遲在線分析數據庫是一個復雜系統,難以被用戶完全掌握LLM 帶來的機遇過去的方法(傳統 AIOPS)Rule-Based/ML/DLhttps:/ 帶來的新能力In-context Learning ReasoningCoding/SQLFunction CallRule-Based/DL/RL任務復雜度任務泛化能
3、力LLM Capability(Corpus+API+Code+Loop)一些概念概念-LLM 應用類型https:/ 作為路由器,參與到流程判斷中,判斷需要使用的工具、召回、邏輯路徑等。人類的業務代碼人類提供Agent(Loop)多次調用產出LLM 可以重復進行某些循環步驟,以確保流程能夠持續進行,或確保結果滿足人類最初的目標。人類提供基本邏輯和提示,LLM 根據人類邏輯進行優化和調整,自主完成流程。人類提供Autonomous Agent多次調用產出LLM 可以重復進行某些循環步驟,以確保流程能夠持續進行,或確保結果滿足人類最初的目標。LLM 自主完成所有行動流程的初始化、工具接入、流程執
4、行。人類提供Silicon-based Life多次調用產出LLM 可以重復進行某些循環步驟,以確保流程能夠持續進行,或確保結果滿足人類最初的目標。LLM 自主完成所有行動流程的初始化、工具接入、流程執行?;诜答?,LLM 自主發起和確認每一次行動的目標概念-什么是 Copilot?https:/ 的實踐應用場景/已有工作/數據飛輪數據庫常見的 LLM 應用場景ChatBotNL2SQL數據庫診斷面向用戶PingCAP AI Lab-LLM 技術邏輯框架PingCAP LLM 應用的業務架構Chatbot-來自業務的挑戰數據規模增長更低的延遲TiDB Cloud 文檔:582TiDB 文檔:1
5、095Chatbot App-FlowChatbot App 的毒性檢測毒性檢測對齊使人工通用智能(AGI)與人類價值觀保持一致,并遵循人類意圖。引自 OpenAI,2022,Our approach to alignment research有害內容當代文本生成模型能夠生成有害語言,包括仇恨言論、侮辱、褻瀆和威脅。這些危害通常被歸類為“有害內容”這一總稱。引自 Deepmind,2021,Challenges in Detoxifying Language Models即插即用語言模型(PPLM)Chatbot App 的毒性檢測Chatbot 的毒性檢測Chatbot App 的毒性檢測C
6、hatbot App 的語料增強 分類數量百分占比超出應答范圍98.74%錯誤檢索結果6058.25%沒有相關文檔2322.33%LLM 幻覺1110.68%總共103100%最初 300 個問題的反饋Chatbot App 的語料增強RAGHuman:Whats TiDB Cloud?RankChunkScore1TiKV is.0.912TiDB is.0.873TiFlash is.0.834PD is.0.815TiUP is.0.796TiDB Cloud is.0.77RetrieveChatbot App 的語料增強ReRankDocumentation CorporaAdjus
7、ted Question-Chunk PairsRankRankChunkChunkScoreScore1 1TiKV is.0.912 2TiDB is.0.873 3TiFlash is.0.834 4PD is.0.815 5TiUP is.0.796 6TiDB Cloud is.0.77RankRankQuestionQuestionChunkChunkScoreScore1 1What is TiDB Cloud?TiDB Cloud is.12 2.0.873 3.0.834 4.0.815 5.0.796 6.0.77合并與排序,獲取總分 top 5 的語料Chatbot Ap
8、p 的語料增強Chatbot App-FlowChatbot-Copilot Type在用戶提問同時,獲取到用戶所在頁面、集群信息,一起更合理的為用戶達成目標。Chatbot 效果 TiDB Community 活躍提升 30%。覆蓋全渠道回答 TiDB 和 TiDB Cloud 相關問題。點踩率低于 2%。成為公司內員工學習 TiDB 和工作查詢標配。NL2SQL-來自業務的挑戰在線分析HTAPPMFinanceOperationMarketing不熟悉 SQLNL2SQL App-AgentNL2SQL App 的 Schema 增強NL2SQL App 的 Prompt 改寫用戶提來的問
9、題;抽取問題的關鍵詞;抽取可能潛在的 repo、user 等。嘗試對用戶的問題進行分解,并自己回答。最終根據所有的思考邏輯,寫出對應的 SQL。Self-Ask(Ofir Press,2022)NL2SQL App 的報錯自動調整NL2SQL App-AgentNL2SQL-Copilothttps:/tiinsight.vercel.app/NL2SQL 效果 終端用戶問題的可執行率超過 95%,準確率超過 90%。在內部用于業務人員的信息快速獲取。Diagnosis-來自業務的挑戰故障恢復MetricsLogsQueriesProfilingTiDB1000+1000+/sSlow Que
10、riesSQL StatementTopSQL1minDiagnosis App-AgentDiagnosis App-Multi AgentsDiagnosis App-Agents DefineAgents DefineAgents DefineSystem PromptSystem PromptDescriptionDescriptionPlannerPlannerDevelop a plan based on the Task and Standard Operating Procedure(SOP).If we consider SOP as a class,then the pla
11、n serves as an instance of SOP for a specific Task.Incorporate pertinent details from the Task into the steps of SOP.Ensure clarity,specificity,and unambiguity in each step of the plan to facilitate execution by the Engineer.I am tasked with creating the plan.I am only allowed to speak inmediately a
12、fter User or Critic.Only Engineer is allowed to speak immediately after Planner.If Planner is succeeded by Critic,the Critic is not permitted to directly utter TERMINATE at this time.EngineerEngineerAccountable for implementing plans of Planner.I am responsible for execute the plan from Planner.Foll
13、owing Engineer,only Executor or Critic is allowed to speak immediately.If Engineer outputs TERMINATE,only Critic can speak immediately.ExcutorExcutorExecute only the functions explicitly specified by the Engineer;refrain from engaging in additional tasks.I can only immediately speak when prompted by
14、 the Engineer for a function call.Post Executor,only the Engineer is permitted to speak immediately!Executor is prohibited from speaking immediately after Critic!CriticCriticAfter the Engineer outputs TERMINATE,evaluate whether the final message resolves the tasks mentioned in the first message.In c
15、ase of affirmation,replicate the output Engineer and add FINALLYTERMINATE to the end.If negative,provide details on the pending tasks.Do not select me unless the final non-system-role message from Engineer concludes with TERMINATE!Only Planner is allowed to speak after Critic immediately.If there is
16、 no GAP,Critic duplicates the output Engineer and appends FINALLYTERMINATE at the end immediately.Diagnosis App-SOPhttps:/ App-Multi-Agents&LoopDiagnosis App-產出穩定性https:/ App-知識庫/SOP 的生成https:/ 版本未來會以 Copilot 形式,提供在 TiDB Cloud 中Diagnosis 效果 支持對客戶和技術支持的每輪對話進行相關知識搜索、現狀分析和下一步建議。海外社區問題所有的工單,完全解放人力。TiDB
17、Cloud 工單的首輪回復,提高首單回復效率和整體的結單時間。內部診斷系統的實時建議,縮短 MTTR 時間。數據飛輪-準確率以 NL2SQL 為例 不同行為會自動化異步優化:點贊、分享:加入到語料中。點踩、修改 SQL:使用 Agent 對用戶的提問進行多次理解,生成多個 SQL。對多個 SQL 進行執行,LLM 根據執行結果評分是否滿足用戶問題。評分最高的加入到語料中。在生成多個 SQL 并執行之后,對 SQL 執行時長和執行計劃進行評分,選擇效率最高的執行計劃。使用 Agent 自動對熱門 SQL 進行索引優化。數據飛輪-Embedding Using Agents數據飛輪-測試以 NL2
18、SQL 為例 正面的反饋進入到測試集中,保證未來的迭代不會破壞之前的用例。負面的反饋,通過優化 Agents 的處理,將正確結果也存儲到測試集中。所有的運行結果,通過分類算法進行分類,使用問題增強方法對每一類問題補充對應的測試集。PingCAP AI Lab-技術棧擁抱社區LLamaIndexLangFuseLinguFlowAutoGenGPTLlamaNL2SQL:SpiderTiDB VectorTiDBPingCAP AI Lab-框架擴展性ChatBotNL2SQLDiagnosisMore Scenarios測試增強代碼檢查信息整理 知識庫管理Database Copilot 的未來挑戰Database Copilot 的未來挑戰診斷和運維自主探索根因并修復知識積累超出人類效率評價和優化對 Flow 和 Agent人際交互完全融入工作流