Giter Site home page Giter Site logo

finetune_llms's Introduction

Finetuning Large Language Models (LLMs)

Task Complexity and Reasoning

  1. Identify Complex Tasks: Before finetuning, it's essential to identify tasks that require heavy reasoning and complex problem-solving abilities.

  2. Try Existing LLMs: Start by evaluating the performance of existing LLMs like GPT-3.5 or LLAMA on the task. If the model performs satisfactorily, there is no need for finetuning.

Considerations Before Finetuning

Finetuning LLMs requires significant effort, time, and computational resources. It can also lead to overfitting and worse performance if not done carefully. Before proceeding with finetuning, consider the following approaches:

1. Few-shot Learning

  • Provide the LLM with a small number of examples (usually 1-6) that demonstrate the desired task.
  • Gradually increase the number of examples, typically up to 6, until the model's performance is satisfactory. After around 6 examples, most of the time it does not improve further. (depend on task and model)
  • Also, need to consider that when increasing the number of examples, the token count and context length also matter.

2. Prompting Techniques

  • Prefix Prompting: Prepend the input with a task-specific prefix or instruction.
  • Demonstration Prompting: Provide examples of the desired input-output mapping as part of the prompt.
  • Chain-of-Thought Prompting: Encourage the LLM to break down complex tasks into a series of intermediate reasoning steps.

3. Retrieval-Augmented Generation (RAG)

  • Combine the LLM's language generation capabilities with a separate retrieval component (e.g., a dense vector index or database).
  • The LLM can use the retrieved information from external sources to generate more informed and knowledge-grounded outputs.
  • RAG models are particularly useful for open-ended question-answering or tasks that require domain-specific knowledge.

If these techniques do not yield satisfactory results, proceed to the finetuning phase.

Finetuning Phase

Finetuning can create a specialized model tailored for the task at hand. In some cases, finetuning alone may not be sufficient. For example:

  • Medical Applications: The language used in medical contexts differs from common usage. To capture the nuances and terminology, it may be better to start with pretraining on domain-specific data.
  • Case Study: BloombergGPT: This model was pretrained on 51% financial data and 49% common usage data to better understand financial language and concepts.

By following these steps and considering various techniques, you can make an informed decision on whether to finetune an LLM or explore alternative approaches for your specific task.

finetune_llms's People

Contributors

pamudu123 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.