A new kind of program analysis is emerging: AI code analysis. Here is the current state of analysis and where I think it’s headed:
Static analysis, arguably a Good Old Fashion type of AI, it relies on explicit “reasoning” about the program using tree search and other algorithmic methods.
It’s painfully limited because it’s an ultimately undecidable problem. Eg, try proving that a program never halts.
To make code more analyzable there has been a trend to push the programmer to do more of the work. People are adding typing to all the dynamic languages: JavaScript, Python, Ruby.
While static analysis resulted in safer code, it also made coding less fun. You now have to think about two environments:
- the type env
- the runtime env
It’s like almost coding two programs.
This pushes the complexity from the machine to human. Never a good trade off.
The other type of analysis is runtime. Among runtime, testing is the most popular. Testing can be great for safety and as a guard rail for refactoring. It also comes with a huge maintenance cost.
It gets to be such a burden that companies have teams dedicated to testing infra.
Runtime analysis continues to be a fertile space to give programmers more insight over their code. Things like code coverage, APM services, and tracing are very useful.
The problem with runtime is that it requires a big infrastructure investment to get it to work.
I believe we are quickly approaching diminishing returns when it comes to program analysis. We are pushing more of the complexity on programmers to gain increasingly fewer insights.
Which brings me to AI program analysis. An area I believe that will reinvigorate analysis and give us new coding superpowers.
NLP has been insanely effective. And now the same tools are being applied to code.
One of the earliest papers in the space: The Naturalness of Software (2012) showed that a simple n-gram model was used to create a superior autocomplete system.
GitHub Copilot is a recent and more sophisticated incarnation of that.
While Autocomplete is one of the obvious use-cases for analysis, we’re only just scratching the surface.
At Replit, we decided to take a different lens to AI analysis and asked the question: how can we augment human understanding of code?
Incidentally, this is how we approached debugging as well, with code comprehension in mind. blog.replit.com/debuggest
Our first AI tool was Code Explanation. Highlight the code and get a natural language translation of it. blog.replit.com/codex
However there are many other directions we’re exploring:
- statistical linting: can AI spot program mistakes that are hard-to-impossible for static analysis to catch?
- just in time tips: can the AI give you insights or educational resources for a problem you’re facing
- AI REPL: can AI give you rapid feedback on your code that’s similar to coding in a repl?
- can we combine AI with runtime analysis? What can AI tell you about how your code runs?
So many other ideas to explore. At Replit we have a data advantage and an audience that’s hungry for tools for better program comprehension.
I’ve written elsewhere on what the future of AI coding could be and its implications on language design: blog.replit.com/codingai
Please reach out if you’re working in this domain and want to chat or if you want to work with us on some of these problems!
• • •
Missing some Tweet in this thread? You can try to
force a refresh
We grew up in a very competitive field. Online environments have more dead startups than alive. We zoomed past startups 10x our size and capitalization, and we thrive despite incumbents many orders of magnitude larger than us.
We do it while rarely thinking about competition.
First, an axiom: humans are memetic creatures.
Remember how every startup was a chatbot startup a few years ago? Or a more recent example: Metaverse. Facebook renamed to Meta and two days later Microsoft announced their Metaverse strategy. I'm sure IBM is working on it too.
As an early employee, I saw how painful startups were, in both success & failure.
Replit was forcing itself unto the world; it was no longer sustainable as a side project.
Before incorporating, here are all the ways we tried *not* to:
I tried to make it a project at Facebook where I worked.
I was careful in separating the two but when it became a big time and money sink, I told my boss. We tried to find a home for it but there was just no appeal.
I even emailed Zuck. No response. Time to move on.
I tried to merge it with two other startups at the time doing similar things.
Ultimately we had different visions for the future, and I didn’t think they were being ambitious enough.
AWS operated for 7 years without any competition. That's a hallmark of a non-obvious invention. If you watch early AWS pitch, even Amazon didn't know what it really was.
See this video (timestamped). The pitch was similar to @paulg's ViaWeb: "create your own store."