15 ms·
An example of LLM prompting for programming
- chewbacha 4y agoI guess this is neat but I’d rather write code myself.
- deleted 4y ago[deleted]
- Sateeshm 4y agoYes. I would rather write the code myself too. But it's a good idea to use it to explore solutions or alternate implementations
- killingtime74 4y agoIt's like talking to a student or an intern. Which is not bad normally because we are also educating them.
- koheripbal 4y agoI'd rather farm all my own food, build my own house, and teach my own kids, but I don't have infinite time each day.
- nsxwolf 4y agoThe prompt was almost as much work as the code, and there was no way to write that prompt without a CS education and/or years of development experience.
- grrdotcloud 4y agoI have found that this applies to many Crafts. Cutting wood is easy. Simple really. Crafting an attractive and functional chair requires discipline. Designing it? Brilliance.
- throwaway290 4y agoIf you are optimizing for an end goal rather than enjoying the process... What is that goal? Why does it matter?
- goatlover 4y agoPresumably you have time to write your own code as a developer, since you're not being paid to be a farmer or carpenter?
- isaacfrond 4y agoThe article stresses to never put anything that may be confidential into the prompt. Yet, chatGpt offers to out-out from using your data for training. For most purposes that seems to be sufficient doesn't it? Or are there reasons not to trust OpenAi on this one?
- themodelplumber 4y ago> Or are there reasons not to trust OpenAi on this one? Yes, more related to general tech history and not a dig on OpenAI though.
- blowski 4y agoFrom a GDPR or commercial confidentiality perspective, it doesn't matter what OpenAI say they'll do with your data, you can't share it with them. Let's say your doctor enters sensitive info about you, and despite having told OpenAI not to train data with it, they use it anyway due to a bug. A year from now, ChatGPT is generating personal information tells everyone and anyone about your sensitive info. Would you exclusively blame ChatGPT?
- dustypotato 4y agoThere was a bug where chat history of some users were visible to others
- twelve40 4y agoCopilot for individuals stores code snippets by default according to their TOS. Sure, you can probably find a way to opt out of that somewhere as well, but you'd have to read the TOS for every plugin and service you use, find the opt-out links and make sure you don't opt-in again via some other route (such as not Copilot but ChatGPT proper or some other Github, VSCode or some other plugin or service button or knob).
- vharuck 4y agoI will never have full trust in an assertion unless (a) it's included in a contract that binds all parties, (b) the same contract includes a penalty for breaking the assertion that's severe enough to discourage it, and (c) I know the financial and other costs of litigation won't be severe for me. In short, unless my large employer will likely win in punishing OpenAI should they break a promise, that promise is just aspirational marketing speak. For data retention and usage, I'd also need a similar contractual agreement to tie the hands of any company that would acquire them in the future.
- themodelplumber 4y agoIf somebody thinks an LLM is coming for everybody's coding job, I'd say this article is a great counterpoint just for existing. You could tell someone from decades ago that we now use a very high level language for complex tasks in complex code ecosystems, never even mention AI, explain that the parser is really generalist-biased, and this article would make perfect sense as an example of exemplary code by a modern coder working for a living. That's code in there, the stuff Xu Hao is writing. And also, that's not even getting into the debugging part... Which will be about other code, that looks different.
- twelve40 4y agoExactly, I actually liked the systematic approach in the article, but it seemed pretty labor-intensive and ... not that much different from other types of programming
- sanderjd 4y agoTo me, that's the whole point of this. I think it is directly analogous to the jump between assembly and higher level compiled languages. You could have said about that, "it still seems pretty labor intensive and not that much different than writing assembly", and that's true, but it was still a big improvement. Similarly, AI-assisted tools haven't solved the "creating software requires work" problem. But I think they're in the process of further shifting the cost curve, making more software possible to make.
- nextworddev 4y agoThe opposite might be true, and here’s why - 1) by using English as spec, the barrier of entry has gone lower, 2) LLMs can also write prompts and self introspect to debug.
- notacoward 4y ago> LLMs can also write prompts and self introspect to debug. Why should we assume that won't lead to a rabbit hole of misunderstanding or outright hallucination? If it doesn't know what "correct" really is, even infinite levels of supervision and reinforcement might still be toward an incorrect goal.
- romland 4y agoI started a bit of an exploration around prompts and code a week or three back. I want to figure out the down/up-sides and create tools for myself around it. So, for this project (a game), I decided "for fun" to try to not write any code myself, and avoid narrow prompts that would just feed me single functions for a very specific purpose. The LLM should be responsible for this, not me! It's pretty painful since I still have to debug and understand the potential garbage I was given and after understanding what is wrong, get rid of it, and change/add to the prompt to get new code. Very often completely new code[1]. Rinse and repeat until I have what I need. The above is a contrived scenario, but it does give some interesting insights. A nice one is that since here is one or more prompts connected to all the code (and its commit), the intention of the code is very well documented in natural language. The commit history creates a rather nice story that I would not normally get in a repository. Another thing is, getting an LLM (ChatGPT mostly) to fix a bug is really hit and miss and mostly miss for me. Say, a buggy piece comes from the LLM and I feel that this could almost be what I need. I feed that back in with a hint or two and it's very rare that it actually fixes something unless I am very very specific (again, needing to read/understand the intention of the solution). In many cases I, again, get completely new code back. This, more than once, forced my hand to "cheat" and do human changes or additions. Due to the nature of the contrived scenario, the code quality is obviously suffering but I am looking forward to making the LLM refactor/clean things up eventually. On occasion ChatGPT tells me it can't help me with my homework. Which is interesting in itself. They are actually trying (but failing) to prevent that. I am really curious how gimped their models will be going forward. I've been programming for quite long. I've come to realize that I don't need to be programming in the traditional sense. What I like is creating. If that means I can massage an LLM to do a bit of grunt work, I'm good with that. That said, it still often feels very much like programming, though. [1] The completely new code issue can likely be alleviated by tweaking transformers settings Edit: For the curious, the repo is here: https://github.com/romland/llemmings https://github.com/romland/llemmings and an example of a commit from the other day: https://github.com/romland/llemmings/commit/466babf420f617dd0db1b2708b85203c83aab417 https://github.com/romland/llemmings/commit/466babf420f617dd... - I will push through and make it a playable game, after that, I'll see.
- ChatGTP 4y ago
- blatant303 4y agoIs there a tool that allows to do this within a text editor (for instance VS Code). Using selection instead of copy pasting. Having the LLM store its output directly within local files. Maybe giving it access to a shell to run the tests on its own ?
- mxuribe 4y agoIf there isn't a tool currently...then give it time, and eventually there will be tools similar to what you dewscribed. I'd guess they'll be called something like prompt editors (like text editors, etc.). ...Or, maybe they'll be called chatditors...no, no, prompt editors is better. ;-)
- xenospn 4y agoCopilot X will include that capability.
- deleted 4y ago[deleted]
- gitgud 4y agoA useful approach, but this is a tiny green field project. I'm not so sure it would work in a large existing proprietary system, where you shouldn't describe too much of the "NDA protected context"...
- themodelplumber 4y agoTo me, this is likely an area where we'll see future coders tested: Interviewer: Here is a very specific project. And this part here is NDA covered. We have provided a context prompt with all the generals. Let's say you are new here and we need you effective today. Show us how you'll cover the last mile with the LLM by writing prompts that do not violate NDA but get the needed work done. Then whiteboard for your team a prompt schema & policy that you think will work for this project. I.e. a creativity exercise at the very least. You want someone who can code _for a prompt, to solve coverage problems_, and this is still coding. For now I think a lot of people will hoard this kind of prompt info/leverage-pattern stuff when they discover it. It's not about the individual prompts.
- mk89 4y agoFor me chatGPT or phind (which is based on chatGPT4, if I understood right) are great documentation tools and also general productivity tools, nothing to say about it. The main issue is that sometimes they really f** it up bad, they make you rethink your knowledge quite deeply (do I remember wrong? did I maybe understand this wrong? is chatGPT wrong?) and this is for me something that can be worse than having to do it myself, because it creates some sort of insecurity, as you always have to challenge your self thinking, and this is not how we work in our daily job, isn't it? At least this doesn't happen so frequently to me - from time to time we have arguments in the team, but this kind of "wrong information" feels more like "hidden" traps than someone else arguing (with valid arguments, of course).
- themodelplumber 4y agoOne thing that really bothers me is that I want it to use best practices and it doesn't really know which ones I'm talking about, and then I realize they are _my_ set of best practices, made from others' nameless best practices. So I have to decide if it's just a matter of manually converting the 5-10 little things like using `env bash` in the header, etc. Or do I ask it to remember that and proceed to the next layer of the project, and feel like Katamari Coder, which is quite a feeling of what-is-this-fresh-encumbrance at times. There is a nascent sense that the interface is not even close to where it needs to be to efficiently support that kind of recall for working memory on the coder's end. I can definitely see a new LLM relativistic-symbolic instruction code & IDE-equivalent (with yet-unseen presentational and let's even say modal editing factors) being extremely useful, which is a bit funny but also that's what those things are good for... Right now I can scroll up through my prompts to supplement my working memory, but that's another place where the whole activity starts to seem very tedious. (Is the LLM coming for the coders, or are coders coming for the LLM?)
- mason55 4y agoI think that Copilot is much better/more promising for this kind of thing because it's looking at the code you've already written without you having to constantly prompt it. I had a lot of the same hangups as you when I had played around with ChatGPT. How do I get it to handle the monotonous stuff without me having to spend all my time teaching it? I finally tried Copilot the other day and it was stunning. I had a half-written golang client that was a wrapper around an undocumented and poorly structured API for a tool we use. I had written the get and create methods. Then I added a comment with an example URL for delete and Copilot auto-completed the entire method in the same style as the two methods I had already written. In some cases, like formatting & error handling, it was exactly the same as what I'd written, but other cases, like variable naming, string templating, etc., it replicated the spirit of my style but adapted for this new "delete" method. I think ChatGPT is just the wrong interface for this kind of thing (at least right now).
- mov_eax_ecx 4y agoHow to overengineer with an LLM, don't state clearly the requirements, shove your pet patterns first, it is more important to follow the slice redux awareness hook than to have working solution, never trust your developers to make decisions, worry more how it is built than building a solution. My way to work with an LLM is to have a good, clear requirement and make the LLM write a possible file organization and query the contents of each file, just the code no comments and assemble a working prototype fast, then you can iterate over the requirements and evolve from there.
- moonchrome 4y agoHow often do you get working code that way ? Unless it's something trivial that fits in it's scope I'd say that's going to produce garbage. I've seen it steer into garbage on longer prompt chains about a single class (of medium complexity) - I doubt it would work project level. Mind sharing the projects ?
- mov_eax_ecx 4y agoI work only with closed source codebases and this approach for prototypes, but, using the same example as the blog i prompt: "the current system is an online whiteboard system. Tech stack: react, use some test framework, use konva for the canvas, propose a file organization, print the file layout tree. (without explanations)." The trick is that for every chat the context is the requirement+the filesystem + the specific file, so you don't have the entire codebase in the context, only the current file, also use gpt4, gpt3 is not good enough. My main point is that the blog post final output is mock test awareness hook redux, where an architect feels good to see his patterns, with my approach you have a prototype online whiteboard system,
- lyjackal 4y agoGenerally, I agree that approach works well. It’s going to perform better if it’s not trying to fulfill your teams existing patterns. On the other hand, allowing lots of inconsistencies in style in your large code base seems like a quick way to create a hot mess. Chat prompts seem like a really difficult way to communicate code style and conventions though. A sibling comment to yours mentions that a copilot autocomplete seems like a much better pattern for working in an existing code base, and I tend to agree that’s much more promising. Read the existing code, and recommend small pieces as you type
- amelius 4y agoWhat I want is a prompt that continuously copies whatever I'm doing, so I can ask to complete the task. For example, say I'm converting all identifiers in a file from lowercase to CamelCase. Then after doing like 3 of them, I can ask the LLM to take over and do the remainder.
- chrisco255 4y agoI mean, that kind of task is more than easy to do today. You could probably just create a VS Code extension that you type "convert all identifiers in this file that match this pattern from lowercase to camel case" and pipe that to the GPT API to instantly do it (without even needing to give it the first 3 examples).
- amelius 4y agoSometimes just doing stuff takes less energy than thinking about how it can be automated.
- clarge1120 4y agoGreat example of how a GPT can reason on your behalf and dramatically improve your performance. For instance, it could watch for inconsistent approaches to design or even continue an complex implementation you’ve started just from examining context signals.
- chrisco255 4y ago> He's using a generic application example in here: one thing to be wary of when interacting with ChatGPT and the like is that we should never put anything that may be confidential into the prompt, as that would be a security risk. Business rules, any code from a real project - all these must not enter the interaction with ChatGPT. Remember, when storing your business code on Github servers hosted by Microsoft, it is important to not place real code from a project into OpenAI servers hosted by Microsoft. That would be a security risk.
- hbn 4y agoThe hosting is not the issue. Github would have different security requirements for code hosted in a private repo for a paying org than OpenAI would for free users sending prompts to an LLM. It can and should be assumed anything you type into ChatGPT is being logged to be potentially read by a human.
- nbzso 4y agoUseful for form of learning and experimentation. Not applicable, in my view, at all due to lack of ownership of the generated code. There is no ability to copyright and protect the intellectual output from generative AI processes. Even when your prompts are clearly the pseudocode which creates the scope of the generated response. Until this situation is legally cleared, I will be very cautious to include LLM's outside rapid prototyping and conceptual phase. Not to mention the madness of AutoGPT or more realistic approach of LangChain. It is early in the game and the Hype train is riding more rapidly than crypto and web3 combined. I see a lot of AI startups introducing the same capabilities through OpenAI API and prompts, without consideration of prompt injection risk. So we will see who will survive.
- cwp 4y agoTo me, this is a great illustration of why chat is a terrible interface for a coding tool. I've gone down this path as well, learning that you need to have a detailed prompt that establishes a lot of context, and iteratively improve it to generate better code. And yup, generating a task list and working from that is definitely a key strategy for getting GPT to do anything bigger than a few paragraphs. But compare that to Copilot: Copilot doesn't help much when you're starting from scratch, and there's nothing for it to work with. But once you have a bit of structure, it starts to make recommendations. Rather than generating large chunks of code, the recommendations are small, chunks of a few lines or maybe even one line at a time. And it's sooooo good at picking up on patterns. As soon as you start something with built-in symmetries, it'll quickly generate all the permutations. It's sort of prompting by pointing. This is so. much. better. than writing prompt for the chat interface. I'm really excited to see where these kinds of tools lead.
- barbariangrunge 4y agoEither way, you’re sending your companys biggest asset to another company, aren’t you? I’ll try these tools when they start being able to run locally
- koonsolo 4y agoI surely hope they use my copyrighted code and make millions out of it. Ideal case for me to sue them for lots of money.
- freedomben 4y agoHow would you ever know? It will come in chunks of a dozen or less lines at a time and it will be written into your competitor's proprietary codebase (that you don't have access to).
- survirtual 4y agoRight. If you are building something truly valuable locally, and it is innovative or otherwise disruptive and relies on being a first mover, centrally hosted LLMs are a non-starter. Most software corps have countless millions of lines of code. You'd be spending lifetimes tracing where someone ripped your "copyrighted" techniques and methods. The complete lack of security awareness and willingness to compromise privacy for convenience in people deeply saddens me.
- deleted 4y ago[deleted]
- moonchrome 4y agoI feel like this is a bunch of ceremony and back and forth, and also considering GPT-4 speed - I feel like I would fly past this approach just using copilot and coding. I look forward to offloading these kinds of tasks to LLMs but I'm not seeing the value right now. Using them feels slow and unsatisfying, need to triple check everything, specify everything relevant for context. Also maybe it's just me but verbalizing requirements unambiguously can often be harder than writing code for it. And it's not fun. If GPT4 was GPT3.5 fast it would probably be a completely different story.
- deleted 4y ago[deleted]
- greenhearth 4y agoIs it me or does this just create a bunch of extra steps and gratuitous complexity? These tools are not so efficient or make anything easier, it seems. I'm sorry to the enthusiasts here - I am usually excited about AI and a student of Computational Linguistics, but I think this emperor is naked.
- wudangmonk 4y agoI have been trying to find a use case for these LLMs and I continue to keep an eye just in case someone figures out a way to use them that I find useful in my workflow. My only use for them so far is as an explorative tool for tasks I'm not familiar such as when having to work with programming languages I never use. For such things its great as not only do I not have to go digging through the documentation, I also do not have to then search the web for examples on how its actually used. This is taking into account that I have removed the cost of using it as much as possible since I do not have to switch to a browser tab, asks my question, wait for reply and then copy any useful text to my editor. I have it setup as a function call inside my repl along with saved history to a local file in case I need it. Even with this convenient way of using it I notice that pretty much the only time I use it when working on my actual projecs is just to save me the trouble of doing a google search for trivial things such as looking up word definitions/synonyms for naming things or for anything else where I would expect to find the answer with just a bit of googling. I can just quickly do my request and continue with whatever I was doing and then return for my answer later.
- dpflan 4y agoThis got me wondering about best techniques for integrating LLM code assistants into day-to-day software development, and hence Ask HN: What is your GitHub Copilot (code LLM assistant) workflow? Please share your experience here: https://news.ycombinator.com/item?id=35613576 https://news.ycombinator.com/item?id=35613576 I'd like to learn what is working and useful.
- irrational 4y agoMaybe this will get people to finally sit down and do some thinking, planning, pseudo-code, etc. before diving in and starting to code.
- paphillips 4y agoOne initial reaction to the prompting style is how similar it is to a human-to-human interaction. For example, a team lead communicating requirements to a wider team composed of less experienced engineers may also follow this type of iterative exchange, continuing until he or she is satisfied that the team understands the work to be done and has the guide rails to be successful. I recently heard a description about the way this technology will change technical work that resonated: we will become more like the movie director, and less like the actors.
- 1024core 4y agoFor some reason, this reminds me of how we used to give instructions to Indian coders in the 90s and early 2000s. You would have to spell out everything. What you got back was nearly there, but some back-and-forth was involved. This brings back some terrible memories.
- mpaepper 4y agoThe big difference is that you get the results immediately and iterations take minutes not days
- krupan 4y agoYes, you can a ton more code that you have to check over with a fine toothed comb in much less time! Is that a win?
- DonHopkins 4y agoAnd no time zone differences!
- yoyohello13 4y agoI feel like from an information theory perspective there is a lower bound on how little we can write to get a sufficiently specific spec for the AI to generate correct code. This example seems like almost as much work as just writing the code myself. I think English is just too fuzzy, maybe eventually we will get a language tailored to AI that will put more specific limits on the meanings of works. But then how is it all that different from Python?
- blackbear_ 4y ago> a lower bound on how little we can write to get a sufficiently specific spec for the AI to generate correct code. Interesting though. I believe a lower bound for the number of bits must be at least the log (in base 2) of the probability of such code to appear "in the wild", and larger if the training set is biased and/or the model not fully trained
- m3kw9 4y agoAsking LLM to write complex code could approach the speed of writing the code yourself. Having it plan it out could however kick start a nice direction. LLMs are great for single clear function code.
- acomjean 4y agoIsn’t the point of code to express what we want in a succinct and expressive way. If we’re needing all this software to help us, maybe we should look at the languages we’re using and make better more intuitive ones.
- zackmorris 4y agoThis is an amazing demonstration, but I'm worried that when this goes mainstream, we'll inherit a ton of baggage from today's programming. Specifically: * The tests are written in BDD style "it('should xyz')", which programmers do in code like this for convenience. But if we're automating their creation, then actual human-readable Cucumber clauses would be more useful. Maybe the tests can be transpiled. This isn't the AI's fault, but more of a symptom of how the original spirit of BDD as a means for nonprogrammers to test business logic seems to have been lost. * React hooks and Redux syntax are somewhat contrived/derivative. The underlying concepts like functional reactive programming and reducers are great, but the syntax is often repetitive or verbose, with a lot of boilerplate to accomplish things that might be one-liners in other languages/frameworks. This is more of a critique of the state of web programming than of the AI's performance. * MVVM is a fine pattern, but at the end of the day, it's an awful lot of handwaving to accomplish limited functionality. What do I mean by that? Mainly that I question whether the frontend needs models, routes, controllers (which I realize are MVC), etc. I mourn that we lost the idempotent #nocode HTML of the 90s and are back to manually writing app interfaces by hand in Javascript (like we did for native desktop apps in the C++ OOP days) when custom elements/components would have been so much easier. HTMX combined with some kind of distributed serverless lambda functions (that are actually as simple as they should be) would reduce pages of code to a WYSIWYG document that nonprogrammers could edit. What I'm really getting at is that I envisioned programming going a different direction back in the late 90s. We got GPUs/TensorFlow and Docker and WebAssembly and Rust etc etc etc. And these things are all fine, but they're contrived/derivative too. More formal systems might look like multicore/multimemory transputers (or Lisp machines), native virtual machines with full sandboxing built in so anything can run anywhere, immutable and auto-parallelized languages like HigherOrderCO/HVM or true vector processing with GNU Octave (MATLAB) so that we don't have to manually manage vertex buffers or free memory, etc. I've had architectures in mind for better hardware and programming languages for about 25 years (that's why I got my computer engineering degree) but I will simply never have time to implement them. All I do is work and cope. I just keep watching as everyone reinvents the same imperative programming wheel over and over again. And honestly it's gone on so long that I almost don't even care anymore. It feels more appealing in middle age to maybe just go be a hermit, get out of tech. I've always known that someday I'd have to choose between programming and my life. Anyway, now that I'm way too old to begin the training, I wonder if AI might help to rapidly prototype truly innovating tools. Maybe more like J.A.R.V.I.S. where it's just on all of the time and can iterate on ideas at a superhuman rate to assist humans in their self-actualization. Then again, once we have that, it becomes trivial to implement the stuff that I rant about. Maybe we only have about 5-10 years until all of the problems are solved. I mean all of them, everywhere, in physics/chemistry/biology/etc. Rather than automating creative acts and play as AI is doing now. If the Singularity arrives in 2030 instead of 2040, that also seems like a strong incentive to go be a hermit. Does any of this resonate with anyone? That somehow everything has gone terribly wrong, but it's more of a hiccup than a crisis? That maybe the most impactful thing that any of us can do is.. wait for things to get better?
- mrbonner 4y agoI can’t help but thinking: this is way more work than just code it myself? Anybody has the same thought?
- all2 4y agoIt depends how you use it. I've been using it to skip boilerplate coding and get straight to the meaty bits. It took me a few days to sketch out an application using ChatGPT to handle the boilerplate, including dependency management (python, poetry, etc.). I've had to handle the specific pieces of implementation myself. Especially unit testing new pieces of code. When asked to generate unit tests, it does ok, but it doesn't get the spirit of the code (my intended purpose) and so I'm left filling in a bunch of blanks.
- Vinnl 4y ago> It depends how you use it. How about specifically how they use it in this article? It doesn't seem faster than writing it themselves?
- gdubs 4y agoThere's an unfortunately common take on AI that goes basically like this: "I tried it and it didn't do what I wanted, not impressed." My suggestion is to tune out the noise and really try experimenting with these tools – and know that they're rapidly improving. Even if ultimately you have criticisms or decide one way or another, at least really investigate them for your own use-cases rather than jumping on a bandwagon that's either "AI is bad" or the breathless hype-machine at the other end.
- rootusrootus 4y agoI agree it's a good idea to take a moderate approach. The hype that LLMs are going to replace SWEs is clearly just that, hype, if you've done any real work trying to get GPT4 to give you the code you want. But it's also clearly a very useful tool. I think it'll absolutely destroy Stack Overflow.
- lcnPylGDnU4H9OF 4y ago> destroy Stack Overflow It'll be interesting to see how future training data is sourced.
- rootusrootus 4y agoGithub would be my first guess.
- lcnPylGDnU4H9OF 4y agoThat does seem like a likely option. Discussions on issues alongside the actual working (and not working) code.
- deleted 4y ago[deleted]
- svachalek 4y agoYou simply need the system to train itself on its own interactions, like how search engines improve results by counting clicks.
- choeger 4y agoThat's refinement-style programming from a novel angel, but still clearly refinement-style.
- deleted 4y ago[deleted]
- nice_byte 4y agodo people enjoy working this way? wasting time verbalizing your thoughts, stating the obvious, wordsmithing to get the thing to "understand" what you _actually_ want?
- all2 4y agoSometimes I don't know what I want, or I don't know if the way I want to do it is possible. For these paths, using ChatGPT is very useful. So far my use cases are 'taking care of boilerplate' and 'finding ways to do things'.
- afro88 4y agoThe article shows everything that works for this approach. But it's a bit disingenuous. At the end: > Once this is working, Xu Hao can repeat the process for the rest of the tasks in the master plan. No, he can't. After that much back and forth and getting it to fix little things where it gives responses with the full code listing again, he would have easily hit the token limit (at least with any chat LLM capable of this quality code and conversation - ChatGPT). The LLM will start hallucinating the task list, the names of functions it wrote earlier etc. and the responses would get less and less useful with more and more "this doesn't work, can you fix X". So anyone following this approach will hit a footgun after task 1. For anyone that really wants to follow this approach, the next step is to start a new chat and copy/paste the inital requirement prompt, put the task list in there, any relevant code, adjust the instruction (ie "help me with task 2") and go from there. It is of limited utility though. By step 3 (or even 2) you end up with so much code that you're at the token limit anyway and it can't write code that fits together. Where I've found ChatGPT 4 useful is getting me going on something, providing boilerplate, and unblocking me. If you don't know how to approach a problem like the "awareness layer" (like I didn't before reading the post), you can get a great breakdown and starting point from ChatGPT. Similarly, if you're not sure how to approach that view model, or write tests etc. And if you want a first draft of code or tests. All that said, I'm looking forward to much larger and affordable token limits in future.
- Tostino 4y agoYou iterate on your plan after it is generated step by step. You go and edit the prompt chain you started working on step 1 on, and modify it to start working on step 2 (including any ideas or fixes you have identified while implementing step 1. Repeat until complete. You can still absolutely hit the context limit, but you are far less likely to do so if you go back and start a new prompt chain for each different thought process you are going through with it.
- afro88 4y agoGreat idea. But does it get hard to navigate back to something in older chat histories though? I find a new separate chat with the revised initial prompt to be easier.
- pcthrowaway 4y agoI've tried using ChatGPT for writing Vitest tests, and it can't do it, full stop. If you look at the end, it parroted out some tests for jest. True, the APIs are mostly compatible and you can probably change that to Vitest with a couple of lines of code changed, but for more advanced tests, that won't necessarily work. Really disappointed to see this so highly upvoted, when it's pure garbage
- joshribakoff 4y agoThat library doesn’t even appear to have a stable release yet, and was at v0.0.x as of a year or so ago… you also may be using chatGPT 3.5 which may predate this library. As a dev with 15 years of experience I haven’t even switched over from jest (but plan to)… all this to say, maybe we can give the bot some slack here. It should be possible to include vitest docs and examples in your prompts to teach it in context, did you try that?
- pcthrowaway 4y agoSure, I realize it's unsuccessful at using vitest because it's (relatively) new. I'm just saying, this was a really telling example of how to use it for prompting. A very large chunk of the tools I use in Javascript-land are "too new" for ChatGPT to work with properly. Giving context unfortunately doesn't really work as ChatGPT usually prioritizes what it's absorbed through the corpus over anything you tell it. To be clear, it does fine with new information if the things you ask it for don't match token sequences it's already been trained on, so if you give it a fictional library and ask it to perform some task with it, that doesn't seem too much like the things it might do with another library that accomplishes a similar thing with a similar API, it will actually use the custom code more successfully. But for Vitest, it can't accept enough of the docs you might provide for it to be useful to you (though admittedly, sometimes it will show how to do something with jest that at least makes finding the right thing in vitest easier). By the way, if you are planning to switch over in the future, the path for doing that is seemingly well documented by vitest and seems to be pretty straightforward as well, though I haven't meaningfully used Jest for comparison edit: to be clear, I'm very impressed with ChatGPT's capabilities, and I think there are good examples of prompting where it does meaningful work in tandem with the human driver exercising their own judgment. This was an example of a person asking it for things while not pointing out its limitations, which downplays the extent to which one needs to exercise one's judgment when using it. If they failed to point out the things ChatGPT got wrong which I know about, why would I trust that the other things I don't know it got wrong are accurate.
- captures432 4y ago[dead]
- upwardbound 4y agoPublic service announcement that myself and others are actively trying to poison the training data used for code generation systems. https://codegencodepoisoningcontest.cargo.site/ https://codegencodepoisoningcontest.cargo.site/ See previous discussion here: https://news.ycombinator.com/item?id=35545442 https://news.ycombinator.com/item?id=35545442
- hinkley 4y agoWhat I would really love is if we had a broader linting tool built on this sort of tech that could go the other way. So often we are halfway through refactoring the code from a bad pattern that has a proven track record of issues, to one that at least prevents the worst ravages of the old one. There are never any guarantees that you will get everyone on board for this. Someone will defect, and they will keep copying and pasting the old pattern and if they code faster than you then you never get to the end. Give me a way to mark a bunch of code as 'the old way' and hook that information into autocomplete or even just a linter that runs at code review time.
- TrapLord_Rhodo 4y agoA bit off topic but this article made think of a wierd future. LLM's writing ad-hoc code, handling message passing, and a self contained llm functions in software systems. Ushering in a whole era of non-deterministic computing. I thought our infrastructure was shaky now...
- LunicLynx 4y agoThe time spent on the prompt and the really not sophisticated outcome don’t balance each other out, in my opinion.
- agge 4y agoIf an AI could write your tests, doesn’t that suggest the test are just checking implementation details? Unless you describe your business rules in detail.. as a test for example! How could the AI then write those rules as tests. Perhaps you could automate the boring parts I guess. But maybe that suggests we are working with a poor abstraction that doesn’t allow us to be as terse and precise as we want to be?
- Vinnl 4y agoI haven't used ChatGPT myself, so it's hard for me to deduce from the article by itself, but what is the advantage supposed to be here? At first sight it doesn't appear to be faster or require less knowledge than writing it yourself does - is that wrong, or is there another advantage that I'm missing?
- AltruisticGapHN 4y agoThis is interesting. As a developer I haven't thought about using GPT to give me a task list instead of code right away. Right now it seems like hit and miss still. The examples can be impressive but also have to be very generic - since GPT doesn´t have access to your codebase. The real game changer will be a few years from now when something like GPT is an addon in VSCode... and it will know about your entire codebase. In fact a wrapper around GPT would tell GPT about all the packages you use, the language, framework etc so much of the prep work this article documents, would be done in the background. Then you could straight up ask the bot to give suggestions to refactor your code, wide sweeping changes. Or ask it to uprgade eg. your Symfony php app from version X to version Y including major upgrade changes... and even if it gets only 90% of the way, you can review everything in git. LLMs will never be embodied but we are so it's like teaching a robot and having it do a lot of grunt work for us. If only we didn't have to listen to all the hubris in Big Tech right now about the metaverse and robots taking over humanity /smh
- newshorts 4y agoIf you look at what the prompter had to know in order to get a useful output you can see how far away we are from replacing that individual with a business stakeholder. That’s why I view these tools as “productivity enhancements” rather than a straight replacement of a job. In some cases maybe, but not for coders just yet… I think the most underrated and useful parts of this process is the ability to get going. For me the starting energy of a project is the thing that blocks me. With chatgpt, it’s a simple prompt to get the conversation going. Once in motion I can put the puzzle pieces together while chatgpt can help me keep momentum
- holoduke 4y agoLast month I had the task to write lots of different regexes to extract pieces of information. Tried Chatgpt for many of them. But I found the results really weak. Somehow it's not able to even generate a simple regex. Always something wrong.
- sporn656 4y ago[dead]
- wolfcub7865 4y ago[dead]
- poemsporn75 4y ago[dead]
- mystique5784 4y ago[dead]
- justonemore65 4y ago[dead]
- able7574 4y ago[dead]
- creature63 4y ago[dead]
- spicysugar54 4y ago[dead]
- gypsysoul65 4y ago[dead]
- lustforlife451 4y ago[dead]
- wine5433 4y ago[dead]
- whatsthetea54 4y ago[dead]
- justdogs573 4y ago[dead]
- ssense74 4y ago[dead]
- gyourstory35 4y ago[dead]
- angelhearts45 4y ago[dead]
- smashfizzle754 4y ago[dead]
- thelight453 4y ago[dead]
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- curioussoul46 4y ago[dead]