LiteRT-LM は、エッジ デバイスで高パフォーマンスのクロスプラットフォーム LLM デプロイを実現するように設計された、プロダクション レディなオープンソースの推論フレームワークです。
- クロスプラットフォームのサポート: Android、iOS、ウェブ、パソコン、IoT(Raspberry Pi など)で実行できます。
- ハードウェア アクセラレーション: さまざまなハードウェアで GPU アクセラレータと NPU アクセラレータを活用することで、最高のパフォーマンスとシステムの安定性を実現します。
- マルチモーダル: 画像と音声のサポートを備えた LLM を使用して構築します。
- ツールの使用: エージェント ワークフローの関数呼び出しをサポートし、制約付きデコードにより精度を向上させます。
- 幅広いモデルのサポート: Gemma、Llama、Phi-4、Qwen などを実行できます。
オンデバイス生成 AI のショーケース
Google AI Edge ギャラリーは、LiteRT-LM を使用して完全にオフラインで実行されるオンデバイス生成 AI 機能をデモするために設計された試験運用版アプリです。
- Google Play: サポートされている Android デバイスで LLM をローカルで使用します。
- App Store: iOS デバイスでオンデバイス AI を体験できます。
- GitHub ソース: 写真アプリのソースコードを表示して、LiteRT-LM を独自のプロジェクトに統合する方法を確認できます。
注目のモデル: Gemma-4-E2B
- モデルサイズ: 2.58 GB
その他の技術的な詳細については、HuggingFace モデルカードをご覧ください。
プラットフォーム(デバイス) バックエンド プレフィル(tk/秒) デコード(tk/秒) 最初のトークンまでの時間(秒) CPU のピークメモリ(MB) Android(S26 Ultra) CPU 557 47 1.8 1733 GPU 3808 52 0.3 676 iOS(iPhone 17 Pro) CPU 532 25 1.9 607 GPU 2878 56 0.3 1450 Linux(Arm 2.3 GHz、2.8 GHz、NVIDIA GeForce RTX 4090) CPU 260 35 4 1628 GPU 11234 143 0.1 913 macOS(MacBook Pro M4) CPU 901 42 1.1 736 GPU 7835 160 0.1 1623 IoT(Raspberry Pi 5 16 GB) CPU 133 8 7.8 1546
構築を開始する
次のスニペットは、LiteRT-LM CLI、Python、Kotlin、C++ API の使用を開始する方法を示しています。
CLI
litert-lm run model.litertlm --prompt="What is the capital of France?"
Python
engine = litert_lm.Engine("model.litertlm")
with engine.create_conversation() as conversation:
response = conversation.send_message("What is the capital of France?")
print(f"Response: {response['content'][0]['text']}")
Kotlin
val engineConfig = EngineConfig(
modelPath = "/path/to/your/model.litertlm",
backend = Backend.CPU(),
)
val engine = Engine(engineConfig)
engine.initialize()
val conversation = engine.createConversation()
print(conversation.sendMessage("What is the capital of France?"))
C++
auto model_assets = ModelAssets::Create(model_path);
CHECK_OK(model_assets);
auto engine_settings = EngineSettings::CreateDefault(
model_assets,
/*backend=*/litert::lm::Backend::CPU);
absl::StatusOr<std::unique_ptr<Engine>> engine = Engine::CreateEngine(engine_settings);
CHECK_OK(engine);
auto conversation_config = ConversationConfig::CreateDefault(**engine);
CHECK_OK(conversation_config);
absl::StatusOr<std::unique_ptr<Conversation>> conversation = Conversation::Create(**engine, *conversation_config);
CHECK_OK(conversation);
absl::StatusOr<Message> model_message = (*conversation)->SendMessage(
JsonMessage{
{"role", "user"},
{"content", "What is the capital of France?"}
});
CHECK_OK(model_message);
std::cout << *model_message << std::endl;
| 言語 | ステータス | 最適な用途 | ドキュメント |
|---|---|---|---|
| CLI | 🚀 早期プレビュー |
1 分以内に LiteRT-LM の使用を開始できます。 | CLI ガイド |
| Python | ✅ 安定版 |
パソコンと Raspberry Pi での迅速なプロトタイピングと開発。 | Python ガイド |
| Kotlin | ✅ 安定版 |
ネイティブ Android アプリと JVM ベースのパソコンツール。コルーチン向けに最適化されています。 | Android(Kotlin)ガイド |
| C++ | ✅ 安定版 |
高パフォーマンスのクロスプラットフォーム コアロジックと組み込みシステム。 | C++ ガイド |
| Swift | 🚀開発中 |
ネイティブ iOS と macOS の統合と、専用の Metal サポート。 | 近日提供予定 |
サポートされているバックエンドとプラットフォーム
| 加速 | Android | iOS | macOS | Windows | Linux | IoT |
|---|---|---|---|---|---|---|
| CPU | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| GPU | ✅ | ✅ | ✅ | ✅ | ✅ | - |
| NPU | ✅ | - | - | - | - | - |
サポートされているモデル
次の表に、LiteRT-LM でサポートされているモデルを示します。パフォーマンスの詳細な数値とモデルカードについては、 Hugging Face の LiteRT コミュニティをご覧ください。
| モデル | タイプ | サイズ(MB) | 詳細 | デバイス | CPU プレフィル(tk/秒) | CPU デコード(tk/秒) | GPU プレフィル(tk/秒) | GPU デコード(tk/秒) |
|---|---|---|---|---|---|---|---|---|
| Gemma4-E2B | チャット | 2583 | モデルカード | Samsung S26 Ultra | 557 | 47 | 3808 | 52 |
| iPhone 17 Pro | 532 | 25 | 2878 | 57 | ||||
| MacBook Pro M4 | 901 | 42 | 7835 | 160 | ||||
| Gemma4-E4B | チャット | 3654 | モデルカード | Samsung S26 Ultra | 195 | 18 | 1293 | 22 |
| iPhone 17 Pro | 159 | 10 | 1189 | 25 | ||||
| MacBook Pro M4 | 277 | 27 | 2560 | 101 | ||||
| Gemma-3n-E2B | チャット | 2965 | モデルカード | MacBook Pro M3 | 233 | 28 | - | - |
| Samsung S24 Ultra | 111 | 16 | 816 | 16 | ||||
| Gemma-3n-E4B | チャット | 4235 | モデルカード | MacBook Pro M3 | 170 | 20 | - | - |
| Samsung S24 Ultra | 74 | 9 | 548 | 9 | ||||
| Gemma3-1B | チャット | 1005 | モデルカード | Samsung S24 Ultra | 177 | 33 | 1191 | 24 |
| FunctionGemma | ベース | 289 | モデルカード | Samsung S25 Ultra | 2238 | 154 | - | - |
| phi-4-mini | チャット | 3906 | モデルカード | Samsung S24 Ultra | 67 | 7 | 314 | 10 |
| Qwen2.5-1.5B | チャット | 1598 | モデルカード | Samsung S25 Ultra | 298 | 34 | 1668 | 31 |
| Qwen3-0.6B | チャット | 586 | モデルカード | Vivo X300 Pro | 165 | 9 | 580 | 21 |
| Qwen2.5-0.5B | チャット | 521 | モデルカード | Samsung S24 Ultra | 251 | 30 | - | - |
問題の報告
バグが発生した場合や機能リクエストがある場合は、 LiteRT-LM GitHub Issuesで報告してください。