Skip to main content

[ChatGPT] Prompt Engineering Guide

Prompt Engineering Guide



Prompt Engineering is a science that focuses on how to make a computer language model provide the desired answers. For example, when we ask Siri a question or enter a search term on Google, we carefully select the words and how we phrase the question to get the desired information. This is essentially what a prompt is. The study of how to create and optimize these prompts is what we call 'Prompt Engineering'.

Prompt Engineering is a relatively new field that focuses on developing and optimizing prompts to efficiently utilize language models (LMs) in various applications and research topics. The techniques in prompt engineering can help us better understand the capabilities and limitations of large language models (LLMs).

Researchers often use prompt engineering to enhance the capabilities of LLMs in various tasks such as question answering and arithmetic reasoning. Developers design powerful and effective prompts to interface with LLMs and other tools using prompt engineering techniques.

But prompt engineering isn't just about designing and developing prompts. It also encompasses various skills and techniques that are useful when interacting with LLMs. Prompt engineering is a critical skill when it comes to understanding, interfacing with, and building upon the capabilities of LLMs. By mastering prompt engineering, you can improve the safety of LLMs, create new features, and supplement LLMs with domain knowledge and external tools.


Setting Up LLM

When working with prompts, you interact with the LLM directly or via an API. A few parameters can be adjusted to get different results for the prompts.

Max Tokens

This parameter specifies how many tokens the GPT model should generate at a time. A 'token' is a basic unit that the GPT model understands and uses to generate text. Tokens can be anything from characters, words, or punctuation marks.

For instance, if the 'max tokens' value is set to 50, the model will generate a maximum of 50 tokens at a time. The larger this value, the longer the text the model can generate, but the computational cost also increases. Conversely, the smaller this value, the shorter the text the model generates, but it can generate responses more quickly.

Temperature

In ChatGPT and other GPT family models, "temperature" is a hyperparameter that controls the variability of the model's output. The value of temperature can be anything above 0.

Temperature works as follows

At higher values of temperature (for example, 1.0 or higher), the model produces more varied and randomized answers. This has the effect of increasing the entropy of the output.

On the other hand, for lower temperature values (e.g., 0.1), the model produces more predictable and consistent answers. This has the effect of lowering the entropy of the output.

In other words, high temperature values cause the model to take more risks and provide more varied answers, while low temperature values cause the model to provide safer, more consistent answers.

These features can be useful for using GPT models to regulate the diversity of output in a variety of applications. For example, a high temperature value might be appropriate for creative writing tasks, while a low temperature value might be appropriate for business reports or formal communications.

Simply put, a higher set temperature increases randomness, which can lead to more diverse and creative results. In essence, you're increasing the weight of other possible tokens. 

In terms of application, we recommend using lower temperature values for tasks like fact-based QA to encourage more factual and concise responses. For poetry writing or other creative tasks, it may be advantageous to use higher temperature values.


Top_p 

Another hyperparameter that controls the diversity of the output. This is also known as "nucleus sampling" or "top-p sampling".

Top-p sampling is when the model only considers the most likely words in the probability distribution of selecting a word. The value of "top_p" takes on a value between 0 and 1, and you want to generate a subset with a value of p. This subset contains the most likely words from the entire probability distribution, whose cumulative probability exceeds p. For example, if the value of top_p is 0, the model will only consider the most likely words from the probability distribution of selecting a word.

For example, if the value of top_p is 0.9, the model will only consider the subset of likely words at each step whose probability cumulatively adds up to 0.9. This makes the model's output more diverse, but increases the risk of including irrelevant or meaningless words.

Top-p sampling can be used in conjunction with temperature to control both the diversity and consistency of the output. The difference between the two is that temperature "smoothes" or "sharpens" the entire probability distribution, while top_p adjusts the probability distribution by limiting the set of words that are likely.

As a sampling technique, top_p allows you to control how deterministic your model is when generating responses. If you're looking for accurate, factual answers, keep this value low. If you want a more varied response, increase it to a higher value.


As a general rule, we recommend changing one, not both.


Before we get started with some basic examples, keep in mind that your results may vary depending on the version of LLM you use.


#NE-ILGI #AIDiary #SharePrompts #ChatGPT #DiaryApp

https://www.sharegpt.cc/ 

Comments

Popular posts from this blog

NE-ILGI:対話型AI日記の究極ガイド - それはただの日記じゃない!

