Interacting with Large Language Models: A Survey of Techniques

Andavan Ivan
7 min readAug 19, 2023

Introduction

Large language models (LLMs) are neural networks that can generate natural language texts based on some input, such as a prompt, a query, or a context. LLMs have shown remarkable capabilities in various natural language processing (NLP) tasks, such as text summarization, question answering, dialogue generation, and text completion. However, interacting with LLMs can be challenging, as they often require careful tuning of parameters, such as temperature, top-k, and top-p, to control the quality and diversity of the generated texts. Moreover, LLMs can sometimes produce nonsensical, irrelevant, or even harmful outputs, due to their lack of common sense, world knowledge, or ethical awareness. Therefore, it is important to develop effective and reliable techniques for interacting with LLMs, that can help users achieve their desired goals and avoid potential pitfalls.

In this document, we provide an overview of four different techniques for interacting with LLMs, with examples and appropriate use cases for each. The techniques are:

· Direct Ask: Asking a direct question to the LLM and expecting a direct answer.

· Chain of Thought: Providing a sequence of prompts and queries to LLM and following its generated responses.

· Self-Ask: Asking a question to the LLM and then automating a follow-up question based on its answer.

· Forward-Looking Active REtrieval augmented generation (FLARE): Generating a text with the LLM and then retrieving relevant information from external sources to augment the text.

Current Innovation State

In recent years, several techniques have been proposed and developed for interacting with LLMs, that aim to improve the user experience and the output quality. These techniques can be broadly categorized into four types, based on the mode and the direction of the interaction: direct ask, chain of thought, self-ask, and forward-looking active retrieval augmented generation (FLARE). Each of these techniques has its own advantages and disadvantages and can be suitable for different use cases and scenarios. In this document, we will provide an overview of each of these techniques, with examples and appropriate use cases for each. We will also mention some other advanced techniques that can be used for interacting with LLMs, other than the four listed ones, and conclude with some suggestions for further reading.

Explanation of Each Technique Along with Examples

Direct Ask: This is the simplest and most common technique for interacting with LLMs, where the user directly asks a question or provides a prompt, and the LLM generates a response or a continuation. This technique can be useful for tasks that require a short and specific answer, such as factoid question answering, text completion, or text summarization. For example, the user can ask “Who is the president of France?” or “Summarize the main points of this article” or “Complete the sentence: She walked into the room and saw …”, and the LLM will generate an appropriate response. However, this technique can also have some limitations, such as: the LLM may not be able to answer complex or open-ended questions, the LLM may generate inconsistent or contradictory responses, or the LLM may generate harmful or offensive responses.

Chain of Thought: This is a technique where the user and the LLM engage in a conversational or a collaborative interaction, where the LLM generates a response based on the previous input and output, and the user can provide feedback or guidance to the LLM. This technique can be useful for tasks that require longer and more coherent text, such as dialogue generation, story writing, or brainstorming. For example, the user can start a conversation with LLM by saying “Hi, I’m looking for some ideas for my next blog post. Can you help me?” or “Let’s write a story together. You start.” or “What are some interesting topics to research on?”, and the LLM will generate a response that follows the input and the output. The user can then continue the interaction by providing more input or feedback, such as “That’s a good idea. Can you tell me more about it?” or “I like that. How about we add a twist?” or “That sounds boring. Can you suggest something else?”. However, this technique can also have some challenges, such as: the LLM may lose track of the context or the goal, the LLM may generate irrelevant or repetitive responses, or the LLM may generate responses that are not aligned with the user’s preferences or expectations.

Self-Ask: This is a technique where the user and the LLM switch roles, and the LLM asks questions or provides prompts to the user, and the user generates a response or a continuation. This technique can be useful for tasks that require more active and creative involvement from the user, such as learning, teaching, or self-reflection. For example, the user can ask the LLM to generate a question or a prompt for them, such as “What is something you learned today?” or “Write a paragraph about your favorite hobby” or “How do you feel right now?”, and the user will generate an appropriate response. The LLM can then provide feedback or guidance to the user, such as “That’s interesting. Why do you think that?” or “That’s a good paragraph. Can you improve it by adding more details?” or “That’s a valid emotion. How can you cope with it?”. However, this technique can also have some difficulties, such as: the LLM may generate questions or prompts that are too easy or too hard, the LLM may generate questions or prompts that are not relevant or interesting, or the LLM may generate feedback or guidance that are not helpful or supportive.

