IKH

Enhancing LLM Capabilities with Chain-of-Thought

In the next few sessions, we will discuss two popular prompt engineering techniques, namely, a ‘few-shot’ prompting and ‘chain-of-thought’ prompting.

Let’s hear more about this from the SME.

In the video, Kshitij mentioned two main techniques: chain-of-thought prompting and few-shot prompting.

Such prompting techniques are sometimes referred to as in-context learning (ICL). Such techniques allow a model to generalise and learn from a few examples to understand the output for a specific task or domain without the need for extensive fine-tuning, which can often be costly and is used as a last resort if you are not able to get the desired outputs solely through prompt engineering. You will learn more about fine-tuning LLMs in the upcoming weeks.

The various techniques that fall under in-context learning are as follows:

  • Zero-shot prompting.
  • Few-shot prompting.
  • Chain-of-thought prompting.
  • ReAct prompting

The zero-shot prompting technique is the simplest approach, in which no examples are given to the model. Instead, the model relies on its pre-training on vast amounts of data to generate coherent and relevant content for tasks or concepts they have never been explicitly trained on. The model uses high-level instructions or prompts provided by users to guide its generation process. These prompts can include a description of the desired task or specific instructions for generating content related to that task. So far, we have been using the zero-shot prompting technique to generate good model outputs. 

Chain-of-thought (CoT) prompting technique refers to the process of reasoning and making decisions in a way that has been proved to produce good model outputs when working with LLMs like ChatGPT. It involves sequentially building upon and connecting different thoughts, ideas, and information to arrive at a desired outcome or solution.

CoT prompting enables complex reasoning capabilities through intermediate reasoning steps. It enables a deeper exploration of complex questions and problems, facilitating a more comprehensive and informed decision-making process. This prompting technique, however, requires a thoughtful and iterative approach. The user must break down a complex task into a series of steps or instructions for the model to follow, actively engage with and evaluate the model’s responses, make the prompts concise, and, if required, incorporate external knowledge and context.

Let’s hear more about chain-of-thought prompting from the SME. The prompt used in the video can be downloaded here.

Chain-of-thought prompting is a powerful prompting technique that can generate responses that are more natural, coherent, and creative. This technique allows for a more intuitive and efficient interaction, as users can rely on their chain-of-thoughts to guide the model’s responses, rather than having to start from scratch with each prompt.

Additionally, chain-of-thought prompting can help to avoid common issues in prompt engineering, such as vague or confusing prompts, by providing a clear and coherent framework for users to work within. In the video above, we saw that just by introducing the phrase ‘Let’s think step-by-step’, the model is able to provide accurate responses even in a zero-shot setting, without any few-shot examples.

It must also be noted about the salient differences between Zero-Shot-CoT and Few-Shot-CoT. Both techniques are variants of the Chain-of-Thought technique. However, in the case of Zero-Shot-CoT, we use the phrase ‘Let’s think step by step’ and rely wholly on the model’s pre-training to generate the output whereas for Few-Shot-CoT, the model analyses the given text, the key concepts, entities, and relationships in the few-shot examples to generate prompts that are relevant to the task at hand. We will learn more about Few-Shot-CoT technique in the upcoming segment.

The chain-of-thought prompting technique requires a deep understanding of the LLM capabilities and the various prompt engineering techniques covered earlier in the session. Once the prompts have been thoroughly vetted and perfected for their responses, the chain-of-thought prompting approach ensures significantly improved and coherent response compared to traditional prompting techniques, particularly for reasoning and contextual understanding problems.

In the next segment, we will explore another prompting paradigm known as the ‘few-shot’ prompting. Combined together, chain-of-thought and few-shot techniques can result in better performance of LLMs.

Additional Readings:

  • On this site, the author explains the paradigms within CoT with a few examples: Chain-of-thought prompting.
  • In this paper, the authors explore reasoning capabilities of LLMs using the CoT technique: Chain-of-Thought Prompting Elicits Reasoning in Large Language Models.
  • In this paper, the authors compare the performance of Zero-shot-CoT vs. Zero-shot prompting: Large Language Models are Zero-shot Reasoners.

Report an error