Hacker News
What I'm Finding About LLM Code Style and Token Costs
bombcar
|next
[-]
You need to know the shape of the solution ...
anttiharju
|root
|parent
|next
[-]
https://stackoverflow.com/questions/1732348/regex-match-open...
vadansky
|root
|parent
|previous
[-]
If you draw a sloppy circle and fill it in, it'll "escape" and try to paint the whole canvas (and back in the day would get my slow computer stuck until I spam "esc").
You have to be able to draw a good circle to use it.
joshka
|next
|previous
[-]
Maybe there should be a submit your post training corpus here thing somewhere.
E.g. this really comes down to advice changing in short time frames that aren't represented in data that satisfies knowledge cutoff which can be as long as 14 months in some things or more for older models. It's not just the problem of knowledge, but the grading of seen output. The models have been trained to produce the older style code because it compiles and solves the problems.
Here, the reframe that likely makes sense noting is that "Deno and runtimes like Cloudflare Workers implement the Web API surface natively", that's the strongest single thing that would help steer an agent to correctly write code for the code in question (assuming the Web API surfaces that are key are in distribution). Add something like - "Where there may be reasonable obvious updates that can be used in 2026, use them" ...
datadrivenangel
|next
|previous
[-]
And it feels like claude code has gotten more verbose with the multiline comments lately
lelanthran
|next
|previous
[-]
Is it already too late to have humans just write down what they are thinking instead of passing it through a lossy expander?
allanmacgregor
|root
|parent
[-]
ftaisdeal
|next
|previous
[-]
username135
|next
|previous
[-]
joshka
|root
|parent
[-]
Izkata
|next
|previous
[-]
Edit: Similar with the "UI components" section, the long one is missing the UI while the short one is UI without the trigger to activate it. You'd probably combine the two, using state from the first to control the UI in the second (replacing the contents of the useEffect with the dialog API to get the modal effect).
jimmont
|next
|previous
[-]
defytonofficial
|previous
[-]
One thing I found: asking the model to respond in structured JSON (with a strict schema) vs free-form text cuts token output by ~40% on average. The model stops "explaining itself" and just gives you the answer.
Also noticed that including a reference image in vision calls roughly doubles the input cost but improves accuracy enough that you save on retries. Net cost ended up lower for my use case.
Curious if you've measured the difference between asking for "concise" output vs actually constraining the response format.