AI chatbots, such as ChatGPT, are shaping the way we work. Personally, I find them useful, especially for refreshing my memory on programming syntax.
Given that cashflower is an open-source package with documentation available online, I decided to explore if an AI assistant can be used to help with actuarial modelling. In this post, I will share my findings.
Knowledge cut-off date
AI assistants have a knowledge cut-off date, meaning they are trained with information up to a specific point in time. The cashflower package is relatively new, so the AI assistant might not know about it. Sometimes, AI can "hallucinate", providing incorrect but convincing answers. Some chatbots have access to the internet so they can read documentation online.
![](/static/img/48/chatgpt_01.png)
Here, the AI assistant has a cut-off date of October 2023. There are more recent versions of the cashflower package, so it might help to ask the AI chatbot to use the online documentation.
Input creation
Let's ask AI to create some dummy model points. I instructed the AI assistant to use the online documentation.
![](/static/img/48/chatgpt_02.png)
The answer is actually more comprehensive than I requested. I only expected the code for input.py, but the response also covered installation, adding model variables, and running the model.
I've tried the code and everything works correctly. I'm impressed!
Modelling
Now let's ask the AI to add some more logic. Imagine we need to model the expected benefit, which requires some mortality data and a new model variable.
![](/static/img/48/chatgpt_03.png)
The model first creates a CSV file with mortality rates and then reads it in the input.py. It then adds two new variables: mortality rate and expected benefit. The response also includes information on how to run the model.
The code contains a small error: there is a mismatch in how gender is denoted in the model points and the mortality rate. We need to change the column names in the mortality table from "male" to "m" and "female" to "f" for the model to work correctly.
Despite this issue, the response is overall very helpful. I believe AI assistants can be valuable in supporting the work of actuaries, but they still require careful oversight and fact-checking by the user.