Program in English

Did you know that you can write LLM prompts as if they were programs? You can pretty much use any language you like, or make one up (pseudo-code) as long as it makes sense. The pattern-matching capabilities on a language model will determine what you are trying to direct, and it will execute (a variation) on what you have asked it to do. It will not be quite the same each time (and that might be a feature). You can try it out here in SkyDeck.ai (sign up) and experiment with using different LLMs to see how the results differ. Applying this technique in your own use of AI can add another multiple to your productivity.

Programmatic Poetry

For example, you could ask an LLM:

Write a short poem: haiku about love in English.

Or you could programmatically direct it to write three types of poems in three languages about three subjects. It will give you most of the combinations. Here is how you do it.

First, I define the poem types to produce. I imagine a variable name for this called "poem_type" and I present the types in a Json format:

{ "poem_type": [{ "name": "haiku" }, { "name": "lymeric" }, { "name": "sonnet" }] }

I do something similar for poem subjects and languages:

{ "subject_type": [{ "name": "love" }, { "name": "anger" }, { "name": "music" }] } { "language": [{ "name": "Japanese" }, { "name": "English" }, { "name": "Italian" }] }

Then you describe the logic for what to do with this data, referring to it in a logical fashion. I copied the style of mustache logic-less templates to create three levels of nested loops. If this were a program we would expect 3 x 3 x 3 = 9 different poems to be produced. But an LLM will do as many as it likes, and your output might get cut off due to context window limitations.

Write a short poem: {{#poem_type}} {{#language}} {{#subject_type}} {{poem_type.name}} about {{subject_type.name}} in {{language.name}}: {{/subject_type}} {{/language}} {{/poem_type}}

Cut and paste all this into SkyDeck’s GenStudio workspace and select an LLM like OpenAI GPT-4 or Anthropic Claude2 and you will get a result like this:

Don't miss these stories: