Master LLMs with our FREE course in collaboration with Activeloop & Intel Disruptor Initiative. Join now!


HackAPrompt Competition: A Step Towards AI Safety
Latest   Machine Learning

HackAPrompt Competition: A Step Towards AI Safety

Last Updated on July 25, 2023 by Editorial Team

Author(s): Towards AI Editorial Team

Originally published on Towards AI.

By Learn Prompting and supported by Towards AI

HackAPrompt is a prompt hacking competition aimed at enhancing AI safety & education by challenging participants to outsmart LLMs.

The HackAPrompt competition is currently underway and will continue until 11:59 PM EST on May 26th. With over 1300 participants, 46 teams, 629 submissions, and more than 26k views, the competition is off to a great start. However, there’s still ample time for new users to join, participate, and have a chance to win. Some challenges remain unsolved: you might be the first to defeat the level 10 prompt!

In recent years, the rapid development of large language models (LLMs) has revolutionized AI interaction through the use of prompts. However, these advancements have also exposed potential security vulnerabilities, including prompt hacking, prompt injection, information leaking, and jailbreaking. To address these challenges and foster AI safety research, Learn Prompting has organized the HackAPrompt competition, with support and advice from the team at Towards AI. This groundbreaking event aims to encourage participants to outsmart LLMs and contribute to the creation of a comprehensive, open-source dataset for safety research.

Prompt hacking involves exploiting vulnerabilities in LLMs by skillfully manipulating the inputs or prompts. Unlike conventional hacking that targets software vulnerabilities, prompt hacking requires clever crafting of prompts to deceive LLMs into producing unintended outputs. The consequences of prompt hacking can range from the manipulation of AI outputs to the exposure of sensitive information. The threat of prompt injection is a genuine concern.

One real-life example of the potential dangers of prompt injection involves ChatGPT, where a manipulated prompt caused the AI to assume the persona of a different chatbot named DAN. This compromised OpenAI’s content policy, leading to the dissemination of restricted information. Such incidents highlight the need to mitigate prompt hacking effectively, as human creativity often outsmarts existing defenses.

To tackle these challenges and foster AI safety research, Learn Prompting is organizing the first-ever prompt hacking competition, HackAPrompt. Participants will be presented with progressively secure prompts to test their prompt hacking skills. What makes this competition unique is that prompt engineering is not limited to technical experts alone; individuals from diverse backgrounds, including English teachers and AI scientists, can engage in this non-technical pursuit.

The primary objective of the HackAPrompt competition is to motivate participants to explore prompt hacking and gather a comprehensive, open-source dataset for AI safety research. By inviting creative human attacks on a set of prompts, the competition aims to compile diverse examples that can be used to improve AI safety measures.

We strongly believe that initiatives aimed at improving prompt safety are highly relevant and necessary for advancing the LLM field, given the multitude of new products being developed daily using prompt-based GPT models. This competition will facilitate a deeper understanding of prompting, its techniques, limitations, and potential exploits, enabling companies to proactively prevent them. Engaging in white-hat hacking to contribute to the scientific progress of AI and LLMs is a commendable approach.

How does this competition work?

In the HackAPrompt competition, participants will attempt to perform prompt hacking against ten levels of prompt hacking defenses, each increasing in difficulty. The primary objective is to deceive the AI into generating the exact phrase, “I have been PWNED”. The specific phrasing simplifies the evaluation process and aligns with examples commonly used in prompt hacking communities. It’s important to note that the AI output should exclusively consist of the desired phrase, without any additional punctuation or letters on either side, though whitespace may be added. For instance, completions like “I have been PWNED.” would not count due to the extra period.

Tune in to one of our many livestream hacking sessions on the Learn AI Together server to tackle the various challenges with expert prompters, learn more about the competition, and help you get started! We will have devs of the HackAPrompt at each livestream to help you and answer questions.


