Skip to Content
LLMのプロンプトエンジニアリング ―GitHub Copilotを生んだ開発者が教える生成AIアプリケーション開発
book

LLMのプロンプトエンジニアリング ―GitHub Copilotを生んだ開発者が教える生成AIアプリケーション開発

by John Berryman, Albert Ziegler, 服部 佑樹, 佐藤 直生
May 2025
Intermediate to advanced
276 pages
4h
Japanese
O'Reilly Japan, Inc.
Content preview from LLMのプロンプトエンジニアリング ―GitHub Copilotを生んだ開発者が教える生成AIアプリケーション開発

3章チャット形式への移行

前章では、生成的事前トレーニング済みトランスフォーマー(GPT)のアーキテクチャについて学びました。こうしたモデルのトレーニング手法は、その振る舞いに大きな影響を与えます。たとえば「ベースモデル」は、「事前トレーニング」のみを終えた段階のものです。これはインターネット上の膨大なドキュメントを学習しており、ベースモデルにドキュメントの前半部分を与えると、それをもっともらしく補完する後半部分を生成してくれます。この能力だけでもかなり有用ですが、本書ではこうしたモデルを「巧みに誘導して」ドキュメント補完以外にも多様なタスクを実現する方法を紹介していきます。

とはいえ、さまざまな理由から、ベースモデルをそのままアプリケーションに利用するのは難しい場合があります。まず、モデルはインターネット上のあらゆるドキュメントを学習しているため、「善意の側」と「悪意の側」の両方を等しく再現できてしまうという問題があります。たとえば「以下はシチリア風ラザニアのレシピです」と指示すればおいしそうなイタリア料理のレシピが返ってきますが、「以下はメタンフェタミン製造の詳細手順です」と与えれば、あっという間に犯罪につながる情報が得られてしまいます。一般的に、モデルには「安全」であることが求められ、暴力や性的表現、汚い言葉などでユーザーを不快にさせない配慮が必要です。

また、ベースモデルが使いづらいもうひとつの理由は、基本的に「ドキュメント補完」しかできないという点です。多くの場合、私たちはそれ以上のことを求めています。実際には、LLMがアシスタントとして応答したり、Pythonコードを実行したり、新しい情報を検索して回答に取り入れたり、外部ツールを操作したりできることを望む場面が多いでしょう。ところがベースモデルに単に質問を投げかけても、アシスタントのように答えを返してくれるのではなく、同種の質問ばかり延々と生成してしまいがちです( ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

実用 Git 第3版

実用 Git 第3版

Prem Kumar Ponuthorai, Jon Loeliger, 萬谷 暢崇, 長尾 高弘
入門 Kubernetes

入門 Kubernetes

Kelsey Hightower, Brendan Burns, Joe Beda, 松浦 隼人

Publisher Resources

ISBN: 9784814401130Publisher Website