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
ELYA-japanese-Llama-2-7bを Rust(WASM)で動かしてみた
Search
clouddev-code
January 30, 2024
810
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ELYA-japanese-Llama-2-7bを Rust(WASM)で動かしてみた
clouddev-code
January 30, 2024
More Decks by clouddev-code
See All by clouddev-code
microVMsのユースケースを考える.pdf
cloudevcode
0
50
cdk8s_Helm_どちらを選ぶべきか_rev.pdf
cloudevcode
0
120
Regional_NAT_Gatewayについて_basicとの違い_試した内容スケールアウト_インについて_IPv6_dual_networkでの使い分けなど.pdf
cloudevcode
1
930
Grafana_LokiをECS_Fargateで構築する観点公開版.pdf
cloudevcode
0
63
ADK_for_Java.pdf
cloudevcode
1
110
initContainerをECSで実現したい.pdf
cloudevcode
0
45
VPC_Lattice検討したが_採用しなかった話.pptx.pptx.pdf
cloudevcode
0
36
Presentation_-_コンテナイメージ高速化技術.pptx.pdf
cloudevcode
0
44
GitHub_Copilot_AgentでするMCP_Streamable_HTTPまで.pdf
cloudevcode
0
130
Featured
See All Featured
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
700
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
320
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
260
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
570
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
4
550
The Spectacular Lies of Maps
axbom
PRO
1
970
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
320
Code Review Best Practice
trishagee
74
20k
Transcript
ELYA-japanese-Llama-2-7bを Rust(WASM)で動かしてみた。 生成AI新年会2024@GMO Yours・フクラス 2024/01/30 #生成AI新年会 1
About us Soushi Hiruta 2 https://www.totalsolution.biz/ X(twitter) web_se Bluesky clouddevcode.bsky.social
github clouddev-code Zenn clouddevcode コンテナを中心にマイクロサービス基盤の構築、運用を行いつつ、 GenAIのキャッチアップを行っています。 Container、eBPF、GenAI
Zennにも検証したことをアップしています 3
Agenda ▸ LLMはGPUなどのComputeリソースを消費する ▸ WASM Runtimeのパフォーマンス ▹ Java等との違い ▹ 初期化プロセスとの違い
▸ WasmEdgeについて ▸ WASM-NN plugin ▸ ELYZA-japanese-Llhma-2-7b Model ▸ 上記モデルをRustで動かす点の注意点 ▸ デモ ▸ まとめ ▸ Q&A 4
5 LLMはComputeリソースを消費する https://xtech.nikkei.com/atcl/nxt/column/18/00989/091300127/
Python performance 6 There’s plenty of room at the Top:
What will drive computer performance after Moore’s law? https://www.science.org/doi/10.1126/science.aam9744
java, Python との違い 7 • Ahead-of-Time (AOT)は、実行前にバイトコードをマシンコードに変換 して最適化する • Java
は実行中にコンパイルされる。一度しか利用されないケースと かには向かない 対比されるものとしてDocker Engineはどうか
Docker Engineの初期化プロセス 8 • コントロールグループ (cgroup) • Rootfsのセットアップ これを終わらせたあとでないとアプリケーションを実行する ことができない
Performance advantages of WASM 9
初期化プロセス 10 • WASM Runtimeは主にアプリケーションバイナリを実行し、不要なファ イルシステム全体をマウントすることを回避する
11 WasmEdge Bring the cloud-native and serverless application paradigms to
Edge Computing • High performance • WASI-like Extensions • JavaScript Support • Cloud Native Management Orchestration • Cross-platform Support • Eas Extensibility • Easy to Embed into a Host Application
12 WasmEdge https://www.youtube.com/watch?v=BIgVM18UVIE
WASM-NN plugin 13 WasmEdge runtimes supports open-source LLMs through its
GGML plugin
ELYZA-japanese-Llama-2-7b 14 GPT-3.5 (text-davinci-003)に匹敵、日本語の公開モデル野中では最高 水準 約180億トークンの日本語テキストを追加 OSCARやWikipedia等に含まれる日本語テキストデータ
wasmedgeを動かすまでのポイント 15 https://github.com/second-state/LlamaEdge/blob/main/models.md • llama-api-server.wasmは最新のものを利用 ◦ 1/4にggmal pluginがリリースされている • メモリ8G程度だと、—ctx-size
オプション必須
デモ 16
まとめ 17 • WASMはDocker Engineと比較してもオーバーヘッドが少ない • GGMAL pluginは使って、OSS LLMなOpenAI ChatCompletion
互換なAPIを 構築できる • LlamaEdge 0.2.9が4h前にリリース(Phi-2などに対応)されるなど、アップ デートも活発です
Appendix 18 • WasmEdgeRuntime https://wasmedge.org/ • WasmEdge Provides a Better
Way to Run LLMs on the Edge https://www.secondstate.io/articles/wasmedge-ggml-plugin/ • WASM Runtimes vs. Containers: Cold Start Deplays (Part 1) https://levelup.gitconnected.com/wasm-runtimes-vs-containers-per formance-evaluation-part-1-454cada7da0b • Metaの「Llama 2」をベースとした商用利用な日本語LLMを公開しまし た。 https://note.com/elyza/n/na405acaca130 • GGUF Models • https://github.com/second-state/LlamaEdge/blob/main/models.md • ELYZA-japanese-Llama-2-7bをM1 Mac上でRustで動かす