Discussion on real world use of AI with zig

Looks cool, but I’m very surprised by that last part. Why would it have taken you several months? How many loc was the output to that 1 prompt?

Also, why do you want to promote Zig with LLM generated software when you know how hostile the ZSF and the original creator of Zig are towards LLMs? If you’re pro LLMs wouldn’t you rather use Rust? Or are you in the Zig is more readable therefore better with LLMs camp? What specifically makes you more interested in Zig? Not trying to be rude - I’m just genuinely curious.

To answer your questions

Why would it have taken you several months? How many loc was the output to that 1 prompt?

I actually set out to build a media player on top of libmpv about 4 months ago, without LLMs, , and it did not take me months to get something working. One of the limitations I ran in to with libmpv was that it does not expose its vulkan renderer (see this issue on GH), I nevertheless kept working on it but it fell by the wayside as the main feature which was synchronized players was not something I ended up caring for much, you can see that project here: https://codeberg.org/shahwali/shaven

So I knew that for my next attempt, I would have to reach lower down the stack and use libplacebo directly. The problem is that when you do that you lose a bunch of functionality that libmpv does for you (and it does them quite well too!). When I say it would take me several months, I am not really talking about typing out each line of code, it is the time spent in total from doing research on the APIs of the different dependencies I would need to pull in, writing Zig bindings if they don’t already exist (usually if they do, they are also behind the Zig master branch which means I end up having to fork them or write new ones anyway), and time spent testing to find edge cases that can happen. And that is not even taking in to account time spent polishing the finished product, I am a bit of a stickler for aesthetics, and so for me, I am not just fine with it working as intended, it also has to be a pleasant experience for the user, visually and functionally. LLMs essentially helped me skip to that last step in this case.

Also, why do you want to promote Zig with LLM generated software when you know how hostile the ZSF and the original creator of Zig are towards LLMs? If you’re pro LLMs wouldn’t you rather use Rust? Or are you in the Zig is more readable therefore better with LLMs camp? What specifically makes you more interested in Zig?

The way I understand it, ZSF is explicitly prohibits LLM generated code as contributions to Zig. I think that is a perfectly fine stance to have, and in many ways I am glad they have that stance as Zig is trying to innovate, not just catch up to existing languages. In this regard, LLMs are quite terrible, and would have likely never suggested something like the Io interface. There is also the mission statement to provide education and guidance to students, accepting LLM code directly contradicts that mission statement.

I am not under the impression that the ZSF is against people generating Zig code via LLMs. One of the best pieces of software to come out of Zig (Ghostty) that I use everyday has a bunch of LLM generated code in it. In my case, I am not interested in pushing the boundaries of what is possible with media playing, in my opinion, existing libraries have essentially solved all the hard parts, I simply stitched many difficult-to-work-together pieces together, and used my library to add a pleasant GUI on top of it. And I will likely still spend a decent amount of time looking at how the LLM did it, because I think there is a thing or two to learn from it.

6 Likes

I can’t argue against that. API hell is real. No one wants to waste time learning all of that niche stuff, it’s just rote memorization.

ZSF isn’t formally against LLM generated Zig code. But they definitely don’t love LLMs the way Hashimoto does. I don’t think I’ve ever seen them compliment AI the way you have. Hashimoto’s not a great example of ZSF being “for” people generating Zig via LLMs, cuz he’s giving em the big bucks so there’s a conflict of interest. He’s even said himself that his opinions don’t fully align with the ZSF but he respects them regardless.

But I can come up with countless examples of them being against LLMs. Take this quote for example: “We’re all trying to get better at programming,” Kelley said. “People who are sending AI pull requests, those people are not helping this goal.”

He also said “I think looking at LLM generated output rots one’s brains and I want to avoid my brain rotting. If it’s hard to avoid brain rot on Ziggit then I will avoid Ziggit altogether.” There’s also this one. Now Andrew isn’t the ZSF, but given that he’s the president of the board of ZSF, we can expect that if they disagreed with him over such an important topic as AI use, they would be more explicit about it, but they don’t really say anything about AI at all on this page.

They want more Zig adoption, and it’s MIT licensed anyway, which means letting people use agents with Zig even if ZSF dislikes AI. We can think of LLMs as the philosopher’s stone from full metal alchemist. It’s powerful, made from evil means, sometimes you have to use it against your will, i.e. to escape Gluttony’s stomach (your boss is forcing you).

In this regard, LLMs are quite terrible, and would have likely never suggested something like the Io interface.

That’s definitely true for now. They’re still not there yet, but I don’t think that this will hold in say 2030.

And I will likely still spend a decent amount of time looking at how the LLM did it, because I think there is a thing or two to learn from it.

Can I hear your reasoning for why you chose Zig as opposed to any other language though? I’m trying to write a blog post on this topic and want opinions from all sides.

I’ll address this one more time but I realize it is kind of derailing the thread a little as this thread is about knots (which is not vibe-coded), and not plainview, which is a separate project.

Can I hear your reasoning for why you chose Zig as opposed to any other language though? I’m trying to write a blog post on this topic and want opinions from all sides.

