Live data from Hacker News

I replaced 50 lines of code with a single LLM prompt

haihai.ai

11–20 of 45 posts

Re: I replaced 50 lines of code with a single LLM prompt

#12
post #3

So you replaced 50 lines of code with a service call to a service that burns massive amounts of electricity/cooling capacity, certainly runs slower, and adds a service dependency that could break on a whim without your knowledge? And that’s a win?

But isn't this somewhat true of many cloud hosted api calls we already make heavy use of day to day?

I think this is a cute use case. I've recently outsourced categorizing the titles of user created tutorials into groups by relative similarity, to great effect. Took a few minutes.

It's definitely a win in my book.

Re: I replaced 50 lines of code with a single LLM prompt

#13
post #4

Good luck debugging cases it gets wrong. LLMs seeping into cases that have one valid solution will bring so many new problems to random customers.

> I spent an entire afternoon writing string-matching heuristics, regular expressions, and even implementing Levenshtein distance to answer the simple question, "is this address the same as that one?"

> But then, on a lark, I replaced all that code – 50+ lines in all – with a single call to GPT. And within ten minutes and just a few lines of code, I hit 100% accuracy against my test suite!

They could write an extra layer or two to preprocess and match obvious easy ones, and also to sanity-check the LLM's output for hard ones.

Re: I replaced 50 lines of code with a single LLM prompt

#16
post #3

So you replaced 50 lines of code with a service call to a service that burns massive amounts of electricity/cooling capacity, certainly runs slower, and adds a service dependency that could break on a whim without your knowledge? And that’s a win?

50 lines of code that were never going to work with great accuracy. Sure, it absolutely might be a win. It depends on just how much accuracy they needed in the checking system in question. It's also worth noting that one could utilize both. The assumed fast, low cost 50 lines of code on your server that takes care of the easy 97%. And then throw GPT4 at the stray hard cases. It requires being able to correctly identi…

Great accuracy as tested to a continually changing black box. GPT hits are also expensive and often have unpredictable latency. This would have to be integration tested to detect changes to GPT answers.

Re: I replaced 50 lines of code with a single LLM prompt

#17
I can't help but think LLM is the wrong tool for the job here. There are many address validation and standardization services, including databases you can get straight from USPS. Those services will give you real and consistent answers, rather than unknown edge cases that will shift subtly over time as your LLM changes.

Edit: The USPS even runs a program called CASS for this exact purpose. While you may not need to CASS certify yourself, you can either follow its rules or use a service that follows CASS to guarantee your results are accurate.

Re: I replaced 50 lines of code with a single LLM prompt

#20

Earlier quoted context omitted.

50 lines of code that were never going to work with great accuracy. Sure, it absolutely might be a win. It depends on just how much accuracy they needed in the checking system in question. It's also worth noting that one could utilize both. The assumed fast, low cost 50 lines of code on your server that takes care of the easy 97%. And then throw GPT4 at the stray hard cases. It requires being able to correctly identi…

Great accuracy as tested to a continually changing black box. GPT hits are also expensive and often have unpredictable latency. This would have to be integration tested to detect changes to GPT answers.

Correct me if I'm wrong, you can pick which dated GPT API to utilize and expect that to not act as a continually changing black box. I've been using the API for a long time and have been able to pick the version.

So for example: gpt-4-0314, or gpt-3.5-turbo-0613, etc.

The latency issue is definitely true. Ideally the cost could be limited to a very small percentage of hard cases (which you first have to identify).

Post reply on HN