Skip to main content

AI & Machine Learning

Tutorials and deep-dive implementations covering artificial intelligence and machine learning concepts in Java and other languages.

Spring AI with Docker Model Runner vs Ollama: Local LLMs Benchmarked on the Same Laptop

Point one Spring AI 2.0.2 OpenAiChatModel at Docker Model Runner and at Ollama by changing only base-url and the model name. Same GGUF model, same prompts: decode speed, time to first token, container memory and tool-call success, with transcripts. Measured on a CPU-only shared sandbox with the real docker/model-runner image; GPU and Docker Desktop paths were not measured and the post says so.

Spring AI + Spring Batch: Classifying 100,000 Support Tickets with an LLM (Throttling, Retries, Cost)

A Spring Batch 6 chunk step calls a Spring AI ChatClient for 100,000 generated support tickets. Resilience4j rate limiting and retry, skip-and-record for malformed JSON, a restart after kill -9 in a second JVM that ends byte-identical, and a per-chunk cost ledger, all run against a deterministic simulated model with every number taken from a committed transcript.

Google ADK for Java: Your First Multi-Agent App

Build two agents that hand work to each other with Google's Agent Development Kit for Java 1.11.0: an LlmAgent with a tool, a SequentialAgent, and session state as the hand-off. Runs without an API key, using a scripted stand-in model that is labelled as such.

LangGraph4j: Stateful Agent Graphs in Java

Draw an agent as a graph of nodes, edges and shared state, pause it for a human with a checkpoint, and resume it later. A loan-approval agent on LangGraph4j 1.9.5, with the one default (releaseThread) that silently erases a finished run.