Future be like Tab Tab Tab

Created: by Pradeep GowdaUpdated:Aug 29, 2024Tagged: llm .

“Future be like tab tab tab” said Karpathy on X.

In the last few days, lot more people are waking up the potential of using LLMs for programming, specifically the combination of Claude Sonnet 3.5 and Cursor IDE. Karpathy says:

Just empirically, over the last few days most of my “programming” is now writing English (prompting and then reviewing and editing the generated diffs), and doing a bit of “half-coding” where you write the first chunk of the code you’d like, maybe comment it a bit so the LLM knows what the plan is, and then tab tab tab through completions.

As an example, this the prompt I wrote for an image gallery (e.g: I generated this image gallery over the weekend with the help of the program that was written with the above prompt.)

Write a  script to show to generate a HTML gallery from a list of .HEIC pictures
in a directory.
Extract the geolocation - Place/City, State, Country for each picture.
If geolocation is unable to return a location, use "PLACE" as the placeholder.
Convert the HEIC images to WEBP.
Use tailwindcss.
Use the webp images as thumbnails on the gallery page.
do not generate seperate thumbnail files, use the webp files.
the webp iamges should link to the full size HEIC images for download.
The thumbnails should be a max width of 300px.
The thumbnails should be arranged not more than 4 in a row.
The pictures should be grouped by their geolocation.
Name each group of pictures by the geolocation embedded in the pictures.
Save the geolocation information in geolocation.json file.
The script should take the input dir, output dir, and output file as script arguments.
Default output file is gallery.html
Embed dependencies into the script.

Couple of things to note here:

  1. I write one statement per line. This way, it allows me to rearrange sentences in a way that has a logical flow. e.g: I want the program to extract the geolocation data before deleting it (I actually removed that line later).
  2. It is top down. state the purpose up front - “Write a script to blah
  3. Tell the LLM to use the frameworks. Whether it is tailwind or prologue.
  4. At the end, I also want instructions for installing, running, command-line options etc.
  5. For bigger applications, I also tell it to generate a directory structure for the project. This is especially handy if you are slightly unfamiliar with the framework etc. Note: I saw someone ask the LLM to generate the directory structure of the app it was generating right at the top - I think that’s a good idea to copy.

As Prof. Ng also says here, the order in which information is presented to the LLM makes an impact on the results.

Aug 28, 2024, on linkedin
Aug 28, 2024, on linkedin