LiteRT-LM – Übersicht

LiteRT-LM ist ein produktionsfertiges Open-Source-Framework für die Inferenz, das für leistungsstarke, plattformübergreifende LLM-Bereitstellungen auf Edge-Geräten entwickelt wurde.

  • Plattformübergreifende Unterstützung:Ausführung auf Android, iOS, im Web, auf Computern und auf IoT-Geräten (z.B. Raspberry Pi).
  • Hardwarebeschleunigung:Maximale Leistung und Systemstabilität durch Nutzung von GPU- und NPU-Beschleunigern auf verschiedenen Hardwareplattformen.
  • Multimodalität:Entwicklung mit LLMs, die Bild- und Audioeingaben unterstützen.
  • Tool-Nutzung:Unterstützung von Funktionsaufrufen für Agent-Workflows mit eingeschränkter Decodierung für eine höhere Genauigkeit.
  • Breite Modellunterstützung:Ausführung von Gemma, Llama, Phi-4, Qwen und mehr.

On-Device GenAI Showcase

Screenshot der Google AI Edge-Galerie

Die Google AI Edge-Galerie ist eine experimentelle App, mit der Sie die Möglichkeiten der generativen KI auf dem Gerät demonstrieren können. Sie wird vollständig offline mit LiteRT-LM ausgeführt.

Geräteprofil Modus Prefill (tk/s) Decode (tk/s)
MacBook Pro 2023 M3 CPU 233 28
MacBook Pro 2024 M4 GPU 2265 48
Samsung S24 (Ultra) CPU 111 16
GPU 816 16

Ihre erste eigene App

Die folgenden Code-Snippets zeigen die ersten Schritte mit der LiteRT-LM-Befehlszeile sowie den Python-, Kotlin- und C++-APIs.

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;
Sprache Status Optimal für... Dokumentation
CLI 🚀
Frühe Vorabversion
Erste Schritte mit LiteRT-LM in weniger als einer Minute. CLI-Leitfaden
Python
Stabil
Rapid Prototyping, Entwicklung auf dem Computer und Raspberry Pi. Python-Leitfaden
Kotlin
Stabil
Native Android-Apps und JVM-basierte Desktop-Tools. Für Coroutinen optimiert. Kotlin-Leitfaden
C++
Stabil
Leistungsstarke, plattformübergreifende Kernlogik und eingebettete Systeme. C++-Leitfaden
Swift 🚀
In Entwicklung
Native iOS- und macOS-Integration mit spezieller Metal-Unterstützung. Demnächst verfügbar

Unterstützte Back-Ends und Plattformen

Beschleunigung Android iOS macOS Windows Linux IoT
CPU
GPU -
NPU - - - - -

Unterstützte Modelle

In der folgenden Tabelle sind die von LiteRT-LM unterstützten Modelle aufgeführt. Weitere Leistungszahlen und Modellkarten finden Sie in der LiteRT-Community auf Hugging Face.

Modell Typ Größe (MB) Downloadlink Gerät CPU-Prefill (tk/s) CPU-Decode (tk/s) GPU-Prefill (tk/s) GPU-Decode (tk/s)
Gemma3-1B Chat 1005 Modellkarte Samsung S24 Ultra 177 33 1191 24
Gemma-3n-E2B Chat 2965 Modellkarte MacBook Pro M3 233 28 - -
Samsung S24 Ultra 111 16 816 16
Gemma-3n-E4B Chat 4235 Modellkarte MacBook Pro M3 170 20 - -
Samsung S24 Ultra 74 9 548 9
FunctionGemma Basis 289 Modellkarte Samsung S25 Ultra 2238 154 - -
phi-4-mini Chat 3906 Modellkarte Samsung S24 Ultra 67 7 314 10
Qwen2.5-1.5B Chat 1598 Modellkarte Samsung S25 Ultra 298 34 1668 31
Qwen3-0.6B Chat 586 Modellkarte Vivo X300 Pro 165 9 580 21
Qwen2.5-0.5B Chat 521 Modellkarte Samsung S24 Ultra 251 30 - -

Probleme bei der Berichterstellung

Wenn Sie auf einen Fehler stoßen oder eine Funktionsanfrage haben, melden Sie dies unter LiteRT-LM GitHub Issues.