Scrivio Interview library

LLM fundamentals for Java developers

28 questions in 7 subtopics.

LLM fundamentals

ConceptFoundations8 min read
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.
ConceptFoundations7 min read
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?
InternalsIntermediate7 min read
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?
ScenarioIntermediate7 min read
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?
DesignAdvanced7 min read
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.
LeadershipPrincipal7 min read
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

CodingFoundations7 min read
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?
DebuggingIntermediate7 min read
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?
DesignIntermediate7 min read
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.
LeadershipAdvanced6 min read
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

ConceptFoundations7 min read
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?
ScenarioIntermediate7 min read
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?
DesignAdvanced7 min read
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

ScenarioFoundations7 min read
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?
LeadershipIntermediate6 min read
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?
LeadershipAdvanced6 min read
The CTO wants AI coding assistants rolled out to 600 engineers. What policies, tooling and measurements would you put in place?
LeadershipPrincipal6 min read
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

ConceptFoundations6 min read
What is prompt injection, and how does indirect prompt injection differ from direct? Give an example in a Java service that summarises emails.
ScenarioIntermediate7 min read
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.
DesignIntermediate7 min read
Your assistant can call tools that read orders, issue refunds and send emails. Design controls so that a prompt-injected model cannot cause harm.
LeadershipAdvanced6 min read
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

ConceptFoundations7 min read
Name four common LLM use cases in enterprise Java applications and, for each, one way it can fail in production.
DesignIntermediate7 min read
Product wants a natural-language-to-SQL feature so business users can query the orders database. Design it so it is safe and useful.
ScenarioAdvanced6 min read
Twenty teams propose AI features. How do you decide which to fund first and how to measure if they succeeded?
LeadershipPrincipal6 min read
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

ConceptFoundations6 min read
A Java team wants to run ML inference without Python. Name Java options for running models and what each is good for.
DesignIntermediate6 min read
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.
LeadershipPrincipal5 min read
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?