見出し画像

結局”プロンプトエンジニアリング”ってなんなのさ。

先日まで書いていた記事の中で「プロンプトエンジニアリング」という言葉をちょくちょく使っていたと、ふと思い出しました。

…「プロンプトエンジニアリング」ってなんだ??

急に自ら学んでいたものに疑問が思い浮かぶようになったので、一度この場をお借りして整理したいと思います。

例によって参考にさせていただいたサイトを掲載。

プロンプトエンジニアリングとは?

一旦落ち着いて、語義や辞書を頼ってみるのが手です。
以下は参考にしたサイトの引用です。

Prompt engineering is the process of refining a prompt over time in order to improve its capabilities in responding to user inputs. This process is especially useful in instances where basic prompts don't work as well as we want them to.

https://learnprompting.org/docs/basics/prompt_engineering

上記において、「プロンプトエンジニアリング」とは
・ユーザーの入力に対する応答能力を向上させるために、時間をかけてプロンプトを磨く手法
・基本的なプロンプトが十分に機能しない場合に効果的
と示されています。

つまり、「プロンプトエンジニアリングとは、ユーザーの求めている回答に沿うようなプロンプトにするために、プロンプトを洗練させること」
といったようになるでしょうか。

例をつかってみる

サイトの例が単純で分かりやすかったので、自環境で実践してみます。

見事に間違えてますね。自然言語処理のモデルなので計算が不得手で当然です。なので、こちらから道しるべ(プロンプトの改良)をしてあげます。
(回答が長かったので最後のおまけで書きます)

What is 923 * 99? Let's go step by step. Always write out the full number of 0s for each term.

上記のプロンプトでは、段階的に考えることを促し、各段階で計算過程を書き出せと指示しています。

たったこれだけで、計算できる生成AIになってしまうわけです。
そう考えると末恐ろしい…

おわりに

「プロンプトエンジニアリング」と聞くと、なんだか仰々しい響きがして、難しく感じますが、所詮は文章の改良です。

少しエセンスを変えるだけで、思った通りの回答が得られるのは気持ちがいいものです。使いこなせれば、本当に便利になるのでぜひ試してみてください。

プロンプトの書き方入門については以下からまとめてます。ご参考にどうぞ。

おまけ:プロンプト改良後の回答

Sure, let's break it down step by step:

1. 923 has three digits, so it's 923.
2. 99 has two digits, so it's 99.

Now, we'll multiply:

1. Start with the rightmost digit of 923 (which is 3) and multiply it by 99:

3 * 99 = 297

Write down 7 and carry over 2 (because 297 has three digits).

2. Next, move to the middle digit of 923 (which is 2) and multiply it by 99:

2 * 99 = 198

Add the carry-over from the previous step (2):

198 + 2 = 200

Write down 0 and carry over 2.

3. Finally, move to the leftmost digit of 923 (which is 9) and multiply it by 99:

9 * 99 = 891

Add the carry-over from the previous step (2):

891 + 2 = 893

Write down 893.

Now, combine all the results:

2970
19800
89300

Add them together:

29700
+ 19800
+ 89300
_________
91600

So, 923 multiplied by 99 equals 91,677.


この記事が気に入ったらサポートをしてみませんか?