upvote
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.

reply