Menu

Tian AI LLM Manager: Process Lifecycle on Mobile Devices
📰
0

Tian AI LLM Manager: Process Lifecycle on Mobile Devices

DEV Community·Jeffrey.Feillp·about 1 month ago
#UkDxoHHQ
#ai#python#llm#process#llmmanager#seconds
Reading 0:00
15s threshold

Tian AI LLM Manager: Process Lifecycle on Mobile Devices Running a 1.5B parameter LLM on a phone is hard. Keeping it alive is harder. The Problem Termux (Android terminal) kills background processes when the device goes to sleep or when memory is low. The LLM process (llama-server) is especially vulnerable because it uses 2-4GB of RAM. The Solution: LLMManager Tian AI includes a dedicated process manager that monitors and maintains the LLM process: class LLMManager : def __init__ ( self ): self . health_check_interval = 30 # seconds self . max_restart_attempts = 5 self . backoff_strategy = [ 1 , 2 , 4 , 8 , 15 ] # seconds Enter fullscreen mode Exit fullscreen mode Key Features Health Checks Every 30 seconds, the manager pings the llama-server endpoint. If no response within 5 seconds, it attempts recovery. Auto-Restart If the process dies, LLMManager spawns a new instance with the same parameters. Up to 5 restart attempts with exponential backoff. Resource Monitoring Tracks memory usage and CPU load.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More