logoalt Hacker News

esttoday at 7:23 AM1 replyview on HN

The thing with LLM is they don't automatically pair parenesis/curly braces like we do with editors/IDEs.

The closing } ) ] token has to be generated to match exactly the beginning { ( [ many lines before. You can challenge yourself writing Lisp by hand without cursor moving backwards, and try close correctly by counting ))))))) you'd have a big headache.

A long, nested sub-routine with many () {} will cost LLM's context and makes it underperform, because the attention head have to track the state. On the other hand the indentation level can be infered as a single token[1] and saves reasoning effort.

Note these discussion is about "code generation", not parsing.

1: https://platform.openai.com/tokenizer Try input many spaces.


Replies

Athanase000today at 12:06 PM

I really don't understand this argument. The "opening tab" in Python has to be matched with an "absence of tab". I don't see any non-cosmetic difference between Python and curly brace languages.