Claude Platform Docs
  • Messages
  • Managed Agents
  • 管理

Search...
⌘K
使用案例
概覽工單路由客戶支援代理內容審核法律摘要
提示工程
概覽提示最佳實務Claude Fable 5 提示技巧Claude Opus 4.8 提示技巧Console 提示工具
測試與評估
定義成功並建構評估在 Console 中使用評估工具降低延遲
強化防護措施
減少幻覺提高輸出一致性緩解越獄減少提示洩漏
參考
詞彙表

Log in
減少提示洩漏
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Claude Platform Docs

Solutions

  • AI agents
  • Code modernization
  • Coding
  • Customer support
  • Education
  • Financial services
  • Government
  • Life sciences

Partners

  • Claude on AWS
  • Claude on Google Cloud

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Company

  • Anthropic
  • Careers
  • Economic Futures
  • Research
  • News
  • Responsible Scaling Policy
  • Security and compliance
  • Transparency

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Help and security

  • Availability
  • Status
  • Support
  • Discord

Terms and policies

  • Privacy policy
  • Responsible disclosure policy
  • Terms of service: Commercial
  • Terms of service: Consumer
  • Usage policy
最佳實務/強化防護措施

減少提示洩漏

提示洩漏可能會暴露您預期在提示中「隱藏」的敏感資訊。雖然沒有任何方法是萬無一失的,但以下策略可以顯著降低風險。

在嘗試減少提示洩漏之前

請僅在絕對必要時才考慮使用防洩漏的提示工程策略。嘗試讓您的提示防洩漏可能會增加複雜性,由於增加了 LLM 整體任務的複雜度,這可能會降低任務其他部分的效能。

如果您決定實施防洩漏技術,請務必徹底測試您的提示,以確保增加的複雜性不會對模型的效能或其輸出品質產生負面影響。


請先嘗試監控技術,例如輸出篩選和後處理,以嘗試捕捉提示洩漏的情況。

減少提示洩漏的策略

  • 將上下文與查詢分開: 您可以嘗試使用「system prompt」(系統提示)將關鍵資訊和上下文與使用者查詢隔離。您可以在 User 回合中強調關鍵指令,然後透過預填 Assistant 回合來再次強調這些指令。(注意:Claude Fable 5、Claude Mythos 5、Claude Mythos Preview、Claude Opus 4.8、Claude Opus 4.7、Claude Opus 4.6 和 Claude Sonnet 4.6 不支援預填功能。)

  • 使用後處理:篩選 Claude 的輸出,尋找可能表示洩漏的關鍵字。技術包括使用正規表示式、關鍵字篩選或其他文字處理方法。
    
    您也可以使用經過提示的 LLM 來篩選輸出,以捕捉更細微的洩漏。
  • 避免不必要的專有細節:如果 Claude 不需要這些資訊來執行任務,就不要包含它們。額外的內容會分散 Claude 對「不洩漏」指令的注意力。
  • 定期稽核:定期檢查您的提示和 Claude 的輸出,以發現潛在的洩漏。

請記住,目標不僅是防止洩漏,還要維持 Claude 的效能。過於複雜的防洩漏措施可能會降低結果品質。平衡是關鍵。

Was this page helpful?

  • 在嘗試減少提示洩漏之前
  • 減少提示洩漏的策略