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
240
驚愕の事実!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
1
200
Direct Preference Optimization
zchenry
0
370
Diffusion Model with Perceptual Loss
zchenry
0
390
レンズの下のLLM / LLM under the Lens
zchenry
0
180
Go with the Prompt Flow
zchenry
0
160
Mojo Dojo
zchenry
0
210
ことのはの力で画像の異常検知 / Anomaly Detection by Language
zchenry
0
560
MLOps初心者がMLflowを触る / MLflow Brief Introduction
zchenry
0
120
{{guidance}}のガイダンス / Guidance of guidance
zchenry
0
160
Other Decks in Programming
See All in Programming
iOS 26にアップデートすると実機でのHot Reloadができない?
umigishiaoi
0
140
PHP 8.4の新機能「プロパティフック」から学ぶオブジェクト指向設計とリスコフの置換原則
kentaroutakeda
2
1k
What's new in AppKit on macOS 26
1024jp
0
150
Model Pollution
hschwentner
1
160
React は次の10年を生き残れるか:3つのトレンドから考える
oukayuka
7
1.9k
Goで作る、開発・CI環境
sin392
0
260
リバースエンジニアリング新時代へ! GhidraとClaude DesktopをMCPで繋ぐ/findy202507
tkmru
3
960
Git Sync を超える!OSS で実現する CDK Pull 型デプロイ / Deploying CDK with PipeCD in Pull-style
tkikuc
4
350
オンコール⼊⾨〜ページャーが鳴る前に、あなたが備えられること〜 / Before The Pager Rings
yktakaha4
2
990
テスト駆動Kaggle
isax1015
1
620
AI時代の『改訂新版 良いコード/悪いコードで学ぶ設計入門』 / ai-good-code-bad-code
minodriven
23
9.6k
おやつのお供はお決まりですか?@WWDC25 Recap -Japan-\(region).swift
shingangan
0
140
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.9k
Code Review Best Practice
trishagee
69
19k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.5k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.9k
Bash Introduction
62gerente
613
210k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
YesSQL, Process and Tooling at Scale
rocio
173
14k
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.7k
A better future with KSS
kneath
238
17k
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