(2023-06-19) Udell Elevating The Conversation With Llm Assistants

Jon Udell: Elevating the Conversation with LLM Assistants. Here is some CSV data that created a problem for Steampipe’s CSV plugin. Can you see what’s wrong? Last week several of us failed to see, at first glance, what was wrong. Excel was happy with the data... ChatGPT-4 had a better idea.

the CSV file has an extra column header “notes” which does not have any corresponding values in the rows.

That still wasn’t quite right. Adding values to the second notes column won’t help in this case. Steampipe has to create a Postgres schema from the header row, and a schema can’t have two columns with the same name. The solution was to remove the duplicate notes column.

When I revised the prompt to include “Why can’t I import it into Postgres?” Cody figured it out.

But as Chris Wiggins reminds us in How Data and AI Happened, what we now call AI is rooted — by way of machine learning — in an older discipline we don’t hear much about nowadays: pattern recognition. That’s something our brains do really well

I think we can draw a useful distinction between low-level and high-level pattern recognition. We want machines to do more of the former, so we can do more of the latter.

High-Level Patterns

Here’s how Christopher Alexander’s A Pattern Language summarizes a pattern called FOUR-STORY LIMIT: “Therefore, in any urban area, no matter how dense, keep the majority of buildings four stories high or less.”

In a similar vein, here’s a pattern I’ve found useful in the realm of SQL: “Decompose a complex query into a pipeline of Common Table Expressions (CTEs), each naming a step that’s easy to read, test, and modify.”

They arrived at CTE-based solutions without a CTE-flavored prompt. That feels all the more remarkable because, in my experience, the pattern isn’t the most common or widely acknowledged and so may not be the likeliest prediction.

A few days later, Chris Cooper came back with a question about another query. This one was already written as a CTE pipeline — his question was about how to feed a parameter into it. But it presented an opportunity to dig into a SQL construct that I’d never used and only vaguely understood: the lateral cross join.

I asked my assistants to explain it, and all three did so very nicely.

Again I asked Chris for feedback, and here was his reply: “It successfully describes the what but not necessarily the why. There are several approaches that all solve the problem, but the reason the cross-join lateral is used here is to perform the expansion while only making a single query to the AWS table. Other methods would require iterating through the table once for each different column that you wanted to expose as IP.”

I’ll codify these as patterns with names like use-lateral-cross-join-to-form-a-column-from-multiple-rows-with-one-table-scan.

In The Chess Master and the Computer, Garry Kasparov famously wrote: “The winner was revealed to be not a grandmaster with a state-of-the-art PC but a pair of amateur American chess players using three computers at the same time. (cyborg)

Weak human + machine + better process was superior to a strong computer alone and, more remarkably, superior to a strong human + machine + inferior process.”

I’m just an average developer, a “weak human” in Kasparov’s formulation. My LLM assistants can handle many simple coding tasks for me, but the most powerful results will come from a “better process” for collaborating with them.


Edited:    |       |    Search Twitter for discussion