LLM fundamentals for Java developers
28 questions in 7 subtopics.
LLM fundamentals
Explain to a Java developer what tokens, context window, temperature and max output tokens are in an LLM API call, and how each affects cost, latency and output.What is the difference between an LLM's training data, its context, and retrieval-augmented generation? Why does a model sometimes state wrong facts confidently?At a high level, how does a transformer-based LLM generate a response, and what does that imply for streaming, latency and the KV cache in a Java service calling it?A Java team wants to use an LLM to classify 2 million support tickets per day into 30 categories. How would you evaluate whether an LLM is the right tool versus a classic classifier, and how would you build it?Your company wants a standard way for 40 Java services to use LLMs. Design the platform layer: gateway, model choice, logging, cost control and data protection.LLM capabilities and prices change every few months. As the senior technical leader, how do you make multi-year architecture decisions that do not lock the company into one model vendor or become obsolete quickly?Prompt engineering and fine-tuning
Write a prompt structure (system and user messages) for a Java service that extracts invoice number, date and total from invoice text and must return valid JSON. What techniques make the output reliable?After a model version upgrade, your summarisation feature starts ignoring the required bullet format and gets longer. Nothing in your Java code changed. How do you investigate and prevent this next time?When would you use prompt engineering, retrieval-augmented generation or fine-tuning to make an LLM answer questions about your company's insurance products? Compare cost, freshness and risk.Teams across your company are writing prompts directly in Java string constants, copied between services, with no versioning or testing. How do you bring engineering discipline to prompts?Running LLMs locally
How can a Java developer run an open-weight LLM locally for development, for example with Ollama, and call it from Spring Boot? What limits should they expect compared with a hosted model?Compliance forbids sending customer data to external AI APIs, so your team must self-host a model for document summarisation for 500 internal users. What do you need to plan?Design a test strategy for a Spring Boot service that uses an LLM, using a local model in CI. What can and cannot be tested this way?AI coding assistants
You use an AI coding assistant to write a Spring Data repository and a service method. What do you check before committing the generated code?Your team adopted AI coding assistants. Pull requests got bigger, review quality dropped and two production bugs came from generated code nobody fully understood. What changes would you make as the tech lead?The CTO wants AI coding assistants rolled out to 600 engineers. What policies, tooling and measurements would you put in place?As AI agents begin to write and change large parts of code bases, how should a company rethink hiring, career paths, code ownership and architecture over the next five to ten years?Prompt injection and AI security
What is prompt injection, and how does indirect prompt injection differ from direct? Give an example in a Java service that summarises emails.A RAG chatbot over internal documents started leaking salary data to employees who should not see it. Explain how this happened and how you fix the architecture.Your assistant can call tools that read orders, issue refunds and send emails. Design controls so that a prompt-injected model cannot cause harm.How would you build an AI security programme that covers prompt injection, data leakage, model supply chain and abuse across all AI features in the company?AI application use cases
Name four common LLM use cases in enterprise Java applications and, for each, one way it can fail in production.Product wants a natural-language-to-SQL feature so business users can query the orders database. Design it so it is safe and useful.Twenty teams propose AI features. How do you decide which to fund first and how to measure if they succeeded?Your company's competitors announce AI features every month and the board asks for an AI strategy. As the senior technical leader, what do you present?Java machine learning libraries
A Java team wants to run ML inference without Python. Name Java options for running models and what each is good for.Data scientists train a fraud model in Python, and the Java payment service must score each payment in under 20 ms. Compare calling a Python model server with running the model in the JVM.Machine learning in the enterprise has moved from Java-based tools such as Weka and Mahout to Python ecosystems, and now to LLM APIs. What does this history imply for how a Java-heavy company should organise ML and AI work?No question matches these choices.