Fine-tuning a 350M Model for Better Structured Outputs in 100 GRPO Steps

Imported from official source

Research

AI Classified by Officially

Structured output is one of the most common real-world tasks for LLMs, yet most benchmarks fold it into broader reasoning or extraction scores rather than measuring it on its own. Whether a model reliably returns valid, parseable output in the requested format and shape — schema compliance — is often what decides whether it can be wired into a downstream system at all.

Note that the training pipeline described here is not the one used to train the RL model described in the IFStruct blog. This notebook doesn't aim to recreate the IFStruct benchmark score, but to show how task-specific fine-tuning of smaller models can improve performance and match that of far larger models.

This guide has two halves that run in different places:

  • Fine-tuning runs on a GPU. The accompanying notebook is sized for a free-tier Colab or Kaggle GPU.
  • Evaluation can run locally on a MacBook (here, a MacBook Pro with an Apple M5 Max and 36 GB of unified memory) through llama.cpp, which exposes an OpenAI-compatible server that the IFStruct evaluator talks to.
  • We will need uv for the Python tooling and llama.cpp for serving. Following the Liquid AI llama.cpp deployment docs, install llama.cpp with Homebrew and verify that llama-server is available:

    brew install llama.cpp
    llama-server --version
    

    IFStruct Evaluation on LFM2.5-350M (Base model)

    Before we begin, let's evaluate LFM2.5-350M on the IFStruct benchmark and see whether we can reproduce the reported score of 21.1%.

    IFStruct is a benchmark for testing the validity of LLM outputs and schema adherence. The benchmark is open-source in Liquid4All/ifstruct, with the public benchmark dataset available on Hugging Face at LiquidAI/ifstruct-v1.0.

    git clone https://github.com/Liquid4All/ifstruct.git
    

    For the eval comparison, we serve the model locally on the MacBook with llama.cpp. We will use the BF16 GGUF (LiquidAI/LFM2.5-350M-GGUF).

    Then we start the base-model server with the following command:

    This is an extract. The publication continues at the source.

    Read the original at the source: https://huggingface.co/blog/grpo-with-trl-ifstruct

    Officially imported this from Hugging Face’s own source and shows an extract. If you work there, claiming the profile and verifying the domain lets you choose to show the full text here.

    Provenance

    Organization
    Hugging Face — imported from official source
    Official source
    https://huggingface.co/blog/feed.xml RSS
    Imported
    September 15, 2026 19:08
    Versions
    1 recorded
    Identity
    https://huggingface.co/blog/grpo-with-trl-ifstruct

    Officially records where a publication came from, not whether it is true. Imported records are reproduced from an organization's own official source.