top | item 44360808

(no title)

taysix | 8 months ago

I had a fun result the other day from Claude. I opened a script in Zed and asked it to "fix the error on line 71". Claude happily went and fixed the error on line 91....

1. There was no error on line 91, it did some inconsequential formatting on that line 2. More importantly, it just ignored the very specific line I told it to go to. It's like I was playing telephone with the LLM which felt so strange with text-based communication.

This was me trying to get better at using the LLM while coding and seeing if I could "one-shot" some very simple things. Of course me doing this _very_ tiny fix myself would have been faster. Just felt weird and reinforces this idea that the LLM isn't actually thinking at all.

discuss

order

klysm|8 months ago

LLMs probably have bad awareness of line numbers

mcintyre1994|8 months ago

I suspect if OP highlighted line 71 and added it to chat and said fix the error, they’d get a much better response. I assume Cursor could create a tool to help it interpret line numbers, but that’s not how they expect you to use it really.

crackalamoo|8 months ago

Not sure how tools like Cursor work under the hood, but this seems like an easy model context engineering problem to fix.

weatherlite|8 months ago

That's the thing. We're expecting the tool to have a clear understanding of its own limitations by now and ask for better prompts (or say: I don't know, I can't etc). The fact it just does something wacky is not good at all to the consistency of these tools.

ProllyInfamous|8 months ago

I do not code/program, but I do read thousands of fiction pages annually. LLMs (Perplexity, specifically) have been my lifetime favorite book club member — I can ask anything.

However, I can't just say "on page 123..." I've found it's better to either provide the quote, or describe the context, and then ask how it relates to [another concept]. Or I'll say "at the end of chapter 6, Bob does X, then why Y?" (perhaps this is similar to asking a coding LLM to fix a specific function instead of a specific line?).

My favorite examples of this have been sitting with living human authors and discussing their books — usually to jaw-dropped creators, particularly to Unknowns.

Works for non-fiction, too (of course). But for all those books you didn't read in HS English classes, you can somewhat recreate all that class discussion your teachers always attempted to foster — at your own discretion/direction.

senko|8 months ago

> This was me trying to get better at using the LLM while coding

And now you've learned that LLMs can't count lines. Next time, try asking it to "fix the error in function XYZ" or copy/paste the line in question, and see if you get better results.

> reinforces this idea that the LLM isn't actually thinking at all.

Of course it's not thinking, how could it? It's just a (rather big) equation.

throwdbaaway|8 months ago

As shared by Simon in https://news.ycombinator.com/item?id=44176523, a better agent will prepend the line numbers as a workaround, e.g. Claude Code:

    54 def dicts_to_table_string(
    55     headings: List[str], dicts: List[Dict[str, str]]
    56 ) -> List[str]:
    57     max_lengths = [len(h) for h in headings]
    58 
    59     # Compute maximum length for each column
    60     for d in dicts:

aitchnyu|8 months ago

In Aider, I would add a comment `fix this ai!` and Aider adds the context and updates the code. Wish it were more seamless though.

IshKebab|8 months ago

> It's just a (rather big) equation.

So are you.

baby|8 months ago

ITT: people trying to use AI to code for the first time

toephu2|8 months ago

Sounds like operator error to me.

You need to give LLMs context. Line number isn't good context.

meepmorp|8 months ago

> Line number isn't good context.

a line number is plenty of context - it's directly translatable into a range of bytes/characters in the file

oneeyedpigeon|8 months ago

Of all the things I thought I'd read today, "Line number isn't good context" is more wild than I could possibly have imagined.

rs186|8 months ago

Imagine saying to another software engineer "you only gave me the line number, that's not enough context"