laitimes

AI "black talk" retraining, fine-tuning, RAG, and agents

author:The mountain monster Atu

Retraining, Fine-tuning, Retrieval-Augmented Generation (RAG), and Agent are essentially technical methods for tuning AI to adapt to specific tasks, with the former three using private data to customize AI large language models to enhance their core capabilities, and agents using prompt word engineering to make AI models perform specific tasks. Some of our common open-source AI large language models (LLMs), such as Google's Gemma, Meta's Llama, and Tsinghua Zhipu's ChatGLM, are pre-trained models that are suitable for a wide range of common tasks. If an enterprise needs AI to perform tasks suitable for its own business, or to customize an AI companion, it needs to use the above methods to train and customize it so that the LLM can perform specific tasks.

Why Tuning AI Models?

For economic and privacy considerations, it has become a trend for private individuals and enterprises to deploy their own private AI models. In order to make AI more suitable for various practical applications, it is necessary to use fine-tuning, retraining, retrieval augmented generation (RAG), and agent technologies to tune the AI general model.

For example, hospitals can use medical data to retrain AI models to make AI more suitable for the medical industry.

In the stock trading industry, data is dynamic and real-time, and regular fine-tuning of the model can improve its accuracy based on the latest data.

Enhanced Retrieval Generation (RAG) is equivalent to a database add-on for AI, or an attachment, that companies can use to search private knowledge bases or databases for user queries or questions to better understand and respond to users, ensuring that responses are more relevant and accurate, and reducing AI hallucinations.

AI agents, sometimes referred to as bots, have AI play or perform specific tasks. The AI characters and GPTs in Character.AI and OpenAI's GPTs are agents or bots.

These technologies allow AI models to adapt to different specific tasks, making them AI assistants across different industries and sectors.

Retraining

Retraining is the process of training an AI model from scratch. The retraining process of an AI model can be thought of as an entirely new training with an updated input dataset (any original dataset plus relevant new data). Retraining a model with all data at once typically improves core model capabilities compared to fine-tuning. This helps the model stay up-to-date and improve its capabilities, especially when there is something new to learn or the information it processes changes.

AI "black talk" retraining, fine-tuning, RAG, and agents

The diagram above illustrates how retraining works. It requires an AI model, the raw data it was trained on, and new data. It uses both raw and new data to train the model from scratch.

Fine tune

Fine-tuning is the process of making adjustments to a pretrained model using a new set of data. Imagine you have a customer service chatbot that uses a pre-trained large language model (LLM) such as ChatGPT or ChatGLM. The chatbot can answer customer inquiries. However, it is not aware of the company's internal policies and new product information, and the corresponding answers can only be gibberish. This is where fine-tuning can help. You can fine-tune your model with private data and let the AI learn new data to provide accurate answers to your customers.

AI "black talk" retraining, fine-tuning, RAG, and agents

The diagram above illustrates how fine-tuning works. It takes a pretrained model and a new (possibly private) dataset as input. Its output is a pre-trained model enhanced with additional knowledge.

Different from retraining AI models, which are time-consuming and require complex technical support, this should be the first and most economical technical solution for enterprises to deploy AI models privately.

RAG

Retrieval Enhanced Generation (RAG) introduces an additional layer where AI can dynamically retrieve information from external or internal data sources in real-time.

AI "black talk" retraining, fine-tuning, RAG, and agents

The diagram above illustrates how RAG works. RAG searches for relevant information fragments based on the user's question in advance, and then puts the search results into the context of the AI model, so that the AI can answer the question based on the search results. Behind RAG is a vector database and a complete set of information retrieval systems.

RAG is currently the fastest and most economical solution for enterprise customized AI, but the specific implementation technology of RAG is still in the exploration stage.

Agents

The concept of agents was first proposed by Stanford University and Google on April 7, 2023, and they published a research paper titled "Generative Agents: Interactive Simulacra of Human Behavior" on arXiv, a preprint library. Essentially, it is a method of using prompt word engineering, where the prompt words are preset for the AI to role-play or perform a specific task.

As mentioned earlier, which AI companions and roles in Character.AI and OpenAI's GPTs, as well as GPTs that perform various tasks, are agents. This is also the most common technology used by ordinary people to better use AI to perform tasks. As a simple agent, let's take one of Claude3's official templates, "Career Mentor Role", as an example:

<s> Syetem: You'll be working as an AI career coach called Joe, created by an AI career coaching company. Your goal is to provide career advice to users. You'll reply to users on the AI Career Coach Co. website, and if you don't reply as Joe, they'll be confused.

Here are some important interaction rules:

- Always stay true to yourself, just like the AI Joe of AI Career Coaching Company.

- If you are not sure how to answer, you can say: "I'm sorry, I don't understand." Can you rephrase your question?"

Here's the history of the conversation before the question was asked (between the user and you). If there is no history, it may be empty:

<history>

User: Hi, I hope you're in good health. I just wanted to let you know that I'm excited to start chatting with you!

Joe: Nice to meet you! I'm Joe, an AI career coach created by AI Career Coaching. What can I do for you today?

</history>

User: I've been reading about how AI is going to change everything, and I want to shift my career to AI. However, I didn't have any of the necessary skills. How do I convert?</s>

The technologies described above are not isolated from each other, they can complement each other to increase the core capabilities of the AI to perform specific tasks.

Read on