Loading...
  • 建構
  • 管理
  • 模型與定價
  • 客戶端 SDK
  • API 參考
Search...
⌘K
Log in
減少提示洩漏
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Solutions

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

Partners

  • Amazon Bedrock
  • Google Cloud's Vertex AI

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 整體任務的複雜性而降低任務其他部分的效能。

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

先嘗試監控技術,例如輸出篩選和後處理,以試圖捕捉提示詞洩露的實例。

減少提示詞洩露的策略

  • 將上下文與查詢分開: 您可以嘗試使用系統提示詞將關鍵資訊和上下文與使用者查詢隔離。您可以在 User 輪次中強調關鍵指示,然後通過預填充 Assistant 輪次來重新強調這些指示。(注意:Claude Mythos Preview、Claude Opus 4.7、Claude Opus 4.6 和 Sonnet 4.6 不支援預填充。)

  • 使用後處理:篩選 Claude 的輸出中可能表示洩露的關鍵字。技術包括使用正規表達式、關鍵字篩選或其他文字處理方法。
    您也可以使用提示詞 LLM 來篩選輸出以獲得更細緻的洩露檢測。
  • 避免不必要的專有詳細資訊:如果 Claude 不需要它來執行任務,就不要包含它。額外的內容會分散 Claude 對「無洩露」指示的注意力。
  • 定期審計:定期檢查您的提示詞和 Claude 的輸出是否存在潛在洩露。

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

Was this page helpful?