WhoBuilt

Optimizing LLMs in Insurance with DSPy

Feb 16, 2025· 19 min· 6.2K views·Watch on YouTube

Speaker

Jeronim Morina, an AI engineer at AXA Germany, explains how his team approaches insurance customer service problems with LLMs and DSPy at an AI Engineer talk.

Build systems for real problems

Morina argues that engineers should focus on customer problems instead of tinkering with models and toy datasets. At AXA Germany, its Data Innovation Lab works with business unit data scientists to help customer service agents handle rising claims and other challenges.

Inspect prompts and trace behavior

For a chatbot that helps customers understand insurance terms, Morina’s team worked with domain experts to define the task and create examples. They found prompts fragile and hard to maintain, so he recommends inspecting what tools send to models and using traces, such as those from Arize Phoenix, to understand system behavior.

Measure before optimizing

The team spent several months preparing production data as clean input and output pairs for evaluation. Morina warns about data leakage and recommends establishing a baseline with enough examples and a clear metric before trying DSPy or other tools.

Decompose programs for DSPy

Morina says DSPy helped the team work with a complex system, but it has a steep learning curve and is not an automatic fix. He recommends splitting a large program into modules, such as retrieval and answer generation, so optimizers have useful signals to improve prompts and weights. For German text, he found that built-in exact match and passage match metrics did not work out of the box, so teams need their own evaluators.

Start small and iterate

Morina’s practical advice is to write prompts by hand first, then add basic evaluations such as regex or string comparisons before trying LLM-as-a-Judge. Make small changes and use a clear objective to tell whether the system is improving. He points learners to Connor Shorten’s DSPy resources for deeper instruction.

Takeaways

  • Define the user problem with domain experts before choosing an LLM workflow.
  • Inspect prompts and trace model calls to understand fragile behavior.
  • Build clean, labeled evaluation data and check for leakage before optimizing.
  • Break complex programs into modules so optimization has clear signals.
  • Start with simple metrics and small changes; use language-specific evaluators where needed.

Mentioned in this talk

Search inside this talk

What was claimed 7

  • launched
    AXA Germany: Data Innovation Lab
    “AXA Germany started the Data Innovation Lab in 2017”
    YouTube
    Unverified1 source· Talk
  • integrates with
    AXA Germany integrates with OpenAI
    collaboration on internal GPT platform
    “we started collaborating with OpenAI”
    YouTube
    Unverified1 source· Talk
  • launched
    internal secure platform
    “at the beginning of the year, we started collaborating with OpenAI and created the secure GPT Genie platform internally”
    YouTube
    Unverified1 source· Talk
  • integrates with
    AXA Germany integrates with Mistral
    working together to expand the internal GenAI platform
    “we’re working together with Mistral AI”
    YouTube
    Unverified1 source· Talk
  • uses
    trace and inspect LLM calls
    “we started using an open-source library called Arize Phoenix”
    YouTube
    Unverified1 source· Talk
  • feature
    DSPy: Compiles a program into different instructions optimized against a metric
    “DSPy compiles the same program into different instructions”
    YouTube
    Unverified1 source· Talk
  • feature
    DSPy: Supports typed modules such as Predict and Chain of Thought; custom modules may be needed for specific cases
    “DSPy comes with typed modules like Predict or Chain of Thought, but if you want something more specific to your case, you need to come up with your own module”
    YouTube
    Unverified1 source· Talk

Related talks