637 points · by recvonline · 2y ago · 465 comments
I was blown away when I realized some Haskell functions have only one possible definition, for example. I think most people haven't worked with type systems like this, and there are type systems far more powerful than Haskell's, such as dependant types.
There's not much reason to worry about low level quality standards so long as you know it's correct from a high level. I don't think we've seen what a deep integration between a LLM and a programming language can do, where the type system helps validate the LLM output, and the LLM has a type checker integrated into its training process.
Is this a brother or a cousin of the "sufficiently advanced compiler"? :-)
it merely remains to build a debugger for your Turing-complete type system, and the toolchain will be ready for production
I believe the claim was that a sufficiently advanced compiler could do a lot of optimization and greatly improve performance. Maybe my claim here will turn out the same.
Even if you could, you probably wouldn't want to make any change a breaking change by exposing implementation details.
* build a codegen for Idris2 and a rust RT (a parallel stack "typed" VM)
* a full application in Elm, while asking it to borrow from DT to have it "correct-by-construction", use zippers for some data structures… etc. And it worked!
* Whilst at it, I built Elm but in Idris2, while improving on the rendering part (this is WIP)
* data collators and iterators to handle some ML trainings with pausing features so that I can just Ctrl-C and continue if needed/possible/makes sense.
* etc.
At the end I had to rewrite completely some parts, but I would say 90% of the boring work was correctly done and I only had to focus on the interesting bits.
However it didn’t deliver the kind of thorough prep work a painter would do before painting a house when asked for. It simply did exactly what I asked, meaning, it did the paint and no more.
(Using 4o and o1-preview)
I know it's not what you meant, but tbh I don't think going deeper than Haskell on type-system power is the route to achieve mass adoption.
A formal proof is simply a type that allows only the correct implementation at the term level. And specifying this takes ages, as in hundreds of times longer than just writing it out. So you want to use an LLM to save this 1% of time after you've done all the hard work of specifying what the only correct implementation is?
Even with, the aforementioned "have an LSP agent work through type errors", it may be faster to just do it yourself than wait for an LLM to spit out what may be correct.
It’s an approach similar to how I’ve dealt with junior devs in the past. You specify an interface for a class, provide examples as a spec, and you get what you want without colliding with the main project.
For sanity’s sake, I keep these AI generated modules in single files just so it’s an easy copy and paste into ChatGPT.
Your experience with and approach to juniors is different than my own. I don’t ask juniors to write a single class file; I give them a design document, an API spec, and documentation for standard practices, then I work as closely with them as needed to get the results I need and the experience they need. This approach works well for me and the vast majority of juniors with whom I’ve worked because we can pretty quickly identify gaps in their knowledge so we can then provide experience and education that benefits both parties. The same approach has failed miserably for me when pairing with an LLM for anything other than trivial code-generation tasks. The models don’t learn (sure, some providers offer “memory” but the limits of those features are pretty obvious once you try to use ‘em in practice for anything other than “don’t forget that I like tacos, the color blue, and sci-fi”)
> For sanity’s sake, I keep these AI generated modules in single files just so it’s an easy copy and paste into ChatGPT.
That’s not acceptable for production-quality code—at least not in my environment.
I know the organizational style doesn't fit a typical "production" set up, but the reality is the code produced is very good. I only set it up this way so I guarantee I can continue iterating on a module without too much pain.
Also, who cares if I have a way more files if I'm still building features for my customers?
It works good until it doesn't.
It's definitely a useful tool and I'll continue to learn to use it. However it is absolutely stupid at times. I feel there's very high bar to use it, much higher than traditional IDEs.
Since it’s git based, it makes it very easy to keep track of the LLMs output. The agents is really well done too. I like to skip auto commit so I can “git reset —hard HEAD^1” if needed but aider has built in “undo” command too.
Out of curiosity what does your IDE do when you do a global symbol rename in a repository with fifty million files?
I'm absolutely a real human, and I think this just might be too much context for me! Perhaps I am not general enough.
These tools aren’t magic. But they do certain tasks remarkably well.
Based on my personal experience it works well as long as each file is not too long.
The easier way to integrate into an existing code base is just to refactor the code yourself. AI gives a working version, you refactor and move on. For me this has been a huge productivity boost from writing everything from scratch
Tell claude or your favorite LLM to write a full plan to implement what you need in such a way that your coworker can implement it.
Copy the result into aider, and check the results!
Using GitHub copilot, I just tell it to style its code like an example and it gets pretty close.
"It's even crazier to me that we've just... Accepted it, and are in the process of taking it for granted. This type of technology was a moonshot 2 years ago, and many experts didn't expect it in the lifetimes of ANYONE here - and who knew the answer was increasing transformers and iterating attention?
And golly, there are a LOT of nay-sayers of the industry. I've even heard some folks on podcasts and forums saying this will be as short-lived and as meaningless as NFTs. NFTs couldn't re-write my entire Python codebase into Go, NFTs weren't ever close to passing the bar or MCAT. This stuff is crazy!"
Neither can LLMs. They can produce output that looks like a plausible re-write of your codebase, but on closer inspection turns out to have many minor and major errors everywhere.
The problem is that the closer inspection part is very often more work than writing the code by hand in the first place.
There hasn't been enough evidence for me that this will be possible to fix.
We follow a YAGNI approach to our code architecture and abstractions, meaning it’s very straight forward with things happening where they are written and not in 9 million places like Clean Code lovers try to do. Our C services and Libraries are also fairly small and “one purpose”. I’m not sure you would be wrong on larger code bases, at least not right now.
With what we see Claude do now though, I don’t think we’re far from a world where Software Developers are going to do significantly different work. I also think quite a lot of the stuff we do today will no longer exist.
Yes, mistakes may happen. However, I’ve used it to translate a fairly complex MIP definition export into a complete CP-SAT implementation.
I use these models all the time for complex tasks.
One major thing that is perhaps not immediately obvious is that the models are only good at translation. If I give it a really good explanation of what I want in code or even English, and ask it to do it another way or implement it with specific tools, I get pretty good output.
Using these to actually solve problems is not possible. Give it a complex problem description with no instructions on how to solve it, and they fail immediately.
What matters is it meets functional and non functional requirements.
One of my juniors wrote his first app two years ago fully with chatgpt, could figure out by iteratively asking it how to improve it and solve the bugs.
Then he learned to code properly fascinated by the experience. But the fact remains, he shipped an application that did something for someone while many never did even though they had a degree and a black belt in pointless leet code quizzes.
I'm fully convinced that very soon big tech or a startup will come up with a programming language meant to sit at the intersection between humans and LLMs, and it will be quickly better, faster and cheaper at 90% of the mundane programming tasks than your 200k/year dev writing forms, tables and apis in SF.
Since mid 2023, I've yet to have an issue
> It it cant write good code consistently,
You moved the goal post within this post.
const jsonObj = jsyaml.load(yamlText);
const jsonText = JSON.stringify(jsonObj, null, 2);
Don't get me wrong, if you want to convert YAML to JSON then using a battle tested library is the way to do it, but Claude doesn't deserve a round of applause for stating the blaringly obvious.It starts with the first world and is very perceivable.
How did we perceive cars replacing horses? Well for one they were replaced in the first world... now imagine how fast a piece of software can change reality.
It's not there yet, and you can't perceive it because so.
Our jobs aren't replaced yet because they can't be.
That's a feature, not a bug. Complexity is something to avoid.
Complexity is inherent in many problem spaces.
Being able to tackle complex tasks is still a real challenge for the current models and approaches and not all problems can be solved with elegant solutions.
There is an awesome power and innovation to the entire of edifice of targeted advertising. The first time, perhaps, we were all "suggested" something that was in fact quite relevant, was in its own way a giddy-inspiring moment. But we have learned to hate it, not even considering the externalities it brings.
Just always remember: if you are paying for it, its not your friend!
> please write a rust library implementing a variant of simple8b integer compression augmented to use run-length encoding whenever it's beneficial to do so.
Initially I was sort of impressed, it quickly generated a program which looked like rust code, and provided an explanation that, while not as technically detailed as I'd hoped, seemed to be at least related to the topic.
Then I tried to compile the program. Turns out the bot didn't quite actually write rust, it had written something closely resembling rust though, and the compiler errors helped me fix it.
Then I tried to run the tests--yes! the bot even wrote tests, although it did so in a totally bone-headed way by writing multiple distinct tests in one test function--not good. Panic on integer overflow trying to left shift a value. There were also multiple pages of compiler warnings complaining about dead code, unused functions, enum variants, etc. I always fail on warnings.
This is not a lot of code. 190 lines including tests. At this point, given that I already have concerns about its correctness, I don't think there's anything I can really use here. I'm worried the deeper I dig the worse it'll get, so better to cut my losses now, sit down and read the simple8b paper, and implement this from first principles.
Every time I try to use one of these things it's the same story. I cannot understand the hype. I'm genuinely trying but I just can't understand it.
I guess I'm holding it wrong? Is there a better way I could phrase my query?
first attempt: https://onecompiler.com/rust/42w2duuqh
final result: https://onecompiler.com/rust/42w2e3jr4
PS: it "thought" about it for 2 x 60 seconds
EDIT: To be clear, I do understand that I'm making an unreasonable demand. I know the process that came up with this program has no ability to justify this or that "decision" (deliberately scare quoted because it doesn't actually have agency and can't decide at all). And that's the problem. That's why I find it very difficult to trust it.
[1] https://github.com/lemire/FastPFor/blob/52e45deeab9c3a481daa...
EDIT: I don't mean to suggest programming languages aren't tools of human communication--they absolutely are. In fact, that's their primary purpose--to communicate ideas about the structure of a computation to other programmers. But starting with structural ideas about the implementation rather than conceptual ones about the nature of the problem and the shape the solution should therefore take is putting the cart before the horse.
4o had been happy to attempt to help me fix my function, o1 just went "well that's interesting, meatbag, but have you considered reading the manual?"
EDIT: Oh my. After digging into the code I found this gem:
fn encode_rle(&self, value: u64, count: usize) -> u64 {
let selector = Simple8bSelector::RLE as u64;
(selector << 60) | ((count as u64) << 30) | (value & 0x3FFFFFFF)
}
And this one: fn try_rle(&self, input: &[u64]) -> Option<(u64, usize)> {
if input.is_empty() {
return None;
}
let value = input[0];
let mut count = 1;
for &x in input.iter().skip(1) {
if x != value || count >= 0x3FFFFFFF { // Max 30-bit run length
break;
}
count += 1;
}
Some((value, count))
}
What even is going on here? Compare to an actually sane implementation like[1] or[2].[1]https://github.com/lemire/FastPFor/blob/master/headers/simpl... [2]https://github.com/timescale/timescaledb/blob/403782a5899c75...
[1] https://play.rust-lang.org/?version=stable&mode=debug&editio...
Once these are at a point where we can automatically interpret them into usable workflows, it's going to be incredible how quickly you can develop your ideas. I'm really excited for it.
Some examples of outputs:
https://image.non.io/cd90cc33-4a6a-41d8-abd2-045d3a272010.we...
https://image.non.io/5a0c3fc7-37f8-4e72-aba9-cd61f3c18517.we...
https://image.non.io/920adf7c-a554-41bd-a29c-77bebed1cdad.we...
Other things that are important are img2img and inpainting flows to give the model more context for generation.
Why that is there may be several reasons one being that when you try to improve existing code you would need to know all the untold dependencies in it to not break anything. Whereas when you write new code, there are no dependencies you don't know about.
But so, if you take an AI provided implementation, and try to fix it, you are basically doing just that, trying fix old code you don't know much about. You are working on a (AI-provided) legacy code-base in essence.
It's writing code that can be read, changed, understood. Today, next month, after ten years of random freelance engineers abusing it. By caffeinated me, tired me, bored me, that way too smart junior and that boneheaded senior.
I wonder though if I have an intern and I tell them what is wrong with their code, they do learn from my feedback. One purpose for having interns write code is for them to learn. But is it the same with AI? Does it really learn from my feedback, or will it then just try something else, until I'm happy with its output?
When (and if) AI learns from my feedback, does it then apply it's learning when other people ask it to do similar tasks?
The difference between using AI and working with an intern is that the intern learns from you while the AI doesn't... which means that YOU need to learn from your interactions with the AI so you can prompt it more effectively next time.
All of my Claude interactions include "(no react)" because I learned from past experience that without that it writes a React component which is much harder to export out and use separately.
I've also learned to remind it to use 16px text sizes on input boxes (to avoid a zoom effect when selecting an input field on Mobile Safari), and I habitually say "Add a copy to clipboard button that changes its text to Copied! for 1.5s after you click it" because then I get a better UX for the copy feature.
What you are trying to propose is that computer generated code should somehow make a programmer feel better about one self because they are given the opportunity to improve something that no one knows where is coming from and without a context.
I think you are forgetting that computers can not generate context aware systems or programs. Look at the list by the author - useless in a different context than the one the author lives in. It does not improve anything, it simply adds more things someone else potentially has to worry about. Furthermore it adds to the same cognitive load than any other code - one needs to read it before one can change it, and changing it is really the first step to fully understanding it.
You are not fixing anything old with AI generated code. Ask yourself also, where is the upstream you are trying "to fix".
The first stab was basically correct, but then I needed to prompt him several times to correct an issue where the disk that's currently picked up was being rendered as a vertical strip instead of as a disk, and then I just told him to convert the React into pure JS and IIRC it worked first try.
I see some arguments about high-level languages, eg “I’d rather program in Python than assembly - this is just another step-up”. But I feel natural language is altogether different and obliterates any skill/knowledge you’ve built-up in programming.
I can think other things, for example music - I like playing guitar even though I’ll never create something totally original or do better than a machine could do. But for me, programming combines the fun of creation with the satisfaction of the end result - something you wanted to exist now exists.
To clarify, I’m not talking about “usefulness” or accomplishing some business objective, I’m talking about the joy and satisfaction of programming.
Looking up how to accept a drag and dropped file (and then implementing it) in a JavaScript application isn't really that fun to me - certainly not for the tenth time.
I thrive on variety and building interesting things. LLMs let me incorporate WAY more tools into my work - I can build with Go and AppleScript and Bash and ffmpeg and jq, all things I have never climbed the learning curve enough to feel confident using in the past.
For your example, "How do I accept a drag and dropped file in JS?" - An LLM can spit out 100 lines that does what you want, OR someone writes a nice library that does what you want in a single function call (say, for the common case. More complicated usage requires more arguments, etc.)
(Of course, another option is LLMs are the ones writing these library functions).
I guess I am one of those programmers who is allergic to boilerplate (for better or worse), so having LLMs split out lots of code bothers me.
At this point their limited output limit is far behind o1/o1-mini. I really hope they significantly improve that next.
Not sure why no discussion at all - maybe the design is underwhelming.
I use copilot every day, but it's only so good.
The LLM hype feels like it's been driven by FOMO.
BTW, why the disparaging reference to "little toy apps"?
It's an unmaintainable, single use piece of software (that doesn't even implement the features, it just glues together already existing code) that any CS student could write in a week. Congrats on getting a really fast CS student I guess ? Not to mention the fact that perfectly viable, better alternatives are available in many places.
It's like me nailing two 2x4s together to make a shelf. Yeah, sure, I made it myself and I didn't need any woodworking knowledge, but let's just hope I don't put grandma's heavy china on it.
As a programmer (which is the requisite to build such tools even with LLMs), I have a plethora of tools to do the tasks, what I choose and how much time I invested in in that depends on something similar to this chart, but with an added dimension: interest.
Take for example the URL extraction. For one single occasion, I'd probably use VIM and macros to quickly do it. If it were many pages, I'd write a script. If it were infrequent, but recurrent, I'd take the time to write a better script and would only write a web page if the use case was shared with other people or if I wanted a cross platform solution.
I believe the first question one should ask before building is why. That leads you to find a better UX than shoehorning everything inside a web app.
Perhaps how quickly we become jaded should be taken as evidence of how quickly the world is changing right now.
When I looked at the examples they seemed like the kind of one off scripts, of limited complexity, that we’ve seen many times in the last year or so.
Just saw someone recommend:
Thought there might be more worth exploring from this community. ;-)
It's not magic, but it is very useful. I find that it works best if you have a commit-sized piece of work in mind; something that might take you half an hour but can be described in a few sentences.
I need to update my post to emphasize this, but that's kind of the point.
Every one of these 14 tools (with the possible exception of the OpenAI Audio debugger one, that one's quite hard) is something any web programmer could build relatively quickly.
... but not as quickly as I did with an LLM, because they almost all took less than 5 minutes from idea to finished implementation.
The key point is that if I didn't have Claude to help build these, I wouldn't have built them at all. None of them would justify even an hour of work - they weren't essential tools that I needed to get stuff done, they were just things I built because building them is now so cheap (in terms of time) that there was no reason not to.
That's the real magic here. The cost of knocking out a single page app that does something simple is often now lower than even the cost of spending a few minutes on Google trying to find an existing tool that solves the same problem.
If all someone does is write code based on specifications handed over by someone else then yes, they have cause to be worried - but in my career as a software engineer the "typing code into a computer" bit has only ever been 10-20% of the work that I do.
The big challenge of software development has always been turning human needs into working software. That requires a great depth of experience in terms of what's possible, what isn't possible, how software works and how to architect and design software to deliver value today while still staying flexible for future development.
LLMs can accelerate that process a bit, but I don't think they can replace it. Someone still has to drive the LLMs. I think people with software development skills are best placed to do that.
I'm not a programmer.
It's life-changing.
Anyone taking bets on how many years till the operating system doesn't install any software anymore, and just dynamically generates whatever software you need on the fly? "Give me a calculator app" is doable today "give me an internet browser" isn't but it should be a matter of time.
I just don't see that as being a sound solution. If the user requesting to solve a solved task then using an existing tool will always be a more efficient path.
What I do see as a desired option is where AI could take an existing tool and personalize it to your specific use case. In this example it takes web browser as a GUI lib and wraps it around generic solutions like library that quotes HTML entities which is kinda this just very poorly done so far.
I'd imagine that future programs will be much more component driven with AI connecting components to produce personalized solutions as this is really the only viable option until AI can reason at least in some reasonable capacity to fix its own mistakes.
Based on what? Magical thinking?
Since Elon is so interested in that model, if xAI had Claude's capabilities, they would surely go with that angle
Currently also on the front page https://news.ycombinator.com/item?id=41926067
Chat-based AI is a remarkable set of functionalities to build with. It isn't the only improvement in Tech, let alone AI/ML, but it is massive.
I quite enjoy learning more about it from dedicated folks like simonw.
curl -sL $URL | htmlq 'a' -a hrefAlso it doesn't look like htmlq can handle pages that render their content with JavaScript. If you want to do that you might find my shot-scraper CLI utility useful: https://shot-scraper.datasette.io/en/stable/javascript.html
shot-scraper javascript https://simonwillison.net/ 'Array.from(document.links).map(a => a.href)'These aren't even the "hard" problems that are beyond the reach of LLMs today; they seem like things they should be able to do. It's just that, today, they just aren't achieving the spectacular results that many are claiming; it's mostly pretty crappy.
shot-scraper looks nice.
For three, add one more subtle requirement to the task, and now you're reading awk manpages and trial-and-erroring perl oneliners.
As is it just spits out migraine-inducing "it-works-doesn't-it" solutions from someone starting to learn to program.
You don't memorize them. You learn the foundational knowledge (in this case how http works and the html format, and a bit of shell scripting), then read the manuals and compose the commands. And as days pass, you save interesting snippets somewhere. Then it becomes easier each time you interact with the tools.
Anyone would find ffmpeg or imagemagick daunting if they don't know anything about audio or graphics.
I understand the fundamentals of how git works under the hood. But the cli commands are in no way shape or form, intuitive (just one example). But LLMs nail them every time when I forget.
And I would have had to use GPT to give me the syntax for that command line anyway :)
gifsicle --unoptimize input.gif '#-1-0' > reversed.gif
AI makes docker compose app. Cloud providers that cannot deploy a docker compose app simply and without errors will miss out.
https://tools.simonwillison.net/jina-reader?
{"data":null,"code":451,"name":"SecurityCompromiseError","status":45102,"message":"Your request is categorized as abuse. Please don't abuse our service. If you are sure you are not abusing, please authenticate yourself with an API key.","readableMessage":"SecurityCompromiseError: Your request is categorized as abuse. Please don't abuse our service. If you are sure you are not abusing, please authenticate yourself with an API key."}
Lots of TUI interfaces try to approximate this, but I think I really just need to build out something a bit like https://anvil.works/
Contact me if you need some help getting going…
I think Claude offers me 10x productivity, especially for all these helper apps and technical POCs that I typically create during the week.
And that's without even mentioning mail chain replies, analysis of legal or financial documents, helping my kids with their math assignments,...
It's a huge enabler for me, and it's getting better every month.
We are getting up the abstraction ladder faster and faster, and I cannot even imagine where we will end up within a few months, or a few years.
it is basically a tool to add some additional text to json text files and interpret it as comments for each line. I did it with ChatGPT.
"generate an index.html for {idea}".
It's so much faster to just work within a single file. Of course, you have to be limited in scope, but for quick tools such as these it's excellent.
The parsing was terrible, but it worked at all, which is impressive. It suggested multiple next steps, one of which was to work harder on parsing, so I told it to do that. The resulting app showed a similar UI, but was non-responsive. I noticed it had output a message in small text that said "Claude’s response was limited as it hit the maximum length allowed at this time."
So I told it that it had gone over its own limits and to try again, making an effort to stay within its limits. It tried again, and this time the UI didn't even render beyond a text outline of the UI elements, and I got the same message.
So: pluses and minuses.
Second easiest is to take the code and paste it in a Gist - like this: https://gist.github.com/simonw/14a2c3ef508839f26377707dbf5dd...
And then take the Gist ID and add it to this URL:
https://gistpreview.github.io/?14a2c3ef508839f26377707dbf5dd...
That gives you a URL you can load in your browser.
My preferred route is to host the generated HTML directly myself. I mainly use that via GitHub Pages - I can drop an extract-urls.html file into https://github.com/simonw/tools and about 20 seconds later it becomes available at https://tools.simonwillison.net/extract-urls
Those last two options only work for Artifacts that didn't use React (that's why I use "no react" in most of my artifact prompts). If you DID use React you can turn that into a standalone HTML and JavaScript app that you can deploy using https://github.com/claudio-silva/claude-artifact-runner - I wrote some notes on using that here: https://simonwillison.net/2024/Oct/23/claude-artifact-runner...
Do you do anything special to make the tools directory work like that?
- https://til.simonwillison.net/github/custom-subdomain-github...
I was just trying to be helpful, since it was relevant to content in the post…
Works in every single web browser. No calls to OpenAI needed, and I'm rusty on Javascript. Make it a bookmarklet, and you don't even need to run a dedicated webpage on your machine for that.
We're past the POC stage. LLMs can generate code for simple programs. It's when you try to tweak the requirements and point how a program introduces a bug that you eventually realize they still fail to take you through the last mile just as they did year and a half ago.
That's what's so wild about this: that's true, and yet in most of those cases it's still faster and more productive for me to ask Claude to build me a brand new tool _from scratch_ than it is for me to try and find an existing one via Google.
The problem with trying to Google for these kinds of things is that you have to evaluate the results that come back and figure out which one of them correctly solves your problem. That's a few extra steps.
It's genuinely faster to prompt something like this instead:
> Build an artifact (no react) where I can paste text into a textarea and it will return that text with all HTML entities - single and double quotes and less than greater than ampersand - correctly escaped. The output should be in a textarea accompanied by a "Copy to clipboard" button which changes text to "Copied!" for 1.5s after you click it. Make it mobile friendly
Done: https://claude.site/artifacts/46897436-e06e-4ccc-b8f4-3df90c...
In this case I knew exactly what I wanted: it had to do less than, greater than, ampersand, double quotes AND single quotes. I know from past experience that many tools like this forget about single quotes, so I'd have to evaluate any tools I found to check that they do that. And I was on my phone so I wanted a "copy to clipboard" button.
I have hundreds of projects which are small single page HTML apps, single purpose command line, utilities or plugins for my larger projects.
All of these are short enough to fit into the context window of an LLM.
If all I worked on were 1-2 hundred thousand or million line applications I would get significantly less value out of LLMs.