prompt-engineering  by brexhq

Prompt engineering guide for LLM production use-cases

created 2 years ago
9,242 stars

Top 5.5% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides a comprehensive guide to prompt engineering for Large Language Models (LLMs), targeting engineers and researchers working with LLMs like OpenAI's GPT-4. It offers strategies, guidelines, and safety recommendations for building robust applications on top of LLMs, aiming to improve reliability and control over model outputs.

How It Works

The guide explains LLMs as prediction engines that generate text by predicting the most probable next token. It details the evolution of LLM architectures, from n-gram models to Transformers, highlighting the advantages of parallelization and attention mechanisms. Key prompt engineering techniques covered include "Give a Bot a Fish" (providing all necessary data in the prompt), "Semantic Search" (using embeddings to find relevant information), and "Teach a Bot to Fish" (enabling LLMs to use tools or APIs via command grammars and the ReAct framework).

Quick Start & Requirements

This is a documentation-focused repository. No installation or specific software requirements are listed beyond general familiarity with LLMs and their APIs.

Highlighted Details

  • Explains tokenization, token limits, and strategies for managing context windows.
  • Details prompt hacking techniques like jailbreaks and data leaks, emphasizing the need to treat hidden prompts as public.
  • Covers various data embedding strategies (lists, Markdown tables, JSON, freeform text) for providing context to LLMs.
  • Introduces advanced techniques like Chain-of-Thought prompting for improved reasoning and ReAct for autonomous tool use.

Maintenance & Community

This is a living document created by Brex, encouraging discussion and suggestions for improvements. Links to external resources like the OpenAI Cookbook and Dair.ai Prompt Engineering Guide are provided.

Licensing & Compatibility

The repository does not explicitly state a license.

Limitations & Caveats

The guide notes that LLM outputs are non-deterministic, meaning identical prompts can yield different results. It also highlights that prompt engineering is a rapidly evolving field, and best practices are subject to change. The effectiveness of certain techniques, particularly command grammars, can vary significantly between models like GPT-3.5 and GPT-4.

Health Check
Last commit

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
524 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.