FastML

Machine learning made easy

This is how you code now

We have reached a time when AI is revolutionizing programming. Coding assistance from bots can provide a significant productivity boost to programmers and make the activity more enjoyable by eliminating nuisances like writing boilerplate code. In this article, we will explore two currently available options: the you.com search engine chatbot and the Cursor text editor.

It was a long-time coming, but we were nonetheless shocked to experience firsthand that you can ask a computer to generate Python code and IT WILL DO IT. Just go to Richard Socher’s you.com, type what you want, and you’ll get it. Ask, and you shall receive.


It will explain the code, too, in a few lines that didn’t make it to the screenshot.

We somehow missed the trial of Github Copilot, but there are other options. Specifically, Cursor came out of beta. Cursor is a basic text editor using ChatGPT for assistance with coding. You can either tell it to (re)write some code, or have a chat about it. It’s amazing and it’s free.

For your information, AI in Cursor will mostly confine itself to answer programming questions (until you jailbreak). It will, however, explain in detail pearls like this, if you ask it:

a programming pearl in sed

Editor

What text editor or IDE do you prefer? Copilot requires you to choose from popular IDEs like Visual Studio, PyCharm, or Sublime Text. With Cursor, you’re limited to using Cursor itself. This can be a drawback since the editor is currently at the MVP (minimum viable product) stage, meaning you can’t customize colors, fonts, or keybindings. What you can do is have the same file open in your favorite text editor and in Cursor, switching between them as needed. This is still more convenient than copying and pasting to and from a browser, as you would with the you.com chatbot.

The newfound freedom

The great thing about the coding assistance is that you can write pseudocode and the AI (or, more precisely, “AI”) will do the work. Imagine this scenario: you have a list of UTC timestamps spanning a few years, and you want to convert them to your time. Easy enough? Well, your country uses daylight savings time, meaning that the offset between your time and UTC changes, and the switch dates are not fixed either, but something like “the second Sunday of March”. Do you know how to do it?

This is the kind of programming that you do not really want to do or think about. It’s a slog.

Bots to the rescue. Here’s what you.com came up with:


This code uses the datetime and pytz libraries to parse the UTC timestamps, set the appropriate timezones, and convert to Polish local time. The function takes in a list of UTC timestamps as input and prints out the corresponding date and time in the Polish timezone.

This is what Cursor came up with given the same prompt:


There are some style differences and Cursor packaged the code as a function and gave no examples, but both work. It’s up to you to make sure that they work, of course.

Now implement papers

Things might get hairy if you ask for something more complicated and less popular, like an implementation of the WARP loss, for example. In this case, the code from you.com didn’t look correct, nor did the Cursor code. If you ask them where the sampling is, they will adjust, but will they get it correct this time?

If you are crazy enough, you can ask a bot to implement code for a paper of your choosing. You.com asked for a clarification what exact paper did we mean, and produced this:


This doesn’t inspire c

Cursor produced something in the general ballpark of what it was asked for, but missed the details completely. This is understandable given the fact that GPT-4 doesn’t interface with a search engine, so it can only access what it has learned in the past. In contrast, the you.com bot can go and figure out stuff to some extent.

Hallucinations

The general problem with the bots is that they tend to hallucinate. These models are trained to generate text, not to provide factual information. When they don’t know the right answer, they don’t know that they don’t know. For example, you.com will straight up make up things when asked to provide links:


There is no such thing as structured copula spaces. None of these libraries exist. All the links are 404.

Other shortcomings

One more annoying thing about you.com is that during a chat it will often reply with Sorry, too many people have been asking me questions at once. Give me a moment and try again. There is no “resend” button. When you paste the same question into the main search dialog, get the results, and switch to chat again, it will however respond without fail. Is this a nice workaround or does it make it even more annoying? You tell us.

It also loses context, for example you ask it about a paper, then mention “the paper” in the next line, it doesn’t know what paper you are referring to. Finally, it is kind-of passive-aggressive:


Cursor sometimes stops abruptly, when asked to implement Twitter, for example:


Now we know why Musk has been so eager to fire people at Twitter. AI WILL RUN TWITTER FOR HIM

When working in web development, there’s frontend HTML code and the backend code. Cursor’s context seems to be the current file only, it is not able to relate it to other files in the same directory. This is a problem because obviously you don’t want to mix HTML with Python or any other language in the same file.

One way to overcome this is to instruct it to separate the contents of each file by “—”, for example. It will do it, but might forget about this instantly.

The most annoying thing about Cursor is that sometimes it will start generating stuff right where the cursor is, not paying attention if it’s in the middle of a word at all.

UPDATE: Cursor updated itself from a bare-bones text editor to rebranded VS Code, thus gaining functionality and usability. It essentially became an editor plugin interfacing with OpenAI, which is what it should have been from the beginning. The advantage of Cursor over other plugins is that you don’t need your own API access credentials.

Outro

To sum up, the main advantage of you.com is that it can access the web for knowledge. Cursor on the other hand is more convenient to use, including the fact that the AI can edit an open file.

Let’s remember that as regards AI coding assistance we’re at a point similar to where Wright brothers were with regards to planes. It will fly, but slowly and at a short range, and it will crash at some point. It will get better, though. It will get much, much better.

Talk about the article with a chatbot (Llama 3.3 70B from together.ai). The chatbot is rate-limited to six requests per minute. The messages are stored on your device.
AI, basics, code, software

« SpamGPT: watermarking large language models Instructions for large language models and AI assistants »

Comments