4 ms·
I hope that someday LLMs will interact with code mostly via language servers, rather than reading the code itself (which both frequently confuses the LLM, as yo
by wavemode 8mo ago
I hope that someday LLMs will interact with code mostly via language servers, rather than reading the code itself (which both frequently confuses the LLM, as you've noted, but is also simply a waste of tokens).
- dnautics 8mo agowhy? I suspect that writing code itself is extremely token efficient (unless like your keywords happen to be silly, super-long alien text). Like which do you think is more token-efficient? 1) <tool-call write_code "my_function(my_variable)"/> 2) <tool-call available_functions/> resp: <option> my_function </option> <option> your_function </option> <option> some_other_function </option> <option> kernel_function1 </option> <option> kernel_function2 </option> <option> imported_function1 </option> <option> imported_function2 </option> <option> ... </option> <tool-call write_function_call "my_function"/> resp: <option> my_variable </option> <option> other_variable_of_same_type </option> <tool-call write_variable "my_variable"/>
- wavemode 8mo agoNot sure I follow. You seem to have omitted the part of 1) explaining how the LLM knew that my_function even existed - presumably, it read the entire file to discover that, which is way more input tokens than your hypothetical available_functions response.
- dnautics 8mo agoReading files is not that input tokien heavy, I suspect. But anyways I omitted it because presumably it would have done so to gain local context in general.
- wavemode 8mo agoI still don't follow. Why doesn't that count as cost?
- dnautics 8mo agoA+B > A+C => B > C
- wavemode 8mo agoThe LLM doesn't need to read the whole file in example 2). Why would it?
- dnautics 8mo agoWhere would it inject the code?
- wavemode 8mo agoPresumably, the same MCP tool allowing it to read specific definitions would also allow it to write out specific definitions (rather than, again, having to write out the whole file just to make one change). Otherwise it defeats the purpose. This is the same way humans work on code. You never read an entire file top to bottom just to find out one thing, and you never type out the entire file just to make one change. This would, understandably, be very taxing on your working memory, and you'd probably make more mistakes.
- dnautics 8mo agoHonestly claude doesn't typically do this the way you think. It's perfectly capable of working in files that are "way too big for its allowed download window". But in general you want some amount of context (what functions are available in scope, etc.)
- 0x457 8mo agoLSP is meant for IDEs and very deterministic calls. Its APIs are like this: give me a definition of <file> <row> <column> <lenght>. This makes sense for IDEs because all of those can be deterministically captures based of your cursor position. LLMs are notoriously bad at counting.
- wavemode 8mo agoI think one could easily build an MCP tool wrapping LSP which smooths over those difficulties. What the LLM needs is just a structured way to say "perform this code change" and a structured way to ask things like "what's the definition of this function?" or "what functions are defined in this module?" Not much different from what agents already do today inside of their harnesses, just without the part where they have to read entire files to find the definition of one thing.
- 0x457 8mo agoSo not using LSP, but rather using something in a middle that uses LSP as implementation detail. So far enabling LSP in Claude only added messages like "this is old diagnostic before my edit".