For my day job I am on the development team of an open source Python notebook platform called Marimo. Earlier this year we launched a tool called marimo-pair which provides an interface for agents to write code snippets and manipulate the notebook environment. Because notebooks force LLMs to write inspectable code incrementally I figured they are a good environment for answering questions about productivity and efficiency.
I ran an initial experiment here where I found that because LLMs knew Python libraries better they could produce more idiomatic Python in fewer tries. That is if you ask an LLM to sum a column in a CSV file it’ll do something like:
import pandas as pd
df = pd.read_csv("./my_file.csv")
print(df["col"].sum())
Whereas if you asked it to do the same in Haskell it either:
I thought the question was settled for a while until I tried using marimo-pair on newer Python libraries that weren’t well represented in the training data. Even newer versions of common libraries with major upgrades and noticed the “Haskell” failure modes appear.
When asked to use an unseen/unfamiliar Python API the LLM would either:
help() on the module and then reason its way through. However, oftentimes it would say it’s not possible and ask you to install a specific version of the package. So I reframed my question from which language is more token-efficient to - how do you design a set of language APIs to make writing unfamiliar code easier.
The result was this blog post. The conclusions were:
String as a type everywhere for example). I’m going to continue some of this work next year in preparation for Zurihac but I think more generally the question of LLM language productivity needs a really good design/setup and every experiment needs to be clear about what it’s measuring and why.