AIToday

Developer reduces RAM usage by 74% while running SmolLM2 on Samsung Galaxy Watch 4 by fixing llama.cpp's duplicate model loading issue

Hacker NewsApr 2, 20261 min read
Developer reduces RAM usage by 74% while running SmolLM2 on Samsung Galaxy Watch 4 by fixing llama.cpp's duplicate model loading issue

Summaries like this, in your inbox every morning.

Sign up free →

3 Key Points

  1. SmolLM2 360M model was being loaded twice in RAM simultaneously — once via APK mmap page cache and again through tensor allocations — peaking at 524MB for a 270MB model

  2. Fix involved adding host_ptr to llama_model_params so CPU tensors point directly to mmap region while only Vulkan tensors get copied separately

  3. Peak RAM usage dropped from 524MB to 142MB (74% reduction) and first boot time improved from 19s to 11s on real hardware

  4. Second boot now achieves ~2.5s startup time thanks to mmap and KV cache optimization

  5. Code available on GitHub at Perinban/llama.cpp with performance metrics documented via VmRSS measurements

Discussion

No comments yet. Be the first to share your thoughts!

Log in to join the discussion

Related Articles

Stay ahead with AI news

Get curated AI news from 200+ sources delivered daily to your inbox. Free to use.

Get Started Free

Free · takes 30 seconds · unsubscribe anytime

1 minute a day. The AI essentials.

200+ sources · Email / LINE / Slack

Get it free →