Menu

1 / 2

Stop regex-ing the LLM's prose

DEV Community: go·Matt Cockayne·15 days ago
#t8pG5RbP
#devtogo#devto#dev#schema#model
Long article (934 words) — no AI summary yet.
Reading 0:00
15s threshold

Ask an LLM a question and it hands you back prose. Lovely to read, miserable to program against. You wanted the one number buried in the middle of it, and now you're writing a regular expression to fish a word out of three well-written paragraphs that phrase themselves slightly differently every single time you run them.

There's a much better way, and it's the difference between forever interpreting an LLM and actually building on one.

The problem with a paragraph

You ask an LLM to analyse a log file and tell you the severity of what it found and a suggested fix. It comes back with three well-written paragraphs. Somewhere in there is the word "critical", and somewhere is the fix.

Your program now has to extract those two facts from prose, and prose has no contract. The next run, the model phrases it differently. It leads with a caveat. It says "severe" where last time it said "critical". It puts the fix first.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.