Forward-Looking Active Retrieval Augmented Generation (FLARE): This is a technique where the LLM generates a response or a continuation based on the input and the output, but also retrieves and incorporates relevant information from external sources, such as the web, databases, or knowledge graphs. This technique can be useful for tasks that require more accurate and informative text, such as factual question answering, text summarization, or text generation. For example, the user can ask a question or provide a prompt, such as “What are the benefits of meditation?” or “Summarize the latest news on the COVID-19 pandemic” or “Write a biography of Albert Einstein”, and the LLM will generate a response that includes relevant information from external sources, such as “Meditation can help reduce stress, improve focus, and enhance well-being. According to a study by Harvard University, meditation can also change the structure of the brain and increase the gray matter density in areas related to learning, memory, and emotion regulation.” or “The COVID-19 pandemic has caused more than 200 million infections and 4 million deaths worldwide, as of August 2021. The World Health Organization (WHO) has declared it a public health emergency of international concern and has recommended various measures to prevent and control the spread of the virus, such as wearing masks, social distancing, and vaccination. Several vaccines have been developed and approved for emergency use, and more than 4 billion doses have been administered globally, as of August 2021.” or “Albert Einstein was a German-born physicist who developed the theory of relativity, one of the pillars of modern physics. He is best known for his mass-energy equivalence formula E = mc2, which has been dubbed as the world’s most famous equation. He received the Nobel Prize in Physics in 1921 for his discovery of the photoelectric effect. He was also a pacifist, a humanitarian, and a supporter of civil rights movements. He died in 1955 at the age of 76, leaving behind a legacy of scientific and philosophical contributions.” However, this technique can also have some drawbacks, such as: the LLM may not be able to retrieve or incorporate relevant information from external sources, the LLM may generate responses that are plagiarized or biased, or the LLM may generate responses that are not coherent or consistent.

Other Techniques Not in the Four Listed Ones

Besides the four techniques mentioned above, there are some other advanced techniques that can be used for interacting with LLMs, such as:

Multi-Modal Interaction: This is a technique where the user and the LLM can interact using multiple modalities, such as text, speech, image, video, or audio. This technique can be useful for tasks that require a richer and more diverse input and output, such as image captioning, video summarization, or audio generation. For example, the user can provide an image or a video as an input, and the LLM can generate a text or a speech as an output, or vice versa. The user can also provide a text or a speech as an input, and the LLM can generate an image or a video as an output, or vice versa.

Meta-Learning Interaction: This is a technique where the user and the LLM can interact using meta-learning, which is a form of learning that enables the LLM to learn from its own learning process and adapt to new tasks and domains. This technique can be useful for tasks that require a more flexible and generalizable LLM, such as few-shot learning, transfer learning, or lifelong learning. For example, the user can provide a few examples of a new task or a new domain as an input, and the LLM can generate a response or a continuation that is adapted to the new task or the new domain, or vice versa. The user can also provide feedback or guidance to LLM to improve its meta-learning performance.

Explainable Interaction: This is a technique where the user and the LLM can interact using explainability, which is a form of transparency that enables the LLM to provide explanations for its generated outputs and its internal mechanisms. This technique can be useful for tasks that require more trustworthy and understandable LLM, such as decision making, debugging, or evaluation. For example, the user can ask the LLM to explain why it generated a certain output or how it works internally, and the LLM can generate a response that provides an explanation in a human-readable and understandable way, or vice versa. The user can also provide feedback or guidance to the LLM to improve its explainability.

Conclusion and Further Exploration:

In this document, we have provided an overview of the four different techniques for interacting with LLMs, with examples and appropriate use cases for each, and also mentioned some other advanced techniques that can be used for the same purpose. We hope that this document can help users to better understand and utilize the potential and the limitations of LLMs, and to achieve their desired goals and avoid potential pitfalls.

For further exploration, we recommend you get hands-on experience to see how to code these different prompting techniques. This sample is written in python and uses both OpenAI and Azure OpenAI to explore

--

--