NE-ILGI:対話型AI日記の究極ガイド - それはただの日記じゃない!#SharePrompts #ChatGPT #DiaryApp NE-ILGI のご紹介:日記が友達になる!#AIFriend 日記に返事をする時代が来ました!それはまさにNE-ILGI - AIがあなたの友達、詩人、ラッパー、読者として一緒に話す魔法の日記です。 これは日常生活のユーモラスな瞬間から心の奥深くの思考まで、あなたが書くすべてに対応します。ユーモラスに反応したり、詩的な感想を述べたり、ラップバトルを挑んだりします。なんて素晴らしい友達なんでしょう! この日記はただの日記ではなく、あなたの生活の一部になるように設計されています。常にあなたの話を聞いて、そして返事をしてくれる友達と共有する瞬間を想像してみてください。 日記のアート: #PoetryGenerator #RapperAI NE-ILGIは日記を芸術に変えます。あなたが書くすべてが一種の詩、ラップ、あるいは物語になります。AIがあなたの心の声を読み取り、それに適した形で反応します。 そしてこれはただの反応ではありません。それはあなたが書くすべてに対して、深い感じや感覚を生み出すための賢い反応です。言葉はただの言葉ではなく、それはあなたの心の鼓動、あなたの人生のリズムとなります。 カスタマイズとアップデート: #InteractiveDiary NE-ILGIは日記に一致する様々なテーマのアイコンと背景画像を定期的に更新します。これは日記をより個人的でユニークにするためのものです。 このアプリはあなたがそれを自分自身のものにすることを奨励します。あなたが日記を書くとき、それはただの日記ではなく、あなたの生活の一部、あなたの人生のスケッチブックになります。 ChatGPTと共に: #ChatGPT NE-ILGIは、多くの専門家との対話を可能にするChatGPTと一 緒に提供されます。これはあなたが自分自身と世界について学び、理解するための素晴らしいツールです。 これはただのチャットではありません。これはあなたが人生の問題や疑問を解決するための対話です。これはあなたが自分自身をよりよく理解し、自己啓発を達成するための道具です。 素晴らしいプロンプトを共有: #PersonalizedResponses NE-ILGIは素晴

[프롬프트] Stable Diffusion과 함께하는 이미지 생성 마스터클래스 - 부록

OpenArt의 세상에서 AI로 이미지를 만드는 데 필요한 모든 것 안녕하세요, 창의적인 독자 여러분! 여기 OpenArt와 함께 AI로 이미지를 만드는 미래 세상에 오신 것을 환영합니다. 이번 포스트에서는 OpenArt의 생성기에서 사용하는 다양한 요소들에 대해 자세히 알아보겠습니다. 그러면 시작해 보죠! 1. Base Model: 이미지 생성의 시작 OpenArt의 세계에 오신 것을 환영합니다! 먼저 이야기할 주제는 'base_model'입니다. 이것은 이미지를 생성하는 데 사용되는 기본 AI 모델을 의미합니다. 이 모델은 이미지의 기본 구조와 디자인을 결정하는 데 큰 역할을 합니다. 예를 들어, 'base_model'을 'landscape'로 설정하면, 생성기는 경치 좋은 풍경 이미지를 생성하는 데 초점을 맞춥니다. 반대로, 'base_model'을 'portrait'로 변경하면, AI는 인물 초상화에 중점을 둡니다. 2. Prompt와 Negative Prompt: AI의 지시사항 'prompt'는 생성기에게 어떤 종류의 이미지를 생성해야 하는지 알려주는 지시사항입니다. 예를 들어, 'prompt'를 '사막에서의 일출'로 설정하면, AI는 이 키워드를 기반으로 사막에서 떠오르는 태양의 이미지를 만듭니다. 반면에 'negative_prompt'는 생성기가 피해야 할 요소를 지정합니다. 예를 들어, 'negative_prompt'를 '사막'으로 설정하면, 생성기는 사막과 관련된 요소를 최대한 배제하며 이미지를 생성하게 됩니다. 3. Model, Version, Image_num: 생성기의 세부 조정 'model'과 'version'은 생성기가 사용하는 AI 모델의 종류와 버전을 나타냅니다. 이들은 이미지의 스타일과 품질에 큰 영향을 미칩니다. 'model'을

Revolutionizing Journaling: A Look at NE-ILGI (SharePrompts), The Future of Personal Diary

  Revolutionizing Journaling: A Look at NE-ILGI (SharePrompts), The Future of Personal Diary Dive into the World of AI-Assisted Journaling with NE-ILGI (SharePrompts) 😊 Welcome, dear readers! 🎉 In this digital age, we're constantly finding ways to streamline our daily routines, and one such innovation is NE-ILGI, a delightful app under the moniker of SharePrompts. This revolutionary app is not just any diary-keeping platform, it's a world where AI becomes your personal scribe, friend, poet, rapper, and audience, bringing a whole new dimension to personal expression. If you're an avid diarist who's looking to add more depth and personalization to your daily reflections, or even if you're a newbie considering penning down your thoughts, NE-ILGI is the perfect partner to navigate this journey with. Imagine this: your words resonating with AI, influencing it to respond with insightful commentary. Let's dive in and explore this extraordinary universe of AI-powered