Tales from the jar side: Adding AI to Java, Claude Haiku writes haiku, Devin has come for us all, and the usual silly tweets and toots
When I was young, I was poor. After years of struggle, I'm no longer young. (rimshot)
Welcome, fellow jarheads, to Tales from the jar side, the Kousen IT newsletter, for the week of March 10 - 17, 2024. This week I taught week 2 of my Spring and Spring Boot in 3 Weeks course on the O’Reilly Learning Platform, and a private course on Spring and REST. I also gave a presentation at the (former) New England Java Users Group, now known as the Boston Area ACM Chapter.
Regular readers of, listeners to, and video viewers of this newsletter are affectionately known as jarheads, and are far more intelligent, sophisticated, and attractive than the average newsletter reader or listener or viewer. If you wish to become a jarhead, please subscribe using this button:
As a reminder, when this message is truncated in email, click on the title to open it in a browser tab formatted properly for both the web and mobile.
Boston Java Users ACM Chapter
That mouthful is the new name for the former New England area Java Users Group, which has always been one of my favorite places to speak. I’ve only been there a couple of times, but I’ve always enjoyed it. The only problem is that it’s a two-hour drive, which isn’t too bad, but going there and back and speaking in between all in a single day is rather tiring.
My talk was on Practical AI Tools for Java Developers, which probably won’t come as much of a surprise for regular readers of this newsletter. They foolishly gave me a full two hours before they kicked us out, which I easily filled and could have gone longer.
(Note: I would have stopped much earlier if people had been leaving, but they were into it. I kept getting questions about features beyond the basic presentation, and since I have opinions on most of these thing, we kept going.)
Yeah, it was pretty full. :) Here’s the view from the other side of the room:
Just remember the camera adds 10 pounds, and there were at least three cameras on me at the time.
I’m going to be speaking and writing about AI and Java a lot over the next few months, so this was an excellent opportunity to try out some new slides and code, not to mention some new jokes. Thank you so much to the organizers for the invitation, and for the NFJS tour for sponsoring the trip. The New England NFJS event will be in Wakefield, MA on May 3rd and 4th. If you’re a jarhead and you happen to be there, please be sure to say hello.
Claude Haiku is Available
On Tuesday, Anthropic released the third of their three new AI models that are collectively part of Claude 3. I tried out the first two, Sonnet and Opus, last week when they were released. This one is called Haiku.
I used the REST API to do call them programmatically, because I don’t have an actual subscription to Claude. I did give them my credit card for programmatic access, however, so that’s working on a call-by-call basis. Haiku is the smallest, fastest, and cheapest of the new models. I think the use case they envision is as a customer support agent, or other applications that require quick responses.
By Tuesday, however, even though their blog post linked to the documentation, the docs didn’t show the name of the new model. I managed to figure it out by going to their online chat system.
In case you need it, the name is claude-3-haiku-20240307
, presumably for March 7, 2024.
Of course, I had to ask Haiku to write a haiku:
Here’s the response I got back:
Artificial minds,
Coding Java with insight,
Crafting digital art.
Yes, but no. The first line does indeed have 5 syllables, and the second one has 7, but I count 6 in the last one. So I asked it to try again:
Artificial mind,
Enhancing Java's power,
Code flows effortlessly.
I believe that’s 5-7-6 again.
Let’s try Opus:
Code flows like a stream
AI guides the developer
Java springs to life
The middle line has 8 syllables, right? That’s assuming you count “AI” as two? At least it has a connection with nature, though, which good haiku’s are supposed to have.
I guess there are still a few bugs left in the system. I decided to remind it about the single requirement for haiku’s:
Write a haiku about Java development with AI tools.
Remember that in a haiku, the first line should have 5 syllables, the second line 7 syllables, and the third line 5 syllables.
Here’s the result:
Coding with AI's aid,
Java's power and grace unfold,
Seamless development.
That’s 6-8-6, so not much help there. Wow, AI models can be bad at simple counting. I guess there are still a few bugs left in the system. The Haiku model is cheap and fast, but I suppose you get what you pay for.
Viewer Milestone
The Tftjs YouTube channel hit 30K views:
I’m happy about that, but it’s also my cue to hang my head and confess I’m still working on that Stupid AI Tricks video. I have the demos worked out, both good and bad, and I’m prepared to make faces at the camera in response to some of the bizarre answers, but I still haven’t hit the record button yet. This week, I promise.
Devin, or, the Devil Incarnate
You know how the old saying goes? “First they came for the buggy whip manufacturers, but I didn’t make buggy whips, so I said nothing. Then they came for the accouting clerks, but I liked VisiCalc, so again I said nothing. Then they made Devin, and there was no one left for me…”
My birthday was on Tuesday, and as a present, Cognition Labs threatened to put my entire profession out of business:
Okay, that was hyperbolic, but so were most of the comments in the responses. Of course, that was posted on Twitter, so drama there is the order of the day.
Here’s the deal, as best as I can see. They set up a script to use GPT-4 to solve a programming problem. The script then evaluated the solution, gave GPT-4 feedback, and told it to run again. A few thousands or tens of thousands of iterations like that and the result can resolve as many as 13.86% of the GitHub issues they tried to resolve.
The approach makes a lot of sense. As I mention here periodically, I follow the chess world as a spectator sport. When Deep Blue defeated World Champion Garry Kasparov back in the 1997, it was a triumph of brute force calculation over experience and intuition. That was a bit of an upset, but not really shocking. I mean, cars drive faster than humans can run, too, and we don’t find that surprising. These days the best chess engines could mop the floor with Deep Blue without even trying. I think Stockfish (one of the top engines) has a rating of something in the 3300+ range, and the World (Human) Champion is around 2800. No human can compete with that.
The real breakthrough, however, was AlphaZero. AlphaZero was a neural network from DeepMind (now a division of Google) that was trained by playing games against itself over and over again. The absence of any human grandmasters meant that it had no biases at all about preferred openings, positional understanding, or anything. It figured out everything as it went along, and within 24 hours (the headlines said 4 hours) it was the best machine in the world by a wide margin.
The thing about AlphaZero is that it didn’t rely on calculation, but decided that some chess principles that humans had been following for centuries needed to be re-examined, or at least re-evaluated. AlphaZero had a fondness for pushing its rook pawns, for example, and it loved to secure space advantages and restrict the options of its opponents. It was generally willing to give up material to do so. Many grandmasters have played that way, of course, but AlphaZero showed that it was time to consider even bolder strategies than before.
Telling someone to just calculate more doesn’t really teach them anything. AlphaZero games felt like it was showing players new insights into how to approach the game. You can see the impact in the games of top level players ever since, including Magnus Carlsen.
Getting back to Devin, that’s what this all feels like. Instead of asking an AI model a question and deciding how to use the answer, Cognitive Labs built a feedback loop into the system and let it run. The difference with coding, though, is that for all but the simplest problems, you can’t just specify a simple success function ahead of time that the computer can maximize. My guess is that the company found problems where you could do that, at least reasonably well, and celebrated a success rate of about 1 in 7. I doubt too many clients will be happy with that.
That said, the chess experience suggests this is a really good approach, and should only get better over time. Should I feel, therefore, like the Roman Emperor Honorius in 410 CE watching the Visigoths coming over the hills to sack the city, knowing the Roman Empire was about to fall*?
(*For certain values of the word “fall”. Yes, Roman Empire pedants, I know the actual date of the fall is debatable.)
Should I be worried about Devin? IMHO, not yet. At least not this year, and probably not next year. The tools and approaches will improve rapidly, but I don’t recall seeing anything about the costs, and GPT-4 isn’t cheap, especially if you’re planning to run it continuously for tens of thousands of iterations to find a good solution. I’ve spent some time looking into nonlinear optimization algorithms, too, like genetic algorithms and the like, and it’s easy to get stuck in local maxima, or even wind up in a loop. Finding optimal solutions to difficult problems isn’t easy, and that’s not even getting to the issue that clients don’t really know what they want until they see it.
But I never make predictions in the IT field that go beyond two years, and I just had a birthday. Two years from now I’ll be seriously considering retirement anyway. Let’s not go for the torches and pitchforks quite yet, okay?
Tweets and Toots
You say you want an evolution
Sarah Andersen is a wonderful cartoonist. This one is great. :)
The spice must flow
I think that’s from Adrian Kosmaczewski on Mastodon. Bon appétit.
Upgrade today!
Gotta get some of that sweet, sweet subscription revenue.
Had “the talk” with my mom
Probably should use an old priest and a young priest.
(For you youngins, that’s an Exorcist reference.)
On a related note:
I could believe that.
Where is Kate?
From what I gather, the UK media is going insane right now trying to find out what’s wrong with Kate, other than she needs a decent Photoshop tutor.
Boeing Boeing
I can’t believe that never occurred to me.
The sign says it all
That ought to work.
Someone show this to Zack Snyder
That’s such a good way to express why Superman is awesome. Every movie maker planning to include him should keep this in mind.
Album cover
Despite a complete lack of popular demand, it looks like the Null Pointers, our little rock band of Java developers, will be performing at Devnexus in April. More about that as it gets closer.
Why indeed?
Great story about overcoming bias.
And finally, cats in the machine
Why my son was about 4, he was happily eating a Kit-Kat bar when his aunt asked him, “Do you like Kit-Kats?” He nodded and said, “I like doggies, too.”
He’ll be 32 in May. Sigh. I remember that like it was yesterday, but don’t ask me what I had for lunch yesterday.
Have a great week, everybody!
The video version of this newsletter will be on the Tales from the jar side YouTube channel tomorrow.
Last week:
Week 2 of my Spring in 3 Weeks course on the O’Reilly Learning Platform
REST and Spring MVC (private class)
Presentation at the Boston Java Users ACM Chapter.
This week:
Week 3 of my Spring in 3 Weeks course on the O’Reilly Learning Platform
Spring AI, on the O’Reilly Learning Platform (APAC time zone)
Trinity College (Hartford) class on Large Scale and Open Source Software.