LLM實作共學讀書會-第六組
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 1/9 Building Systems with the ChatGPT API (第六組) [TOC] --- ## 課程簡介 **課程連結**: https://learn.deeplearning.ai/chatgpt-building-system/lesson/1/introduction * Introduction * Language Models, the Chat Format and Tokens * Classification * Moderation * Chain of Thought Reasoning * Chaining Prompts * Check Outputs * Evaluation * Evaluation Part I * Evaluation Part II * Summary ## Language Models, the Chat Format and Tokens :::info 在本課程中,將深入研究大型語言模型(LLM)的工作原理,以及它們如何影響使用者提示時的輸出。以下是本課程中關於LLM、聊天格式和標記的重點摘要 ![image](https://hackmd.io/_uploads/B1RPf5XO6.png) 1. LLM的工作原理:大型語言模型實際上並不是重複預測下一個單詞,而是重複預測下一個標記。這些模型擅長根據上下文推理並生成有用的答案。 2. 聊天格式:聊天格式是一種指定系統和用戶訊息的方式,用於建立複雜的多步驟應用程式。這種格式可以幫助系統理解使用者的請求並生成相應的回應。 3. Tokens(標記):LLM使用標記來處理輸入和生成輸出。標記可以幫助模型理解上下文並生成相應的回應。同時,標記也影響著模型的成本和效率。 ::: * 大型語言模型有兩種,Base LLM(基石模型)、Instruction Turned LLM ** Base LLM : 根據文字訓練資料重複預測下一個單字 ** Instruction Turned LLM : 會嘗試遵循指令 如何從Base LLM 轉為 Instruction Turned LLM通常涉及以下步驟: 1. 微調模型:在訓練完基礎LLM後,可以透過在較小的範例集上微調模型,使輸出遵循特定的輸入指令。這可以通過創建訓練集來進行額外的微調,以使模型學會預測符合特定指令的輸出。 2. 人類評級:根據標準獲得對許多不同LLM輸出的質量的人類評級,例如輸出是否有幫助、誠實和無害。這些評級可以幫助您了解LLM輸出的質量,並指導進一步的調整。 3. 強化學習:使用基於人類回饋的強化學習(RLHF)來進一步調整LLM,以增加其產生更高評級輸出的可能性。這可以幫助提高LLM輸出的質量,使其更符合您的期望。 ## Classification :::info 針對輸入進行分類和評估的任務,以確保系統的品質和安全。 ::: - 建立客戶服務助理範例 -首先對查詢類型進行分類,然後根據該分類確定要使用哪些指令 -用戶訊息是:「我希望您刪除我的個人資料和我的所有用戶資料。」 ![image](https://hackmd.io/_uploads/rkei0cm_6.png) -從模型的分類來看,帳戶管理是主要類別,關閉帳戶是次要類別。 ![image](https://hackmd.io/_uploads/HkLuksmdT.png) ## Moderation :::info 1. 針對用戶輸入進行內容審核,以確保用戶以負責任的方式使用系統,並且沒有試圖濫用系統。 2. OpenAI的審核API可以幫助識別和過濾各種類別的禁止內容,以確保內容符合使用政策。 3. 協助開發人員識別和過濾仇恨、自殘、性和暴力等各種類別的禁止內容。 ::: - 範例 ![image](https://hackmd.io/_uploads/BJEvDa7dT.png) - 此輸入暴力分數比其他類別高一點 - 如果您正在建立兒童應用程式或其他應用程序,您可以更改策略,以便對使用者可以輸入的內容更加嚴格。 ![image](https://hackmd.io/_uploads/Sy7fOTmua.png) ## Chain of Thought Reasoning :::info 1. 該部分涉及處理輸入的任務,通常透過一系列步驟獲取輸入並產生有用輸出。 2. 這一過程可以通過連結多個提示來拆分複雜的任務,以便更好地處理。 3. 語言模型在遵循複雜指令方面表現出色,因此將複雜任務分解為一系列更簡單的子任務是一種有效的策略。 ::: - 要求模型 use the following format ![image](https://hackmd.io/_uploads/S1Uph6X_6.png) - 模型輸出結果 ![image](https://hackmd.io/_uploads/BJerxATmup.png) ## Chaining Prompts :::info 1. 主要討論了將複雜的任務拆分為一系列更簡單的子任務的策略。這種方法稱為“chain of thought reasoning”,它通過將多個提示連結在一起,以實現更複雜的任務。 2. 在這個過程中,每個提示都可以產生一個或多個子提示,這些子提示可以幫助系統更好地理解用戶的輸入並提供更好的回答。通過連結多個提示,系統可以更好地處理複雜的任務,提高系統的效率和準確性。 ::: - 對輸入的客戶查詢進行分類後,它是帳戶問題或產品問題。然後根據狀態你可能會做一些不同的事情。每個子任務僅包含任務的單一狀態所需的指令,這使得系統更易於管理,確保模型具有執行任務所需的所有信息,並降低了錯誤的可能性 - 可以降低成本,因為更長的提示和更多的token運行成本更高,並且可能會概述所有步驟。 - 可以更輕鬆地測試哪些步驟可能更頻繁地失敗,或讓人員參與特定步驟的循環。 ![image](https://hackmd.io/_uploads/HyCX7RXuT.png) ## Check Outputs :::info 1. 檢查系統產生的輸出的重要性。在向使用者顯示輸出之前檢查輸出對於確保提供給使用者或在自動化流程中使用的回應的品質、相關性和安全性非常重要。 2. 使用Moderation API來過濾和審核系統本身產生的輸出。這可以幫助系統更好地理解用戶的輸入並提供更好的回答。此外,可以使用模型的附加提示來評估輸出品質,以確保輸出符合預期。 ::: - 檢查輸出是否確實基於提供的產品信息 ![image](https://hackmd.io/_uploads/B1iti07dT.png) - 這個輸出沒有被標記(flagged:false)並且在所有類別中的得分都非常低。一般來說,檢查輸出也很重要。例如,如果您要為敏感受眾建立聊天機器人,則可以使用較低的閾值來標記輸出。 ![image](https://hackmd.io/_uploads/HJ0qi0m_a.png) ## Evaluation :::info "Build an End-to-End System" 是指建立一個完整的端到端系統,該系統可以處理從輸入到輸出的整個流程。在這個過程中,系統需要能夠有效地處理用戶的輸入,並生成準確、相關且安全的輸出。 這個過程包括以下步驟: 1. 檢查輸入:系統需要能夠檢查用戶的輸入,並確保它符合系統的要求。 2. 處理輸入:系統需要能夠處理用戶的輸入,並提取相關的信息以進行後續處理。 3. 生成輸出:系統需要能夠使用處理後的信息生成準確、相關且安全的輸出。 4. 檢查輸出:系統需要能夠檢查生成的輸出,並確保它符合系統的要求。 5. 提供回饋:系統需要能夠提供回饋,以幫助用戶更好地理解輸出並提供更好的回答。 ::: - 建立客戶服務助理end to end範例 1. 檢查輸入以查看它是否標記了審核 API ![image](https://hackmd.io/_uploads/ryFnJJ4uT.png) 2. 提取產品清單 ![image](https://hackmd.io/_uploads/By_CyJVOa.png) 3. 找出產品資訊 ![image](https://hackmd.io/_uploads/HJ_ke1Eu6.png) 4. 用模型回答使用者問題 ![image](https://hackmd.io/_uploads/Bk6bxyEd6.png) - 輸出結果 ![image](https://hackmd.io/_uploads/BJUt7kEua.png) - Chat with the chatbot! ![image](https://hackmd.io/_uploads/HJ7_SkVdT.png) - UI介面 ![image](https://hackmd.io/_uploads/rk7iByNua.png) ## Evaluation Part I :::info 開發基於LLM的應用程式時,對系統進行評估的第一部分。在這個過程中,系統需要能夠處理用戶的輸入,並生成準確、相關且安全的輸出。 1. 在這個過程中,可以使用測試集來評估系統的性能。測試集是一組已知的輸入和輸出,用於測試系統的性能。通過使用測試集,可以確定系統是否能夠正確地處理輸入並生成正確的輸出。 2. 此外,還可以使用交叉驗證來評估系統的性能。交叉驗證是一種評估機器學習模型性能的技術,它將數據集分成多個子集,然後使用其中一個子集作為測試集,其餘子集作為訓練集。這樣可以確保模型在不同的數據集上進行評估,從而提高評估的準確性。 ::: ## Evaluation Part II :::info 1. 使用人工評估來評估系統的性能。人工評估是指由人類評估系統生成的輸出,以確定它是否符合預期。這種方法可以幫助確定系統是否能夠生成準確、相關且安全的輸出,並提供改進系統的建議。 2. 此外,還可以使用自動評估來評估系統的性能。自動評估是指使用自動化工具來評估系統生成的輸出,以確定它是否符合預期。 ::: ## 關鍵概念與定義 本章節 ## 實際應用和案例研究 ## 摘要與思維導圖 ## 問題討論與反思

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully