4 ms·
Next step is to train models directly on syntax trees. Higher probability of correct output.
by intalentive 3y ago
Next step is to train models directly on syntax trees. Higher probability of correct output.
- kevinlu1248 3y agoThat's interesting, I've seen a few papers about this. I'm personally curious about editing syntax trees using language models, since it would prevent syntax errors altogether.
- vladf 3y agoWhich papers?
- kevinlu1248 3y agoHere's some of the papers: https://arxiv.org/abs/1911.09983 https://arxiv.org/abs/1911.09983 and https://aclanthology.org/2021.findings-acl.384.pdf https://aclanthology.org/2021.findings-acl.384.pdf
- madeofpalk 3y agoIn my limited use, I've never seen these models (chatgpt, and github copilot) generate invalid syntax. I don't see much to improve there I do see them generate code that fails the type checker though.
- kevinlu1248 3y agoFor editing code there's a decent chance of syntax errors or undefined variables since it's only modifying a subset of the code.
- Zambyte 3y agoJohn McCarthy was right
- kevinlu1248 3y agoThis is interesting. I'm taking a read on this.
- eldenring 3y agoI'd guess these model's understand works more closely to people so encoding in text is more token efficient and things like comments help. Also syntax seems a lot easier to understand for them than semantics/logic. If you've used GPT-4 it almost never makes syntax errors. Logical errors on the other hand...
- kevinlu1248 3y agoFrom my experience, GPT-4 never makes syntax errors directly but when making edits to existing code it's harder to prevent these syntax errors from appearing. We used to add a second pass to check for these syntax errors. It also frequently makes undefined variables and the like, however.
- reitzensteinm 3y agoDid you get rid of the second pass? I'm working on something quite similar and find a pass that inspects and rejects erroneous code to be a big boost to correctness.
- kevinlu1248 3y agoWe got rid of it. Our new edit framework works around search-and-replace pairs with an example at https://github.com/sweepai/sweep/blob/d37dda3a626f09dea3b3221dd0254671407ccc1b/sweepai/core/prompts.py#L325-L329 https://github.com/sweepai/sweep/blob/d37dda3a626f09dea3b322...
- _boffin_ 3y agoI’ve built out an end to end automated fix pipeline, it’s getting the bug fixes right, but been having trouble with line number errors. Looking forward to reading through your docs and repo later tonight to see how you’re addressing issues like this.
- kevinlu1248 3y ago
- karmasimida 3y agoProgramming languages are artificial languages. LLM are able to synthesize human languages with almost perfect grammatical quality, they are in fact, very unlikely to make obvious syntactic errors on programming languages. Also, syntax level information are local or short sighted, it is called context-free grammar for a reason. My own observation with playing with those coding LLMs all day, is that they most likely had acquired the grammar themselves implicitly. Providing explicit regularization by enforcing grammar, is going to provide at best modest benefits, and that is dependent on good that parser is written, in many cases, it is not a given.
- kevinlu1248 3y agoYa I think forcing correct syntax at the generation level likely will not be extremely beneficial. At Sweep, we iterate the language models on linters and type-checkers using GitHub Actions and it yields better results.
- woadwarrior01 3y agoIndeed, it's intuitively more efficient for LLMs to operate on ASTs instead of raw source code. I came across a recent paper[1] that takes this approach. [1]: https://arxiv.org/abs/2305.00909 https://arxiv.org/abs/2305.00909
- kevinlu1248 3y agoThis is interesting, I'll take a look. My main concern with running this in production is that there is more text data in the world than code. Further, a pure tree-manipulation model has less explainabilities since you can always ask GPT-4 what it's thinking.
- woadwarrior01 3y agoIIUC, doc-strings and comments in code will still be processed as text.
- awwaiid 3y agoAlso git diffs and execution traces.