Hacker News new | ask | show | jobs
by cpard 361 days ago
> Let's start with what I see as the biggest problem that the introduction of LLMs is presenting to language design: everything is easier in Python.

This is so true.

A couple months ago I was trying to use LLMs to come up with code to parse some semi-structured textual data based on a brief description from the user.

I didn't want to just ask the LLM to extract the information in a structured format as this would make it extremely slow when there's a lot data to parse.

My idea was, why not ask the LLM to come with a script that does the job. Kind of "compiling" what the user asks into a deterministic piece of code that will also be efficient. The LLM just has to figure out the structure and write some code to exploit it.

I also had the bright idea to define a DSL for parsing, instead of asking the LLM to write a python script. A simple DSL for a very specific task should be better than using something like Python in terms of generating correct scripts.

I defined the DSL, created the grammar and an interpreter and I started feeding the grammar definition to the LLM when I was prompting it to do the work I needed.

The result was underwhelming and also hilarious at some times. When I decided to build a loop and feed the model with the errors and ask to correct the script, I ended up sometimes having the model returning back python scripts, ignoring completely the instructions.

As the author said, everything is easier in Python, especially if you are a large language model!