Generative AI -Opportunities and Challenges
ChatGPT and Generative AI are no more buzz words for anyone!!
Generative AI can do lots of fantastic tasks for example, it can write the optimize code for you, it can create amazing and unique image based on your text input, it can understand and summarize articles and many more.... People have already started using ChatGPT, Google Bard which are examples of Generative AI. It is based on Large Language Model (LLM).
What is LLMs?
Large language models (LLMs) have generated much hype in recent months. LLMs are trained on vast corpus of data and also called Foundation models (FMs).
Foundation models are different from traditional machine learning models. As Mahine learning models is trained on specific set of data and able to accomplish specific task. On the other hand, Foundation model is trained on vast amount of data and single FM model is able to accomplish multiple tasks. For example, A foundation model can generate and summarize the text as well as extract the information.
These FMs are pre trained on vast amount of data and very large in size. These models are built using deep learning?in?natural language processing (NLP) and predict the probability of next generation words in sequence. These models can be fine tune on domain specific data (relatively small dataset) to get the better performance.
Chances:
Generative AI is taking AI to the next level and generating lots of new business opportunities. LLM models, such as PaLM, ChatGPT have been shown to achieve outstanding performance on a variety of natural language processing tasks.
Challenges:
Along with chances and opportunities, there are many challenges to adopt and fine tune these models.
Consumption of LLMs
We need to understand, despite of multiple challenges with LLMs, why they are getting so much popularity and how companies are consuming and creating LLM powered Applications?
领英推荐
As An API:
It’s quite expensive to build and train your own Large Language Models. Most people prefer to use a pre-trained model like Hugging Face which are accessible using API.
LLMs are available as an API which can be used directly for any NLP task without training.
When calling the API, we need to pass in some parameters, like temperature, p_token, Prompt and so on. Prompt is where you can describe to the model what you want it to do.
For example, you can get OpenAI key and execute its API:
import opena
from langchain import PromptTemplate
from langchain.llms import OpenAI
openai.api_key = "<API KEY>"
llm = OpenAI(openai_api_key=openai.api_key , temperature=0)
def get_completion(Loc):
? template = """ I want to travel {location}.what should I do there? respose in one short sentence """
? prompt = PromptTemplate(input_variables=["location"],template=template, ?)
? final_prompt = prompt.format(location=Loc)
? response = llm(final_prompt)
? return response
get_completion('india')
Fine Tuning with Prompt Engineering: LLMs output depends on the Prompt. By giving correct and brief prompt, you can get desired output from LLMs. You can also provide instructions in prompt to get the desired output.
Fine tune LLMs with Parameters: You can also get desired output by fine tuning LLMs parameters. for example, if you are looking for unique content, you can make temperature parameter as 1 and if you are looking most frequent content as LLM output, you can make temperature parameter as 0.
Fine Tune LLMs with one and few shots: Companies can get the more accurate output in desired format with few shots.In few shots, you can provide few examples. LLM will understand these examples and return the output in same format as given in few shots.
Building LLMs from Base Model: ?Companies can leverage pre-trained transformer models (public or Proprietary) for example, Hugging face, AI21 lab that are already trained on a large corpus of data in a self-supervised fashion. This raw model can be further fine-tuned on a specific downstream task.
Happy Learning!!