### [AI / ML領域相關學習筆記入口頁面](https://hackmd.io/@YungHuiHsu/BySsb5dfp) #### [Deeplearning.ai GenAI/LLM系列課程筆記](https://learn.deeplearning.ai/) ##### GenAI - [Large Language Models with Semantic Search。大型語言模型與語義搜索 ](https://hackmd.io/@YungHuiHsu/rku-vjhZT) - [LangChain for LLM Application Development。使用LangChain進行LLM應用開發](https://hackmd.io/1r4pzdfFRwOIRrhtF9iFKQ) - [Finetuning Large Language Models。微調大型語言模型](https://hackmd.io/@YungHuiHsu/HJ6AT8XG6) ##### RAG - [Preprocessing Unstructured Data for LLM Applications。大型語言模型(LLM)應用的非結構化資料前處理](https://hackmd.io/@YungHuiHsu/BJDAbgpgR) - [Building and Evaluating Advanced RAG。建立與評估進階RAG](https://hackmd.io/@YungHuiHsu/rkqGpCDca) - [[GenAI][RAG] Multi-Modal Retrieval-Augmented Generation and Evaluaion。多模態的RAG與評估 ](https://hackmd.io/@YungHuiHsu/B1LJcOlfA) - [[GenAI][RAG] 利用多模態模型解析PDF文件內的表格](https://hackmd.io/@YungHuiHsu/HkthTngM0) - [[GenAI][RAG] Prompt Engineering for Multimodal Model](https://hackmd.io/@YungHuiHsu/rJzaU3LSC)) --- ## [2024.06。LangGPT:超越文字,多模态提示词在大模型中的创新实践(langgpt作者云中江树)](https://www.youtube.com/watch?v=0tNoq9Z7gTI) 筆記 - 文章[在清华与中国AIGC大会的分享:多模态AI大爆发,多模态提示词与智能体](https://mp.weixin.qq.com/s/Aan9NXO_vEZ9h0YrugpoGQ) - [LangGPT —— 人人都可编写高质量 Prompt ](https://github.com/langgptai/LangGPT/blob/main/README_zh.md) --- #### 多模態侷限性(8:20) 使用gpt-4o提取資料仍存在大量幻覺問題 - 場景理解能力不足 ![image](https://hackmd.io/_uploads/Hyc3M5US0.png =400x) - 資訊遺漏 ![image](https://hackmd.io/_uploads/HkxTz9US0.png =400x) - 資訊錯位 ![image](https://hackmd.io/_uploads/BkV4f5Ir0.png =400x) - 胡亂編造 ![image](https://hackmd.io/_uploads/S1IBfq8B0.png =400x) - 死循環 ![image](https://hackmd.io/_uploads/rJ53z9IHR.png =400x) #### 如何寫好多模態提示詞(10:15) ##### [OPENAI Prompt engineering](https://platform.openai.com/docs/guides/prompt-engineering) * [x] 在提問中中包含詳細資訊以獲得更相關的答案 Include details in your query to get more relevant answers * [x] 要求模型採用某種人格(角色扮演) Ask the model to adopt a persona * [x] 使用分隔符清楚地指出輸入的不同部分 Use delimiters to clearly indicate distinct parts of the input * [x] 指定完成任務所需的步驟 Specify the steps required to complete a task * [x] 提供範例 Provide examples * [x] 指定輸出的期望長度 Specify the desired length of the output ![image](https://hackmd.io/_uploads/BJ9HdqIH0.png =600x) - 準確清晰的表述 - 提取**全部的**資訊 ![image](https://hackmd.io/_uploads/H1FVF9IBR.png =600x) - 扮演專家角色 ![image](https://hackmd.io/_uploads/BklDYqLBA.png =600x) - 提供範例(In-Context Learning) ![image](https://hackmd.io/_uploads/rkVpK9LH0.png =600x) - 指定輸出格式 ![image](https://hackmd.io/_uploads/r1AZi9IHA.png =600x) - OPENAI API也可以[指定輸出格式](https://learn.microsoft.com/zh-tw/azure/ai-services/openai/how-to/json-mode?tabs=python) ```python= import os from openai import AzureOpenAI client = AzureOpenAI( azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT"), api_key=os.getenv("AZURE_OPENAI_API_KEY"), api_version="2024-03-01-preview" ) response = client.chat.completions.create( model="gpt-4-0125-Preview", # Model = should match the deployment name you chose for your 0125-Preview model deployment response_format={ "type": "json_object" }, messages=[ {"role": "system", "content": "You are a helpful assistant designed to output JSON."}, {"role": "user", "content": "Who won the world series in 2020?"} ] ) ``` #### 多模態提示詞的獨有方法 - 標記提示法-減少幻覺 - 在圖像上添加視覺符號 如何在大量資料上自動化達成? ![image](https://hackmd.io/_uploads/By3iM28rA.png =600x) - 標記提示法-提高答案精準度 - 用標記指定模型關注區域進行重點解讀 同樣的問題,如何在大量資料上自動化達成? ![image](https://hackmd.io/_uploads/B1hQmnIS0.png =600x) - 標記集提示法 - 既然能自動便是進行標記,其實也不用LLM了...? ![image](https://hackmd.io/_uploads/BkGbNn8SR.png =600x) ![image](https://hackmd.io/_uploads/H1xD438SA.png =600x) #### 如何實現自動化標準化標記? - 透過SAM等通用基礎的視覺模型進行目標檢測、語意分割來標記 - 標記後對於小目標的理解能力強大 - 按照序號理解、容易DEBUG、不易遺漏 ![image](https://hackmd.io/_uploads/HJAnNnIH0.png =600x) ![image](https://hackmd.io/_uploads/SkieBhLH0.png =600x) :question:如何應用在表格資料上、標記所有欄位? ## Ref - [Multimodal CoT Prompting](https://www.promptingguide.ai/techniques/multimodalcot) - [2024.06。LangGPT:超越文字,多模态提示词在大模型中的创新实践(langgpt作者云中江树)](https://www.youtube.com/watch?v=0tNoq9Z7gTI) - [2024.06。Pratik Bhavsar。Galileo Labs。Survey of Hallucinations in Multimodal Models](https://www.rungalileo.io/blog/survey-of-hallucinations-in-multimodal-models?utm_medium=email&_hsenc=p2ANqtz-8kWinr0h3mSULzr3FtJcPFYT6NITz2fWAXj-_KEnI4U09K-5BaLl9GplL9cc7ZE3Atcw1ZHrS4axMpJxWYtA2rZPHwaQ&_hsmi=314027574&utm_content=314028677&utm_source=hs_email) ![image](https://hackmd.io/_uploads/HJpYNe-PC.png =400x) >  ![image](https://hackmd.io/_uploads/HJ4O4eWDA.png =800x)