deeplearning.ai のChatGPT Prompt Engineering for Developersを見た際のメモ

リンクはこちら

Introduction

  • Base LLM
    • 単語の集合からそれっぽい文章を生成する。なんか近い単語を選んでる、それだけ。みたいな感じ。
    • Copilotは割とこちらっぽい挙動が多いよなー
  • Instruction Tuned LLM
    • チューニングしてちゃんと指示に従うようにしているらしい。
    • 今熱いのはこっち

Guidelines

  • Prisiple 1

    • 明確に、具体的に、指定せよ
    • 勘違いしてはいけないが、「明確に」書こうとして「短く」してはならない
    • デリミタを使うことで誤解を防ぎやすくなる。使おう。
      • たとえば"```"で囲むのがデリミタを使うテクニックだ。
      • 返答のスタイルを指定することができる。
  • Prisiple 2

    • 考える時間を渡せ
      • ここでは処理時間を伸ばせというだけのことではない。
        1. プロンプトでIssueを細かいTaskに分割していくことを要求することができる。
          1. たとえば、"Perform the following actions: "と指定してから、まず要約せよ。次にそれを翻訳せよ。と指定する。
        2. 正答が正しいか、「自分で答えを出せ」そして「比較せよ」とすることもできる
          1. これを実施させるためのプロンプトはかなり長い!

モデルは特に元データがすくないものについては捏造してしまいやすい(ハルシネーションと呼んでいる)。これを防ぐためには、良好な元データを渡すことだ。

Iterative

一発で素晴らしい答えが返ってくると思ってはいけない。プロンプトをくりかえし、チューニングしていくことが必要だ。下記のように。

  1. 明確に指定せよ
  2. (いい答えが返ってこなかったら)なぜ結果が期待に沿わなかったか考えよ
  3. アイディアとプロンプトを修正せよ
  4. 1-3を繰り返せ

長すぎる場合

もし長すぎると思ったら"Use ato most 50 words(sentences)"と指定することで、50単語以内に収まるようにすることができる。

特にフォーカスさせたい事柄がある場合

"focus on the XXXXX"などのように指定することができる。

講師曰く「最終形となるプロンプトにたどり着くまでには試行錯誤が必要だ。これに一発でたどり着ける人を私は知らない(要約)」だそうである。

「最高のプロンプトとは、「俺の考えた最強プロンプトBest10」みたいなものではなくて、そこに至るための試行錯誤プロセスのことだ(要約)」

すばらしい。

Summarizing

要約ができるよ!

ってことなんだけど、まあたしかにすごいんだけど、自分の興味からははずれるなあ・・・。

Inferring(推論)

これはマジですごいんだが、テキストベースに限定される必要がないはずなんだよなー。端的にレコメンドとかもこれのはず。

Transforming(変換)

英語 -> 日本語とかだけでなく、文章をHTMLにしたりもできる

Expanding(拡張)

こう頼むと

Please expand it ```Thank you for your cooperation!``` i would like to send email to costomer support.

こう返ってくる

ChatGPT
To expand the phrase "Thank you for your cooperation!" into a more detailed and polite message suitable for an email to customer support, you might want to include a few key elements: appreciation for their assistance, a reference to your specific issue or interaction, and a courteous closing. Here’s an example:

Subject: Appreciation for Your Support

Dear [Customer Support Team/Specific Representative's Name],

I hope this message finds you well. I am writing to express my sincere gratitude for the support and assistance you have provided me. Your prompt and effective handling of [mention your specific issue or request here] has not only resolved my concerns but also significantly enhanced my experience with your services.

Your team's dedication to customer satisfaction is truly commendable, and I wanted to take a moment to acknowledge the excellent service I received. It is clear that your team goes above and beyond to ensure that customers' needs are addressed with care and professionalism.

Thank you once again for your cooperation and support. It is greatly appreciated and does not go unnoticed. Please feel free to forward this message to your supervisor or team leader, as I believe such exemplary service deserves recognition.

I look forward to continuing my association with your company and will certainly recommend your services to my colleagues and friends.

Warm regards,

[Your Name]
[Your Contact Information, if necessary]

Feel free to personalize this template according to your situation and the specifics of your interaction with customer support.

まとめ

  • 原則  - 明確に指定せよ  - 考える時間を与えよ
  • プロンプトを繰り返しチューニングせよ
  • できること
    • 要約
    • 推論
    • 変換
    • 拡張