The AI Advantage: Coding in the Era of Language Models
Sharing some notes about the paradigm shift in coding
Before we begin, The Data Voyage is a free newsletter for Data enthusiasts. You can subscribe by clicking on this nifty button below
Recently, the CEO of Nvidia underscored the significance of Language Models (LLMs) and AI in the realm of coding during an interview:
AI is no longer just a supporting act; it’s assuming the lead role, fundamentally altering the coding narrative. The advent of AI is moving us away from the precise details of programming languages, guiding us towards a broader horizon where problem-solving and innovation take precedence.
Over the past four months, I’ve been extensively using Bing’s ChatGPT for writing and optimizing code, and I find myself resonating strongly with this perspective. In this post, I aim to share my experiences, highlighting the benefits and potential pitfalls of this approach.
Embracing the Multilingual Landscape
One of the most significant advantages of using LLMs for coding has been the ability to seamlessly switch between multiple languages.
My primary tool for data analysis has been R. However, R can be quite slow for certain operations. While it remains a powerhouse for data analysis, it lacks robustness in other areas. For instance, my work often involves reading and scraping through text files to create dataframes for analysis.
R is not particularly optimized for reading through each line, extracting information, and then creating dataframes. It’s notably suboptimal for loop operations. So, what’s the solution when I need to sift through millions of lines and create a dataframe? Enter Python! With the assistance of GPT, Python was incredibly helpful in this regard, reducing the entire processing duration to a tenth of the original time. Yes! 1/10th!
Another way to leverage the multilingual landscape is to provide a code snippet in your preferred modeling language and then ask the chatbot to convert it. Like this:
#Prompt: What is the python equivalent of this code?
df %>%
clean_names()
For example, the clean_names()
function in R cleans the column names of a dataframe columns and converts them to snake case. With GPT’s help, I was able to convert the code to Python in mere seconds. I also discovered pyjanitor
, the Pythonic equivalent of the janitor
library.
Is it Time to Say Goodbye to Stack Overflow?
There has been a noticeable reduction in traffic for Stack Overflow, which is somewhat sad yet also a welcome change. I used to be very active on Stack Overflow, answering and editing questions. However, since the advent of ChatGPT, my visits to the website have dwindled significantly.
Moreover, the Stack Overflow community can sometimes come across as rather rude. Now, most issues can be easily resolved with the help of a friendlier AI companion.
The Importance of Verifying Your Work
When using LLMs to overcome coding challenges, it becomes crucial to verify your work at each step. It’s perfectly acceptable to ask ChatGPT to perform complex operations (or even simple ones). However, it’s equally important to meticulously verify the output or the work.
In my experience, this verification has mostly been done by directors or VPs. Or any seniors with some data/business knowledge. Whenever I had to share an output of my work, they would scrutinize the result and identify any “outliers” or errors.
In this context, the coder must assume the role of an intermediary director or VP and verify their own work. It’s essential to have a clear understanding of what is expected from a few lines of code. Otherwise, there could be complications down the line.
As we navigate the coding landscape with AI, it’s crucial to remember the balance between efficiency and accuracy. Embrace the change, but also verify your work meticulously. What has been your experience with AI in coding? Share your thoughts!
Found this useful? Share it with someone you think will it.
Thanks for reading The Data Voyage! Subscribe for free to receive new posts and support my work.