Back to News
Advertisement
KKingJoker 1 day ago 3 commentsRead Article on github.com

RU version is available. Content is displayed in original English for accuracy.

I wanted to run AI from inside the JVM. I started out with the standard REST sidecar, ripped that out to use Project Panama (Foreign Function & Memory API) in the new JDK versions to interface directly with llama.cpp. I still wasn't happy with how that functioned, so I built libargus.cc to get a clean ABI to expose a structured API up in the JVM landscape. It still uses Project Panama to interface directly with llama.cpp, whisper.cpp, and ggml compute graphs.

I have zero-allocation on the hot paths, memory segments for prompts and tokens are allocated once inside confined Arenas. Raw pointers pass straight through down to the low C level. This avoids primitive array cloning and heap churn.

I mapped out the native structures from llama.cpp and whisper.cpp while matching the compiler's padding to maintain safe memory access.

I bundle pre-compiled native binaries in the jar for easy deployment.

This execution engine provides the foundation I need for work I'm doing on a spatio-temporal memory layer (L-TABB) to replace RAGs. I'd love to get technical feedback to polish any issues while I continue working on the next layer. Deep-dives from anyone hacking on Project Panama or low-latency systems in modern JDK would be very appreciated!

I'm much better with code than prose, so I'll let the code do most of the talking.

Happy Hacking! /David

Code: https://libargus.cc Project Landing Page: https://projectargus.cc

Advertisement

⚡ Community Insights

Discussion Sentiment

100% Positive

Analyzed from 69 words in the discussion.

Trending Topics

#shuffling#curious#hear#bottlenecks#encountered#traditional#path#compute#data#involved

Discussion (3 Comments)Read Original on HackerNews

RandomBK34 minutes ago
I'm curious to hear what bottlenecks you encountered in the traditional path. Of all the compute and data shuffling involved in LLM inference, I would have thought shuffling the raw input/output around would have been a trivial part of the overall cost, and thus not a big optimization target?
exabrial1 day ago
This is pretty impressive.
KingJoker1 day ago
Thanks! It was a fun challenge getting an AI agent to pair with me while adhering to strict c-struct padding and memory alignment.

Let me know if anything sticks out you'd like to discuss deeper!