WhoBuilt

Prompt Engineering and AI Red Teaming

Jul 14, 2025· 2 h 1 min· 15K views·Watch on YouTube

Speaker

Sander Schulhoff, CEO of LearnPrompting and HackAPrompt, discusses prompt engineering and AI red teaming at an AI Engineer talk.

Prompt engineering basics

Schulhoff defines a prompt as a message to generative AI and prompt engineering as improving that message. He distinguishes conversational prompting, such as iterating with ChatGPT, from prompts optimized for repeated API calls. He says prompting remains relevant, though a prompt can also reduce accuracy.

Techniques and evidence

Drawing on the Prompt Report, a review by about 30 researchers covering roughly 200 techniques, Schulhoff describes role prompting, chain of thought, decomposition, ensembling, and few-shot examples. He says role prompts are unreliable for accuracy measures such as F1, while examples can help but their order, labels, format, and similarity to the task may affect results. In his entrapment classification work, automated prompt optimization with DSPy outperformed his manual effort.

Red teaming and prompt injection

Schulhoff describes AI red teaming as testing whether models can be induced to produce harmful outputs, and distinguishes jailbreaks from prompt injection involving developer instructions. He argues that prompt injection differs from conventional vulnerabilities such as SQL injection because combining user input with instructions makes reliable prevention difficult. He cites MathGPT, where generated Python code ran without containerization and exposed keys, as an incident that conventional security controls could have prevented.

Agent risks and HackAPrompt

Schulhoff argues that agents acting on the web or in the physical world could follow malicious instructions embedded in content, such as an ad redirecting a flight purchase. He says HackAPrompt gathered 600,000 prompts and that its competition data is used by AI companies to evaluate models. He presents the conference challenge as a way to test prompt hacking, with submissions judged during the event.

Takeaways

  • For repeatable AI tasks, evaluate prompts on representative data with a clear metric such as accuracy or F1.
  • Treat roles and prompt tricks as task-dependent; test them rather than assuming they improve results.
  • Check few-shot examples for ordering, label quality, format, and fit to the task.
  • Run generated code in a sandbox, and apply established security controls to tools and data.
  • Red-team agents against malicious content in the environments where they will act.

Mentioned in this talk

Search inside this talk

What was claimed 12

Show all 12 facts

Related talks