-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Generative AI with Python and PyTorch - Second Edition
By :
Generative models are powerful systems capable of producing images, text, audio, video, or combinations of modalities, depending on their design and training. In Chapters 5 and 6, we explored transformer-based models that generate text in various languages and styles by providing specific inputs, sometimes with instructions or examples. Throughout this book, we’ve generated outputs conditioned on specific inputs—effectively engaging in prompt engineering all along.

Figure 7.1: Tweet by Andrew Karpathy on Prompt Engineering1
Simply put, prompt engineering is the practice of designing and refining prompts to guide generative models, particularly LLMs, to produce desired outputs. A prompt is the input to these models, often in plain language, consisting of task instructions (implicit or explicit) with or without examples, enabling users to tap into the model’s vast capabilities (see Figure 7.1).
Before we dive into the details...