6 ms·
Trying to Understand Copilot's Type Spaghetti
- janikvonrotz 3y agoSo unraveling AI generated code is the new programming?
- spacecadet 3y agoWhat is typing. Lets say you have no hands, no eyes, and cannot speak or to speed this up- All you can do is communicate with foot taps (in great detail) to a human translator. Would we tell this person they are not programming?
- janikvonrotz 3y agoWhat is your point?
- boesboes 3y agoThey should have used copilot to write the comment, might hav been coherent them /s
- spacecadet 3y agoHere you go: Typing, in the broad sense, refers to the action of inputting information into a device, whether it's done via a keyboard, voice, or any other method. When you describe a scenario in which a person can only communicate through foot taps to a human translator, this still qualifies as a form of inputting information. The method of communication might be unconventional and require translation into a form understandable by a computer, but it remains a way of interacting with a device or system. In the context of programming, what fundamentally matters is the ability to formulate logical instructions that a computer can execute. If a person can convey these instructions through foot taps, and these are then translated accurately into a programming language by a human or machine, this person is indeed programming. Programming is defined by the cognitive process of solving problems and giving instructions, not necessarily by the physical act of typing these instructions in a conventional manner. Therefore, we would not tell this person that they are not programming; rather, they are programming using an alternative method of communication. This highlights the inclusive and adaptable nature of technology and programming, which can accommodate various methods of interaction to include individuals with different abilities.
- deleted 3y ago[deleted]
- kevindamm 3y agoDepends -- are the foot taps communicating a program or was the message for human consumption? If self-modifying code executes in the forest but nobody is there to observe it, does it have an author?
- spacecadet 3y agoProgramming. All Im trying to illustrate is that, it's not the typing that makes the sausage, it's the ideas. Who cares how the code gets created, if the people involved care, they can provide input and assistance to make the final outcome exactly what they want.
- PaulHoule 3y agoIf you are the #2 or later programmer on a project, unraveling human generated code is the old programming.
- jerf 3y agoA big enough quantitative change is a qualitative change. There is a big difference between a bad programmer who banged on that code for three days before finally getting it to do what they wanted it to do, and never went back to try to minimize it and clean it up, and that same programmer pushing a prompt into X-GPT and getting that code in five minutes, then moving on to do it again and again and again dozens of times faster than before. Like everyone else here of any experience I too have waded through gooey code that was impossible to discern any purpose or design in, because there really wasn't any, after everyone was done hacking on it. But the hacking was still bounded by human speeds. Our only two options for a code base produced that way would be 1. discard it and start over or 2. hope that the next-generation AIs that aren't just LLMs are able to clean it up, since "automatically cleaning up LLM-generated code bases" is going to be a rather lucrative field. LLMs, no matter how much you hypetrophy them, aren't suitable for coding at scale, and they can't be. Their architecture is just wrong. But that's a claim I only make about LLMs, not AI in general.
- blueappconfig 3y agofrom the original tweet linked in the post "ceiling is being raised. cursor's copilot helped us write "superhuman code" for a critical feature. We can read this code, but VERY few engineers out there could write it from scratch." I don't really agree that code is superhuman if VERY few is able to understand it haha..! Code should complex but easy to follow to make it brilliant in my opinion
- janikvonrotz 3y agoI agree! This is not superhuman code, this is machine code.
- zarzavat 3y agoEven an average programmer can understand it if they bothered to read the TypeScript documentation. “Superhuman” in this case means “has read the manual”.
- blueappconfig 3y agoNo average person would be happy if they saw that mess
- frou_dh 3y agoThat's also how you become an extreme outlier at Bash. Actually read the manual.
- abathur 3y agoMy favorite kind of manual to actually read is sprinkled with hijinks-enabling arcana, and the Bash manual doesn't disappoint on this front.
- throwaway11460 3y agoI read hundreds of the funny chat logs!
- nertirs 3y agoSeems like the tweet is another AI hype pr piece. Since Devin was making outlandish statements, CoPilot can't fall far behind.
- tossandthrow 3y agoThe future is going to be a horrible place for people taking over legacy code-bases. It was difficult enough with other people spaghetti code, but being able to generate vast amounts of hard to decipher spaghetti code it only going to make this horrible, Sometimes you digress to simpler types not because you couldn't write more complex types, but because you realise that the next person who needs to make changes to this piece of code is going to have a bad time.
- Sebb767 3y ago> It was difficult enough with other people spaghetti code, but being able to generate vast amounts of hard to decipher spaghetti code it only going to make this horrible I've seen some legacy code and the kind of spaghetti humans are able to generate - especially with multiple layers of "I'll just throw in something to make feature X work/fix that bug" - is pretty bad already. I honestly doubt code generation will make things much worse.
- sureglymop 3y agoI do think that people may let code be generated without really thoroughly checking every part of it and I see that as a problem. That, in my opinion is a new "untrusted input" attack vector and it will abused (probably even more easily than how the recent xz backdoor happened), by either targeting the training data, using prompt injection or in other ways. The scary part about it is that any contributer/commuter themselves is considered a "somewhat" trusted entry but if it is assumed that everyone uses code generation AI that entity cannot be trusted anymore. At the same time, since all the AI generated code has to be thoroughly checked/reviewed, the assumed productivity gains are somewhat diminished. I think how it will actually play out though is that security concerns will just be largely ignored as it often goes.
- Octoth0rpe 3y agoI think the difference is that such incidents were previously the exception in a codebase, in the future they will be the rule.
- gryn 3y ago
- Dripper535 3y ago[flagged]
- nevodavid 3y agoHaha, it's my friend's tweet, Atai, from https://CopilotKit.ai https://CopilotKit.ai he became a meme.
- swiftlyTyped 3y agoHi, CopiotKit CEO here (I wrote the original viral tweet). This article is great! Thanks for posting. I'd also written an analysis of the code - including announcing a $1000 prize for the best alternative code: https://ai88.substack.com/p/ceiling-has-been-raised-analyzing https://ai88.substack.com/p/ceiling-has-been-raised-analyzin... We were going to announce the winner this week but if we get a few more submissions we will definitely consider them. Just submit a PR to https://github.com/CopilotKit/CopilotKit https://github.com/CopilotKit/CopilotKit
- swiftlyTyped 3y agoBy the way - we practice what we preach- Copilots raise the bar (or the ceiling...) on human productivity - in every domain. Which is why we're building infrastructure to make building copilots easier... What ideas do you think are still missing from today's Copilots? I.e. suppose we were looking back at today's Copilots 5 years from now- besides better models, what else has changed?
- deleted 3y ago[deleted]
- tgv 3y agoThat's free training/fine-tuning material, right?
- simonw 3y agoCould you help me understand which Copilots are involved in this? Your tweet at https://twitter.com/ataiiam/status/1765089261374914957 https://twitter.com/ataiiam/status/1765089261374914957 mentions "Cursor's copilot". The blog post at https://rtpg.co/2024/03/07/parsing-copilots-type-spaghetti/ https://rtpg.co/2024/03/07/parsing-copilots-type-spaghetti/ talks about GitHub Copilot - did they make a mistake there? And your product is CopilotKit - is that related to the GitHub and Cursor Copilots in some way or is it something different?
- swiftlyTyped 3y agoHah, too many copilots… let me try to clarify: We are building CopilotKit = a framework + platform for building context-aware AI assistants into any application (not necessarily coding related applications). Part of CopilotKit is about giving the Copilot / AI agents access to the application through a typed "inline realtime API". And to make ergonomics great for _our_ users, CopilotKit ships with hardcore type programming. Cursor's Copilot (unrelated to CopilotKit) helped us write this type code (that's what went viral). And yes, GitHub Copilot is a mis-attribution.
- websitescenes 3y agoChatGPT gives me garbage code unless I ask it politely not to. No joke. Usually the first attempt is pure garbage and I have to call it out as such and then it’s like, “you’re right! Here’s the updated code”. No idea why it can basically never get it right the first time. I also find that it can be quite redundant and offer two distinct solutions morphed into one mutant answer which will turn the undiscerning 1x developer into a -10x developer. But hey, it still saves me time. Sometimes..
- ijustlovemath 3y agoAre you using 4? I've had great luck with 4-Turbo and Opus
- bryanrasmussen 3y agomaybe ChatGPT crawls stackoverflow, stackoverflow #1 answer old or just garbage, second answer better but not the upvoted, ChatGPT gives you #1 basically (with some small tweaks but still it is garbage) you tell it that's garbage it sees in comments "why is this upvoted answer, answer two is clearly better" it returns answer two with a few tweaks.
- gregmac 3y agoThe first thing I see when I look at this is "Where are the unit tests?" This is somewhere in the realm of "clever" or "efficient" code: it looks like it could be written in an easier-to-grok way as dozens of lines of if statements, but I assume there is a reason it wasn't (that is better than "just because"). AI-generated or not, someone or team is responsible for making sure the code/app/service is working for customers, and they have to be able to fix bugs, maintain and modify this. Does it work today? As a reviewer (or coming across this while fixing a bug), I only know by either trying it, or spending quite a long time to understand and analyze it in my head. Unit tests are the easiest way of "trying it", with all the edge cases and then some. What if I'm faced with modifying this in 6 or 12 months? Even if I wrote it, chances are my internal mental model is gone. I'd like some reasonable assurance I am not breaking anything. Also, I'd like to not be the only one responsible for this forever, so I want to let other people modify it. Unit tests are the guard rails that let me say "Go ahead and do whatever you'd like, but don't break the tests".
- rtpg 3y agoYou can scaffold up "unit tests", but honestly for type-level stuff you are working in a different space entirely. Your types are correctness proofs, so your underlying code is either typed correctly or not. There's not really a middle ground that unit tests catch. Having said that, typescript's soundness issues make it easy to drive a truck through a certain kind of issue, but generally speaking if your type-level programming is no good you're not really going to be able to run unit tests, let alone validate them. Your code just won't go anywhere.
- codelikeawolf 3y agoI've been noticing a steady uptick in increasingly complex types like this making it into libraries/@types packages in the definitely-typed repo, and I'm concerned. There are potentially severe performance implications for being too clever, especially since the TS compiler is written in TS. For example, recursive types can seriously bog down the compiler/checker. It doesn't take long to start hitting diminishing returns, especially in larger codebases. You either get perfect type checking while the TS language server uses 800% of your CPU, or you bite the bullet and supplement the lack of typing with unit tests. I think rewriting TS in a more performant language like Zig or Rust would alleviate this to some extent, but TS will still give you more than enough rope to hang yourself with.
- pquki4 3y agoWhen I read the first sentence > The other day this snippet of Typescript generated by Github copilot was floating around I was wondering, did that happen on Twitter/X? And I was not disappointed. That is the place where these people discuss things and take it for granted. Apparently, if you are not using Twitter, you are not part of the conversation.
- mumblemumble 3y agoSo, that code gets me thinking about premature optimization. In the "verschlimmbessern born of optimizing the wrong thing because you didn't use measurement to guide your efforts" sense. The rule of thumb I hear is that, in a mature product, reading and maintaining code takes about 10 times as much effort as writing it in the first place. I've never tried to measure this myself, but it doesn't seem to be wildly off from what I see at work, so let's go with it. Let's also assume, for the sake of argument, that these AI tools double the productivity of people writing new code. Or, equivalently, they halve the time it takes to write it. (This is a lot more than what I see people typically claim, but I'm trying to steelman and also it makes the math easier.) Anyway, this would imply that, speaking purely in terms of raw productivity (not, say, security or correctness) the AI coding assistant is a net win when the code that's written using it is less than 5% more difficult to maintain. And I'm inclined to think that, if Copilot & friends are enabling more people to write more code that looks like what we see in this article (also not wildly off from what I see at work), then it's hard to see how they could possibly be making codebases where they are used less than 5% more expensive to maintain.
- david-gpu 3y agoCan you elaborate on this part? I am trying to understand. > in a mature product, reading and maintaining code takes about 10 times as much effort as writing it in the first place Wouldn't that imply that rewriting a mature codebase from scratch would take ten times less effort than reading and maintaining it? I only saw two instances where (different) management approved a complete rewrite of a working product and in both cases it turned out to be a disaster, because it is easy to severely underestimate how much effort it will take to match the features, quality and performance of the old codebase. I suspect it is almost universally better to refactor the old codebase incrementally. Based on that, I take that you mean something else and I didn't get your point.
- dartos 3y agoOP said “writing it in the first place” not “rewriting” But I agree that their numbers don’t really make sense. Software dev is hard to quantify like that.
- keybored 3y agoWe’re really doing LLM hermeneutics now.
- Emanation 3y agoWhy's these seen as being difficilt to write? It's a giant switch statement that recurses. This is less indicative of AI coming a long way and more of programmers never working on a program that stores types as data, this being the most common and rote pattern that exists.