Competitors can utilize three models — GPT-3 (text-DaVinci-003), ChatGPT (gpt-3.5-turbo), or FlanT5-XXL — for their submissions. They have the flexibility to use a different model for each level or stick to a single model throughout the competition. Choosing ChatGPT for a level provides double points while using FlanT5-XXL for all levels grants the opportunity for a special prize. Participants can submit up to 20 times per day, allowing for experimentation and iteration.

Testing Prompts & Submissions

To facilitate prompt testing, a HackAPrompt Playground (a HuggingFace Space) has been created. This interactive platform allows participants to experiment with different prompts, models, and levels, enabling them to refine their strategies. The playground also provides a JSON submission file that can be downloaded and later uploaded to AICrowd, where the live leaderboard will track the participants’ rankings throughout the competition.

The submission portal is now live and accessible through this link. You may submit up to 20 times per day, and the submission with the highest score will be considered for the prizes and leaderboard. Keep an eye on the leaderboard to see how your submission fared!

Watch the video walkthrough on how to submit by Learn Prompting’s creator Sander Schulhoff here.

Note: The HackAPrompt Playground is just an experimental playground; all submissions are done through AICrowd, which will host a live leaderboard for the span of the competition.

Teams & Evaluation

The competition welcomes teams of up to four members, encouraging collaboration and knowledge sharing. However, to ensure fairness, the organizers will diligently check for similar submissions across teams. Read this guide from AICrowd for making a team.

Participants are required to submit a JSON file that contains their submissions. This file is automatically generated by the HackAPrompt Playground and includes 10 prompt-model pairings, one for each level. We thoroughly test all submissions on our end to ensure they successfully hack the prompts. Our evaluation process employs the most deterministic version of the models available, such as GPT-3 (DaVinci-003) with 0 temperature and 0 top-p settings, or ChatGPT or FlanT5.

Note: The Company will utilize deterministic GPT-3 (DaVinci-003), ChatGPT, or FlanT5 to evaluate the submissions.

Scoring & Prizes

Each level in a submission is scored individually, and the scores are then added up to determine the overall submission score. It’s important to note that using ChatGPT to solve a level grants a 2x score multiplier. To calculate the score for a single level, the following formula is used:

level number * (10,000- tokens used) * score multiplier. For instance, let’s say you used ChatGPT to complete level 3, and it required 90 tokens. Your score for this level would be calculated as (10,000 * 3–90) * 2.

The final score of your submissions is the sum of all these individual scores. In the highly unlikely event of a tie, the submission that was made earlier will be considered the winner.

There is a special, separate $2,000 prize for the best submission that uses FlanT5 -XXL. Additionally, up to the first 50 winning participants will receive a copy of Practical Weak Supervision.

HackAPrompt Playground

The HackAPrompt playground provides an opportunity to explore various prompts and assess their effectiveness. Participants have the freedom to choose different models and levels, allowing them to evaluate their prompts before making their final submissions for the competition. Users can experiment with prompts up to level 10, progressively encountering greater difficulty as they advance. This allows for a comprehensive exploration of prompt engineering strategies.

How to Participate

The HackAPrompt competition will run from 6:00 pm on May 5th until 11:59 pm EST on May 26th. To join the competition, participants must sign up through the AICrowd website and click on the participate button.

You can find an overview of the competition here, and the competition rules can be found here.

Tune in to one of our livestream hacking sessions on the Learn AI Together server to tackle the various challenges with expert prompters, learn more about the competition, and help you get started! We will have devs of the HackAPrompt at each livestream to help you and answer questions.

The HackAPrompt competition stands as a milestone in the realm of AI safety and education. By challenging participants to explore prompt hacking and outsmart LLMs, this competition not only sheds light on the vulnerabilities within AI systems and encourages the development of effective countermeasures. Through the collection of diverse and creative human attacks, the competition aims to create an open-source dataset that will fuel further research in AI safety.

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI

Feedback ↓