News for hackers. Stuff that matters.
Re:Native JSON Output from GPT-4 by irthomasthomas on Wednesday June 14, 2023 @04:43PM (#36332348)
It's a shame they couldn't use yaml, instead. I compared them and yaml uses about 20% fewer tokens. However, I can understand accuracy, derived from frequency, being more important than token budget.
Re:Native JSON Output from GPT-4 by AdrienBrault on Wednesday June 14, 2023 @04:54PM (#36332486)
I think YAML actually uses more tokens than JSON without indents, especially with deep data. For example "," being a single token makes JSON quite compact.

You can compare JSON and YAML on https://platform.openai.com/tokenizer

Re:Native JSON Output from GPT-4 by nasir on Wednesday June 14, 2023 @05:07PM (#36332672)
Its a lot more straightforward to use JSON programmatically than YAML.
Re:Native JSON Output from GPT-4 by TeMPOraL on Wednesday June 14, 2023 @06:03PM (#36333404)
It really shouldn't be, though. I.e. not unless you're parsing or emitting it ad-hoc, for example by assuming that an expression like:

  "{" + $someKey + ":" + $someValue + "}"
produces a valid JSON. It does - sometimes - and then it's indeed easier to work with. It'll also blow up in your face. Using JSON the right way - via a proper parser and serializer - should be identical to using YAML or any other equivalent format.
Re:Native JSON Output from GPT-4 by riwsky on Wednesday June 14, 2023 @09:31PM (#36335298)
Even if the APIs for both were equally simple, modules for manipulating json are way more likely to be available in the stdlib of whatever language you’re using.
Re:Native JSON Output from GPT-4 by golergka on Thursday June 15, 2023 @08:15AM (#36339369)
If you are using any kind of type checking instead of blindly trusting generated json it's exactly the same amount of work.
Re:Native JSON Output from GPT-4 by IshKebab on Wednesday June 14, 2023 @04:46PM (#36332397)
I would imagine JSON is easier for a LLM to understand (and for humans!) because it doesn't rely on indentation and confusing syntax for lists, strings etc.
Re:Native JSON Output from GPT-4 by blamy on Wednesday June 14, 2023 @09:23PM (#36335248)
JSON can be minified.