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
120
驚愕の事実!LangChainが抱える問題 / Problems of LangChain
Henry Cui
August 26, 2023
Tweet
Share
More Decks by Henry Cui
See All by Henry Cui
Direct Preference Optimization
zchenry
0
140
Diffusion Model with Perceptual Loss
zchenry
0
72
レンズの下のLLM / LLM under the Lens
zchenry
0
98
Go with the Prompt Flow
zchenry
0
100
Mojo Dojo
zchenry
1
140
ことのはの力で画像の異常検知 / Anomaly Detection by Language
zchenry
0
190
MLOps初心者がMLflowを触る / MLflow Brief Introduction
zchenry
0
61
{{guidance}}のガイダンス / Guidance of guidance
zchenry
0
110
MLOps初心者がApache Airflowを触る / Apache Airflow Introduction for an MLOps Beginner
zchenry
0
160
Other Decks in Programming
See All in Programming
使ってみよう Azure AI Document Intelligence
kosmosebi
2
330
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
230
Let's learn code review
riofujimon
2
510
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
840
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
870
Amazon SQSコンシューマー疎結合への旅 - 出張! #DevelopersIO IT技術ブログの中の人が語る勉強会 #3
quiver
0
280
SwiftUIで使いやすいToastの作り方 / How to build a Toast system which is easy to use in SwiftUI
lovee
3
150
Fragment Composition of GraphQL
quramy
7
1k
try! Swift Tokyo 初参加報告LT
hinakko2
0
220
スクラムガイドのスプリントレトロスペクティブを改めて読みかえしてみた / Re-reading the Sprint Retrospective Section in the Scrum Guide
mackey0225
3
450
Ruby GitHub Packages
bkuhlmann
0
630
Elm 0.19.0 Changes
bkuhlmann
0
490
Featured
See All Featured
Six Lessons from altMBA
skipperchong
21
3k
For a Future-Friendly Web
brad_frost
172
9k
Agile that works and the tools we love
rasmusluckow
325
20k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
322
20k
How to Ace a Technical Interview
jacobian
272
22k
Art, The Web, and Tiny UX
lynnandtonic
289
19k
What's in a price? How to price your products and services
michaelherold
237
11k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
125
32k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
2
1.3k
Fontdeck: Realign not Redesign
paulrobertlloyd
76
4.9k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
30
6k
Product Roadmaps are Hard
iamctodd
44
9.7k
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