AI Engineering
Learn LLMs, RAG, agents, secure tools, and production AI through practical insurance examples.
Guardrails
Beginner — What is a guardrail?
What is a guardrail?
A check limiting unsafe or invalid behavior at input, output, or tool boundaries. Examples include schemas, content checks, evidence validation, rate limits, business rules, and approval gates.
Does valid structured output mean safe output?
No. A valid object can contain false facts or unauthorized action arguments. I validate shape, then check business meaning, ownership, evidence, and required approval independently.
What should fail closed?
Permission, approval, and critical business-rule checks should block action when they cannot establish validity. For uncertain content or model availability, I use an appropriate clarification, template, search result, or human escalation rather than silently…
A moderation check rejects legitimate injury descriptions. What do you do?
I inspect domain-specific false positives, refine the policy and calibration dataset, and provide a permitted review path. Insurance support must handle legitimate sensitive content while minimizing private data and enforcing access.
Evaluation
Beginner — Why isn't normal unit testing enough?
Why isn't normal unit testing enough?
Model outputs vary and can be plausible but wrong. I still unit-test deterministic code, but also evaluate representative tasks, support from evidence, tool behavior, and safe failure using versioned datasets and rubrics.
Faithfulness versus correctness?
Faithfulness asks whether the answer follows its evidence. Correctness asks whether it is the right answer for the applicable task and facts. An answer can faithfully repeat an outdated or inapplicable policy and remain wrong.
How do you trust an LLM judge?
I calibrate it against human-labeled cases, test adversarial outputs, track disagreement, and version its rubric/model. I combine it with deterministic checks and never make it the sole permission or financial gate.
A new prompt raises average accuracy but causes one tenant leak. Ship?
No. Severe boundary violations are release blockers regardless of the average. I investigate the cause, fix the enforced access boundary, add the case to the security suite, and rerun relevant regression and quality checks.
Observability
Beginner — What do you trace in an AI request?
What do you trace in an AI request?
Authentication, retrieval, model calls, tool calls, state transitions, validation, and final outcome, linked by run/request IDs. I record timing, usage, and safe metadata without indiscriminately logging private content.
Time to first token versus total latency?
Time to first token measures how soon generation begins producing text, while total latency includes all required work and completion. Streaming improves perceived progress but may not reduce total runtime or cost.
Trace versus audit log?
A trace diagnoses execution and performance and may be sampled. A business audit records important actions, actors, decisions, and outcomes with appropriate integrity/retention. I link them but do not let sampled traces replace claim approval records.
The API returned 200 but the user got no complete answer. Why?
Streaming headers may have been sent before an error or disconnect. I inspect terminal events and run/message status rather than HTTP code alone, then check provider completion, validation, cancellation, and persistence spans.
Cost optimization
Beginner — What determines AI cost?
What determines AI cost?
Input/output usage, model pricing, tool/search calls, embeddings, retries, and infrastructure. Human review and failed tasks also matter. I calculate total cost per completed useful task rather than only one API call.
When is semantic caching unsafe?
When similar requests differ in tenant, user permissions, policy version, date, or personalized facts. I restrict it to suitable stable tasks and include freshness and scope dependencies; exact caches also require proper keys and invalidation.
Difficulty is an editorial estimate. Completion means you chose to mark a question as understood.