Editing
LLMs Usage FAQ in Mandarin
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== 如何讓 AI 處理長篇文章 == 📝 問題:上下文長度限制 LLMs 模型受到上下文窗口(context window)長度的限制,以翻譯長文章為例,由於無法一次處理全部內容,我們需要將文章分段進行處理。 💬 處理方式: 方法1:改成支援更長上下文窗口(context window)長度的模型,例如:Google Gemini 等: # GPT-4o: "16,384 max output tokens"<ref>[https://platform.openai.com/docs/models/gpt-4o Model - OpenAI API]</ref> 相當於 16,384/3 約 5,461 中文字 # gemini-2.5-pro: "65,536 max output tokens"<ref>[https://ai.google.dev/gemini-api/docs/models#gemini-2.5-pro Gemini 2.5 Pro]</ref> 相當於 65,536/3 約 21,845 中文字 # GPT-5: "128,000 max output tokens"<ref>[https://platform.openai.com/docs/models/gpt-5 Model - OpenAI API]</ref> 相當於 128,000/3 約 42,666 中文字 方法2:開啟新的對話,將對話內容轉移至新的對話中。針對舊有對話,可以嘗試使用這個提示: <pre> 作為新對話的第一個 prompt,請將我們先前的對話整理成: 1. 清楚的操作步驟 2. 用來驗證每個前置步驟成功的指令 </pre> 方法3:分塊處理與保持上下文連貫的策略 處理長文時需要採用分段切塊(Chunking)的技術策略<ref>[https://ihower.tw/blog/archives/12373 使用繁體中文評測 RAG 的 Chunking 切塊策略 – ihower { blogging }]</ref>。為了讓模型在處理後續段落時能夠理解前面章節的脈絡,一個有效的方法是'''將前面文章摘要的切塊策略''': # 先將前面章節進行摘要 # 將摘要與待處理的下一章節全文一起輸入給 AI # 這樣既能保持上下文連貫性,又能節省 token 使用量 '''重疊式切塊策略''' 另一種切塊策略適用於處理逐字稿的編輯。逐字稿的格式通常包含時間戳記和對應的字幕內容: <pre> 1 00:00:00,001 --> 00:00:02,000 所以你先回答我 2 00:00:02,000 --> 00:00:06,000 有哪一個國家讓憲法把你空窗那麼久的 3 00:00:06,000 --> 00:00:10,000 你再來跟我說有哪一個國家沒有這樣制定 </pre> 如果直接將第 3 段獨立送到 AI 編輯,很容易因為缺乏前面的對話脈絡而產生錯誤。此時可以採用「允許部分重疊(overlap)」的內容切塊策略。以下是一個改善中文逐字稿的 prompt 範例<ref>[https://errerrors.blogspot.com/2024/11/add-punctuation-to-whisper-output.html 如何改善 Whisper 逐字稿可讀性:AI 標點符號教學]</ref>: <pre> 你的任務是改善中文口語訪談的逐字稿段落。您需要增加標點符號、確保段落連貫、保持原意,並視需要重寫部分文字。請使用台灣常用的繁體中文。 這是前文段落: <previous_paragraph> {PREVIOUS_PARAGRAPH} </previous_paragraph> 這是目前的段落: <current_paragraph> {CURRENT_PARAGRAPH} </current_paragraph> 這是後文段落: <next_paragraph> {NEXT_PARAGRAPH} </next_paragraph> </pre> 這種方法讓 AI 能夠同時參考前後文內容,確保處理結果的連貫性和準確性。
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information