How yuva-raj444/mobllm works
OfflineLlamaChat is an Android app for running llama.cpp language models locally. The user provides a GGUF model path, loads the model, sends chat messages, and receives streamed tokens. The README describes the Compose UI and Kotlin chat components, while the sampled native source confirms JNI model loading, prompt processing, token streaming, abort, and cleanup. Kotlin source excerpts were not provided, so links among the app layers are shown as unverified; the native-to-llama.cpp calls are visible in the excerpt.
Main entry points: ai_chat.cpp JNI inference · ChatScreen.kt Chat screen · InferenceEngine.kt Inference API · ChatViewModel.kt Chat state
Components 8
Android app
- Chat screen
app/src/main/java/com/example/llama/ChatScreen.kt - Chat state
app/src/main/java/com/example/llama/ChatViewModel.kt - App entry
app/src/main/java/com/example/llama/MainActivity.kt
On-device inference
- Inference API
lib/src/main/java/com/example/llama/InferenceEngine.kt - JNI inference
lib/src/main/cpp/ai_chat.cpp
Other components
- User
- GGUF model file
- llama.cpp runtime
Connections 9
- User → Chat screen: chats in
README.md - App entry → Chat screen: hosts UI
- Chat screen → Chat state: forwards input
- Chat state → Inference API: requests inference
- User → GGUF model file: provides path
README.md - Inference API → JNI inference: calls JNI
lib/src/main/cpp/ai_chat.cpp - JNI inference → GGUF model file: loads model
lib/src/main/cpp/ai_chat.cpp - JNI inference → llama.cpp runtime: runs inference
lib/src/main/cpp/ai_chat.cpp - JNI inference → Inference API: streams tokens
lib/src/main/cpp/ai_chat.cpp