Using Multiple Models For Multiple Tasks

**I’m trying to finetune a model to perform a variety of different tasks. **

The tasks are all related, but still distinct.

Together, they form an AI tutor which can produce educational content (this in itself involves quite a few different types of function call), and interact with users (chat and mark tests).

Some of the function calls are:

1.Plan course
2.Plan units
3.Plan lessons
4.Make lesson content
5.Mark user tests

The model is also expected to be able to chat with users.

The question I’m wrestling with, is whether to split these tasks up to be carried out by different models?

i.e. I’d have a model trained to make lesson content, a model trained to mark tests etc…

Or just train one model to carry out all of those tasks?

What are your opinions?

2 Likes

I have a similar app that make a course content based on user preferences ,and need some help about training the model , I tried to fine tune the model several time and still get a very bad result
could you provide me some tips please :smiling_face_with_tear: :innocent: :pray: :pray:

I think you will get better result if you divide the task among multiple models, each one optimized to do one task very well. There is also a pattern evolving where you provide a goal and the system will automatically create agents and tasks based on it. This is more experimental. But the multi agent part you can use tools like langgraph to orchestrate the different agents

1 Like

Makes sense. I suppose my only hesitation about using multiple models is the emergence of disparity between the tone of outputs from different models. That being said, even when you use just one model, and train it perform a selection of different tasks, I feel it doesn’t really abstract out patterns from the examples as a whole. It just learns how to do each task you are training it to do individually and separately.

Interesting!

Sorry I don’t have an answer for you , but the whole architecture sounds cool, and I hope it’s ok to ask a clarifying question about it :sweat_smile::
You plan to have one model to chat with users, and initiate function calls when needed, and then a separate fine tuned model (or several) to perform the work of those function call?

Would be cool to follow up on what you learned.
Good luck!

Yeah no worries. To answer you’re question, not exactly…

The first part of your question was correct. I (at least for the moment) have one fine tuned model which chats with users, and initiates function calls. But I’m thinking that might be a bit much for one model to handle :sweat_smile:

So I might instead train multiple models to carry out each of those tasks separately. Does that make sense?

I’ll let you know how it goes…

Thanks :slight_smile:
I guess I didn’t understand the architecture then… the model initiates those function calls and then you call it again to perform them?
You plan to replace the one model with multiple parallel ones? How will you know which one to call?

Hi, from my experience, each of those should be fine tuned to produce text content. Then an assistant model (most likely fine tuned) to call functions if/when necessary to call the models above.

Personally, I would not hesitate to split each of the above tasks into sub tasks and train a separate model for each of the sub tasks.

The assistant model seems like a good idea.

I’ve just got one question:

The course, units, etc are json objects. In this case, would it be better to try and get the model to produce text in JSON format, or just make it call a function, forcing the output to be in json?

That’s about right.

I would probably use an assistant model to pick what function to call, and then I would call that function which would produce the relevant output.

1 Like

Personally, I use models to produce raw text for 2 reasons:

  1. Safer from the code base point of view
  2. If model needs to produce JSON, means at least 2 distinct key value pair - probably I’m wrong in my approach as it looks like there might be at least 2 distinct tasks to get the output I need, so fine tuning separate models for those tasks usually is the best approach (quality + modularity of the system)

Sometimes old vanilla code performs better than assistant, but without the full drawing board hard to tell

Multi models you mean GPT and others like Gemini, Claude?

No I mean multiple finetuned gpt 3.5 models

1 Like

Basically open AI models, but if taken that approach, nothing prevents you from using models from other vendors

2 Likes

If your course, units have a defined schema, it may be better to create a pydantic object and use it as a pydantic output parser to create a JSON output.