(2023-09-07) Udell Learning While Coding How Llms Teach You Implicitly
Jon Udell: Learning While Coding: How LLMs Teach You Implicitly. I’ve always been a hands-on learner, especially when it comes to learning how to use — and create — software. In Radical just-in-time learning, I recalled my favorite scene in The Matrix. (2023-06-14-UdellRadicalJustInTimeLearning)
For that project, the helicopter I needed to learn how to pilot was React, the role of Tank the operator was played by an LLM
Did I “learn” React? Barely! This was an exploratory exercise. The resulting proof-of-concept may or may not evolve, but if it needs to I’ll have broken the ice.
The highlight of my previous post was an impressive performance by ChatGPT and its Code Interpreter plugin. Running it in an autonomous goal-directed loop, where the goal was to pass tests I’d written, was an eye-opening experience
I learned a number of useful things
Printing Expected and Actual Values
I like to do things the simplest possible way so there’s no test framework here, just a basic assert.
I hadn’t known about the optional second argument (or perhaps had forgotten)
the LLM showed me the idiom as a by-product of code it wrote to pass the test
This is the kind of tacit knowledge transfer that can happen when you work with another person
Here are some other bits of tacit knowledge transfer that happened along the way.
argparse Defaults
When ChatGPT used action=”store_true” I thought I knew what that meant, but asked the LLMs to verify.
Could I have learned that from documentation? Again, sure. Would I have learned it that way? Again, unlikely.
What happened instead is that the LLM surfaced the concept in a context where it was needed, showed me how to apply it, and when asked to explain, grounded the explanation in that very context
re.escape
The Negative Lookahead Assertion
Nonlocal Variables
here I learned the concept variable-in-the-nearest-enclosing-scope-that-is-not-global.
Getting up to Speed with Libraries
it was time to visualize it using tables and charts. Nowadays I’m most comfortable with SQL, so when ChatGPT provided solutions based on pandas.DataFrame, it created another learning opportunity
Another useful thing that I learned in passing: Matplotlib can render to HTML by way of mpld3, which can “Bring Matplotlib to the Browser”!
When the Matplotlib/mpld3 effort stalled, I asked ChatGPT to recommend another charting library that could render charts using HTML/CSS. It suggested plotly, Bokeh, and Vega-Altair.
There were still false starts and blind alleys! But the solution emerged quickly, by way of a collaboration that felt very much like pair programming.
Now more than ever programming entails finding and applying libraries and components that exist in bewildering profusion. You’re less likely to be writing what we conventionally think of as lines of code, much more likely to be tweaking parameters and settings. There’s a vast gulf between what the documentation says those parameters and settings mean and what actually happens when you try to use them. The ability of LLMs to help bridge that gap may turn out to be one of the most powerful forms of code-writing assistance they deliver.
Edited: | Tweet this! | Search Twitter for discussion