0Pricing
Prompt Engineering & LLM Optimization for Developers · レッスン

プロンプトの反復的な改善

LLMの性能と出力品質を向上させるため、プロンプトをテスト、分析、反復的に改善するプロセスを理解します。

「プロンプトの反復的な改善」はCoddyKit上の無料Prompt Engineering & LLM Optimization for Developersレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはPrompt Engineering & LLM Optimization for Developers学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Prompt Engineering & LLM Optimization for Developersコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

What is Iterative Refinement?

Imagine you're trying to explain a complex idea to someone. You don't just say it once and expect perfection, right?

You explain, see their reaction, clarify, and rephrase until they understand. This is exactly what Iterative Prompt Refinement is for LLMs!

It's a cycle of writing a prompt, testing it, analyzing the LLM's output, and then improving the prompt based on what you learned.

Why Refine Your Prompts?

Your first prompt rarely gives the perfect answer. LLMs are powerful, but they need clear guidance.

Refinement helps you:

  • Get more accurate and relevant responses.
  • Reduce "hallucinations" (when LLMs make up information).
  • Ensure outputs match your desired format and style.
  • Save time and resources in the long run.

Step 1: Define Your Goal

Before writing any prompt, ask yourself: "What exactly do I want the LLM to do?"

A clear goal acts as your compass. Is it to summarize text? Extract specific data? Generate creative content? Be precise!

For example, instead of "write about dogs," aim for "write a three-sentence summary of the health benefits of owning a dog, for a social media post."

Step 2: Craft Initial Prompt

Start simple! Don't try to make your first prompt perfect. Focus on conveying your basic request.

Use straightforward language. You can always add more detail, constraints, or examples later in the refinement process.

Initial Prompt Example:

Summarize the following article.

Step 3: Test and Observe

Now, it's time to run your initial prompt and carefully observe the LLM's output.

Don't just skim! Read the entire response. Does it make sense? Is it missing anything? Does it contain unexpected information?

This is where you gather data for improvement.

Let's simulate a basic interaction:

def interact_with_llm(prompt, text):
  print(f"--- Your Prompt ---\n{prompt}")
  print(f"--- Input Text ---\n{text}")
  print("--- LLM thinks... ---")
  print("LLM output will appear here after processing.")

if __name__ == "__main__":
  initial_prompt = "Summarize the following article."
  article_text = "The quick brown fox jumps over the lazy dog. This is a classic sentence used for testing typefaces."
  interact_with_llm(initial_prompt, article_text)

Step 4: Analyze Output

Compare the LLM's output against your defined goal. Look for:

  • Relevance: Is it on topic?
  • Accuracy: Are there any factual errors or "hallucinations"?
  • Completeness: Did it cover all necessary points?
  • Format: Is it in the desired structure (e.g., bullet points, JSON)?
  • Conciseness/Verbosity: Is it too long or too short?
  • Tone/Style: Does it match the intended audience?

Step 5: Refine: Clarity & Constraints

Based on your analysis, modify your prompt. One common refinement is adding more clarity and constraints.

  • Clarity: Be more specific with instructions.
  • Constraints: Tell the LLM what not to do, or specify length, format, and tone.

Example Refinement:

Summarize the following article in exactly three sentences, focusing only on the main subject.

Refine: Using Delimiters

When providing input text or context, use delimiters to clearly separate it from your instructions. This helps the LLM understand what is instruction and what is data.

Common delimiters include triple backticks (```), triple quotes ("""), XML tags (<text></text>), or even simple hyphens.

Example:

Summarize the following article, which is delimited by triple backticks, in three bullet points.
```[ARTICLE TEXT HERE]```

Refine: Iterating is Key

Refinement isn't a one-time step. It's an ongoing cycle! You'll often go through several rounds of testing, analyzing, and refining.

Each iteration brings you closer to the optimal prompt. Don't be afraid to experiment with different phrasings and structures.

Keep a record of your prompt versions and their outputs to track what works best.

Quick Check

Which of the following is the correct order of steps in the iterative prompt refinement process?

Recap & Next Steps

Great job! You've learned the power of Iterative Prompt Refinement.

  • It's a continuous cycle: Define Goal → Craft Prompt → Test → Analyze → Refine.
  • It helps achieve accuracy, relevance, and desired formats.
  • Using clarity, constraints, and delimiters are key refinement techniques.

Keep practicing this iterative approach with your prompts. It's a fundamental skill for effective prompt engineering!

よくある質問

「プロンプトの反復的な改善」レッスンは無料ですか?

はい。「プロンプトの反復的な改善」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Prompt Engineering & LLM Optimization for Developersコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Prompt Engineering & LLM Optimization for Developersコースには全4レッスンが含まれています。

「プロンプトの反復的な改善」で何を学びますか?

LLMの性能と出力品質を向上させるため、プロンプトをテスト、分析、反復的に改善するプロセスを理解します。 ブラウザで直接実行するハンズオンコードでPrompt Engineering & LLM Optimization for Developersを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Prompt Engineering & LLM Optimization for Developersを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのPrompt Engineering & LLM Optimization for Developersは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。

「プロンプトの反復的な改善」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このPrompt Engineering & LLM Optimization for Developersレッスンでコードを書いて実行できますか?

はい。すべてのPrompt Engineering & LLM Optimization for Developersレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. ロールプレイとペルソナプロンプト
  2. 指示への追従と制約
  3. プロンプトの反復的な改善
  4. 区切り文字と構造化プロンプト
← Prompt Engineering & LLM Optimization for Developersに戻る