Is Fine-tuning gpt-4o-mini compatible with Structure-outputs?

Hi everyone!

I am working on a project where given a text as input, i need to extract several fields in JSON format.

This is a fake example to understand my issue
“I want to find a cheap and reliable car for 2000” → {“object”: “car”, “price”: 2000", “status”: “reliable”}

I have been able to train both gpt3.5 turbo and gpt-4o-mini, and both are working great.

However, sometimes the models hallucinate, adding new fields that they haven’t seen before. I need to find some way to limit the generated fields.

For that reason, i ended up in this post, where Structure-Output where released.
https://platform.openai.com/docs/guides/structured-outputs

However, after using my Structure JSON Output with my gpt-4o-mini-finetune model, i see some new fields generated that are not in the JSON template.

I also tried that Structure-output with the base gpt-4o-mini model (without fine-tuning), and in this case it worked.

So my question is, are structure-output actually working with custom fine-tuned models?

Thanks in advance :slight_smile:

2 Likes

I have seen the same pattern here, seeing refusal=None, while the output doesn’t follow the expected json format

I’m wondering the same thing. There is still nothing in the documentation, the fine tuning UI or the fine tuning API that suggests structured outputs are supported for fine tuning.

I’m using pydantic as recommended, so the only way I can think of would be to convert the pydantic model to json and include it in the training JSONL file using response_format={ "type": "json_schema".

Has anyone been able to get it to work?