Memes are the most efficient messenger in society today. Is there any other vehicle that can carry a powerful statement across the world as quickly and efficiently as a good meme? This thought process was the inspiration for my group’s entry into OpenAI’s recent Climate Hackathon: The Climate Change Meme Engine. Before we get to the memes, let’s step back for a second to provide some further context.
Last week, OpenAI hosted a hackathon for climate change. No, this did not require us to “hack” into anyone’s computer. The goal was two fold:
Develop an innovative tool that aids in the effort of mitigating the effects of global warming
Incorporate OpenAI’s pre-trained algorithms into this tool (e.g. Dalle, GPT-3)
These pre-trained artificial intelligence (AI) algorithms are some of the most advanced models where machines are capable of understanding human text/symbols and generating text and images from this. The word, “understanding”, is a bit misleading. These models were trained on thousands of texts and images to find patterns inherent to the way humans communicate by text. The training process utilized nested math functions that were told to optimize for a specific objective. The outputs were powerful, pre-trained natural language processing models. When I say “powerful”, I am not referring to AI that has anything resembling a human conscience.
Because these models are pre-trained, the bulk of the effort for the hackathon shifted towards defining the problem, prompt engineering, fine-tuning the model, and any app development efforts.* These models require a series of text as input (i.e. the prompt) and the output is text or an image related to the prompt. Prompt engineering refers to the practice of using prompts to get the output you want. Fine-tuning the model is the process of feeding new data to refine these models in order to skew them towards your desired output. For example, if I wanted to use GPT-3 to write articles similar to my style I would fine tune it with text from my previous articles. In fact, I did just that in a separate article.
For the Climate Hackathon, we defined our objectives as the following:
To generate grass roots enthusiasm that puts global warming risks at the top of the public’s mind
To make global warming a “cool” issue to talk about (pun intended :))
To take advantage of network effects of spreading ideas online
In order to generate the climate change-related memes, our process should appear similar to the flow chart below.
Converting “Generate Climate Change Concept” into python code is pretty simple with the help of GPT-3. It looks like this:
import openai
api_key = <insert api key>
openai.api_key = api_key
concept = openai.Completion.create(
model='text-davinci-002',
prompt="Generate a concept related to climate change:\n",
temperature=1,
max_tokens=20,
top_p=1,
frequency_penalty=1,
presence_penalty=0
)
print(concept.choices[0].text)
In the code above, we chose parameters that limited the number of characters to 20 (i.e. max_tokens) in the output and maximize randomness (i.e. temperature). You will notice that the prompt for GPT-3 is written in plain English. Anything that is legible in computer code is a pleasant surprise. The output of this code is a random concept related to climate change, such as “Sustainable transportation”, “A rise in sea level due to melting polar ice caps, or “Global Warming”.
Using this concept, we asked GPT-3 to “Describe a funny image representing this [insert concept from above]”. Continuing the “Global Warming” concept, one output was “A melting polar ice cap with a penguin lounging on top of it, enjoying the warmer weather.”
Then, we asked GPT-3 to write a caption from this image description and Dalle to output an image based off of this description. After receiving the caption and the image, we combined the two into a meme. The process can be summarized via a table of prompts and responses as seen below.
Using some additional python code to combine the image and caption, the output was a meme starring the penguin mentioned in the caption above.
This meme might not seem like much, but I guarantee it travels the internet faster than a Scientist talking about the dangers of global warming. It humanizes the penguin as it experiences sadness and loneliness from the horrific consequences of its home being melted. Humans will empathize with the penguin as they come across this climate change meme in the digital world. Remember, a picture is worth a thousand words.
~ The Data Generalist
*Pre-trained models will likely shift the expected skill sets of data scientists. I predicted this type of change 2 years ago in a previous article where data scientists bifurcating into more technical vs. more business/decision science types.
The code for the meme generator is published on Github.
No Nature No Future Image: https://unsplash.com/@markusspiske
Also published here.