Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
驚愕の事実!LangChainが抱える問題 / Problems of LangChain
Search
Henry Cui
August 26, 2023
Programming
0
230
驚愕の事実!LangChainが抱える問題 / Problems of LangChain
Henry Cui
August 26, 2023
Tweet
Share
More Decks by Henry Cui
See All by Henry Cui
プロダクション言語モデルの情報を盗む攻撃 / Stealing Part of a Production Language Model
zchenry
0
170
Direct Preference Optimization
zchenry
0
350
Diffusion Model with Perceptual Loss
zchenry
0
340
レンズの下のLLM / LLM under the Lens
zchenry
0
170
Go with the Prompt Flow
zchenry
0
150
Mojo Dojo
zchenry
0
190
ことのはの力で画像の異常検知 / Anomaly Detection by Language
zchenry
0
530
MLOps初心者がMLflowを触る / MLflow Brief Introduction
zchenry
0
110
{{guidance}}のガイダンス / Guidance of guidance
zchenry
0
150
Other Decks in Programming
See All in Programming
ぽちぽち選択するだけでOSSを読めるVSCode拡張機能
ymbigo
14
6.3k
Global Azure 2025 @ Kansai / Hyperlight
kosmosebi
0
150
状態と共に暮らす:ステートフルへの挑戦
ypresto
3
1.2k
Cursor/Devin全社導入の理想と現実
saitoryc
29
22k
プロダクトエンジニアのしごと 〜 受託 × 高難度を乗り越えるOptium開発 〜
algoartis
0
220
Boost Your Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
890
プロフェッショナルとしての成長「問題の深掘り」が導く真のスキルアップ / issue-analysis-and-skill-up
minodriven
8
2k
2025年のz-index設計を考える
tak_dcxi
12
4.5k
今話題のMCPサーバーをFastAPIでサッと作ってみた
yuukis
0
130
Serving TUIs over SSH with Go
caarlos0
0
690
The Missing Link in Angular’s Signal Story: Resource API and httpResource
manfredsteyer
PRO
0
150
はじめてのPDFKit.pdf
shomakato
0
100
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
41
2.6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.2k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
How to Think Like a Performance Engineer
csswizardry
23
1.6k
YesSQL, Process and Tooling at Scale
rocio
172
14k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Side Projects
sachag
453
42k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Fireside Chat
paigeccino
37
3.4k
A designer walks into a library…
pauljervisheath
205
24k
Docker and Python
trallard
44
3.4k
Making the Leap to Tech Lead
cromwellryan
133
9.3k
Transcript
驚愕の事実!LangChainが抱える問題 機械学習の社会実装勉強会第26回 Henry 2023/8/26
記事の紹介 ▪ The Problem With LangChain • https://minimaxir.com/2023/07/langchain-problem/ • BuzzFeed社のエンジニアが執筆
▪ 記事が言いたいこと • LangChainは思うほど使いやすくない • 過度な複雑さと避けるために、APIをそのまま使うべき ▪ 断り:あくまでも記事の意見であって、発表者の意見ではない 2
内容 ▪ LangChainが実現したReAct論文 ▪ LangChainのテンプレート ▪ LangChainの履歴保存 ▪ LangChain Agentに関して
▪ 環境情報 • Python 3.8.6 • langchain 0.0.266 3
LangChainが実現したReAct論文 ▪ ReAct: Synergizing Reasoning and Acting in Language Models
• ICLR 2023 上位論文 ▪ タスクに対して、ReasoningとActを交互に行う 4
LangChainが実現したReAct論文 ▪ 著者実装は https://github.com/ysymyth/ReAct にて公開 ▪ 論文実験用なので、ハードコーディングのところがある • https://github.com/ysymyth/ReAct/blob/master/hotpotqa.ipynb 5
LangChainのテンプレート ▪ 記事の主な批判「LangChainが簡単なことを複雑化した」 ▪ その一例として、Templateの作り方に対して ▪ langchain/langchain/prompts/base.py • f-stringはstring.Formatterベース •
jinja2はjinja2.Templateでレンダーリング 6
LangChainの履歴保存 ▪ 履歴を保存するためのコードは逆に長くなっている • 左:LangChain、右:OpenAI API 7
LangChain Agentに関して ▪ initialize_agentではデフォルトでsystem promptを入れてない • system promptを含むagent_kwargsを明示的に渡す必要がある ▪ Tool選択の際で、出力がJSONじゃないといけない
• langchain/langchain/agents/conversational_chat/prompt.py 8
LangChain Agentに関して ▪ Tool選択の際で、出力がJSONじゃないといけない • Custom AgentやCustom Chainなどを使うことができるが、やることが また複雑になってしまう •
function callingも使える? ▪ function callingは6/13にAPIで公開 ▪ 記事の日付は7/14だが、内容が固まったのはfunction calling公開前だと思われる • 自由フォーマットの内容をJSONにパースするのにもう一回LLMも使え る? 9
まとめ ▪ LangChainに関する記事の検証 10