I get the impression that I come off as picking up Zig yesterday and just prompted a pile of slop together over a weekend, this is not the case. I have been writing Zig for the better part of the last 3 years, before LLMs were a thing (for programming at least). The reason I chose Zig, was because I was a student, and was interested in learning how computers work, not how Rust works, or how to write optimal C++ in 2024, but how computers work, and for me, Zig was the best language for that.

And in terms of LLM coding Zig, I think only the recent frontier models have shown any sign of being able to put together a coherent piece of software, which is perhaps why I have started to dabble. Before that, I was partly in the Andrew Kelley camp of rejecting it entirely, as contributions to my repositories, and usage of it to develop them, understanding that it can be impossible “to know” the origin of the code, and if the contribution looked sensible, and the author could explain it, I guess it was sufficient for me.

But when it comes to “end user products”, I am not sure what the future holds, and how realistic it is to ignore usage of it. I think of the countless software that cause so much friction in everyones lives, and the only reason a replacement hasn’t been built is that no one has the time, nor necessary skill to “catch-up”, and that perhaps LLMs are the great equalizer? Think of the Adobe suite, a genuinely god awful suite of software, that they charge out the ass for, with predatory subscription schemes and the whole lot. If LLMs lead to open source alternatives, that has feature parity, and is “just better”, how can I look at that and wag my finger going “that’s slop”. If LLMs lead to the death of Adobe, would anyone complain? In my own example here, I genuinely find VLC painful to use, and MPV has a UI that I would consider actively hostile to the user, with alternative clients not being much better. So why not rebuild it with Zig? Who knows, I consider this a bit of an experiment, maybe some of the choices the LLM made make it completely unmaintainable, and I end up rewriting large swaths of it. I guess part of what impressed me so much is that from a first glance, it didn’t seem necessary to do that?

As for Andrew Kelleys “hostile” attitude, I think he has every right to be upset about the usage of LLMs, as it clearly has caused him way more grief than the average person. I am not dealing with 100s of slop pull requests, and meat proxies. For me, I ask myself, is the problem with LLMs that some people are producing slop software, or is it that it is being used to build literal murder-bots (see Palantir)? And when I put it like that, maybe building a media player with LLMs that makes the film-watching experience that much better, isn’t so harmful.

11 Likes

Can I ask mods to spawn a new related topic and move our convo there, or move it to another topic about a similar subject? They might not want to reply anymore but maybe somebody else will.

The reason I chose Zig, was because I was a student, and was interested in learning how computers work, not how Rust works, or how to write optimal C++ in 2024, but how computers work,

This is exactly what first made me interested in Zig too.

is the problem with LLMs that some people are producing slop software, or is it that it is being used to build literal murder-bots

I’m not saying what you’re doing is equivalent to Palantir. But don’t you think LLM use, especially as their capabilities increase, is a slippery slope. I can ask a million question:

Is learning something you focus on at the beginning of a journey, and then once you’ve mastered the fundamentals you can use as much LLMs as you want? Should LLMs only be used for things where you care about the end product more than learning. Isn’t most learning that we do against our will? Will LLMs functionally replace human thinking in serious projects, so humans will only work on “toy” software with human toy languages like Zig instead? Do LLMs help open source software because they make free/cheap work easier and better, or do they help proprietary software more because they have much higher token budgets and access to models barred from the public (i.e. as we saw with Mythos, and we know OpenAI has internal models trying to crack hard problems for publicity)? Or do you think open source will win because we will eventually reach a limit to how intelligent a system can be before any additional intelligence stops being practically useful? How would LLMs lead to the death of Adobe, when Adobe can afford so much more AI tokens than you to improve their software? Other software as good as Adobe already exists. I think it’s clear that Adobe only remains because of things like marketing, support teams, friction with learning a new software, and a pay-to-cancel subscription. Is AI making open source software better really gonna change any of that? Would you still want to use Ghostty if it was made start to finish by an AI in Rust. What if a successor comes out that’s better, but made in that way?

I don’t expect you to answer all of these questions. My point is that there are dangers to LLMs outside of just their outputs. LLMs are bad because they make slop is fundamentally a lazy argument. LLMs are good because I get to decide which work to delegate is also a lazy argument, because someone else will decide to delegate your work as well. Eventually all important work is delegated.

I’m trying to make a stronger argument than both on how we should view LLM use. I’m not convinced that our morals are built on a strong enough foundation to withstand a future with even more capable models. I think we need to value human thinking, even if it means slower development and worse end user software, because otherwise this slippery slope will make human thinking functionally irrelevant, turning it into an art form. I’m not saying that’s happening right now, but I think that by say 2030 this will really start accelerating. LLMs are different from calculators (and compilers) because calculators automate one specific niche aspect of thinking, while LLMs encompass everything.

Now, I don’t believe that Zig is capable of changing where human history is heading either. In general, I just can’t imagine how we’re gonna steer ourselves off this track, because it seems not a lot of people agree with me. This is just a philosophical argument about what I believe is important that I want to hear other peoples’ opinion on. Zig is relevant to this because it has a culture of craftsmanship, a history against LLMs, and a mission statement which says “teaching the next generation of programmers to be competent, ethical, and to hold each other to high standards”.

2 Likes