Skip to content

Fine-Tuning FLOPs Meter: Measure LLM Compute for EU AI Act Compliance

AINewss Editorial Team

The Fine-Tuning FLOPs Meter is an open-source AWS toolkit that measures compute used to fine-tune a language model and compares it with European Commission thresholds. This guide covers the one-third rule, three threshold scenarios, the analytical and hardware formulas, enabling tracking with one SageMaker flag, and reading the flops_meter.json audit file, plus the limits of what the tool can prove.

View 1 reference
0 views 0 likes

Allow the functional cookie to save your likes. Privacy details

A conceptual illustration of an AI training job producing a FLOPs measurement report beside European compliance threshold lines.

What is the Fine-Tuning FLOPs Meter?

The Fine-Tuning FLOPs Meter is an open-source toolkit that measures the floating-point operations consumed by a language-model fine-tuning job and compares them with regulatory thresholds. It runs inside SageMaker AI training as a Hugging Face callback, then writes a JSON audit record to Amazon S3 and DynamoDB.

AWS published the toolkit in its Amazon SageMaker Generative AI recipes repository and documented it in a Machine Learning Blog post dated 30 November 2026. The tool answers one practical question with a single configuration flag: did this fine-tuning job use enough compute to change its regulatory status? It is built for teams training models on managed infrastructure who need a repeatable record rather than a spreadsheet estimate.

Why does the EU AI Act care about fine-tuning FLOPs?

Under the EU AI Act, a modifier becomes a provider of a general-purpose AI model only when the change significantly alters the model's generality, capabilities, or systemic risk. The Commission's guidelines use training compute as an indicator: more than one-third of the original training compute. The guidelines are not law, but the Commission bases enforcement on them.

The one-third test is a proxy for a harder question. A small adapter trained for a few hours is unlikely to create a new model with new risks, while a large retraining campaign may do exactly that. The AWS post notes that most organisations fall into the scenario where pretraining compute is unknown, because model providers rarely publish exact training FLOPs.

Which FLOPs threshold applies to my fine-tune?

Three scenarios set the threshold. If pretraining compute is known and at least 10^23 FLOPs, the limit is 30 percent of that figure. If it is unknown or below 10^23 FLOPs, the default is 3.3×10^22 FLOPs. Systemic-risk models trained above 10^25 FLOPs use 3.3×10^24 FLOPs when the base figure is unknown.

Scenario Threshold
Pretraining compute known and ≥ 10^23 FLOPs 30% of actual pretraining compute
Pretraining compute unknown or < 10^23 FLOPs 3.3×10^22 FLOPs (default)
Systemic-risk base model, ≥ 10^25 FLOPs 3.3×10^24 FLOPs if base compute unknown

The meter selects the scenario automatically from whether you supply the PRETRAIN_FLOPS environment variable. If you omit it, the default path applies. The European Commission also assessed the voluntary General-Purpose AI Code of Practice, published in July 2025, as an adequate way for providers to demonstrate compliance.

How does the Fine-Tuning FLOPs Meter calculate FLOPs?

The toolkit computes FLOPs two ways. The analytical method counts non-padding tokens and applies an architecture-aware formula that accounts for full, LoRA, and Spectrum tuning. The hardware method monitors GPUs through NVIDIA's management library and assumes full utilisation, giving a conservative upper bound. The JSON labels the two figures Flops_architecture and Flops_hardware.

At training start, the callback captures total and trainable parameter counts. During training it counts non-padding tokens at each substep and aggregates them across GPUs. At the end it computes the architecture figure from tokens and parameters, stops GPU monitoring for the hardware bound, selects a threshold, and writes the result. AWS recommends the architecture figure as the primary compliance metric; the hardware figure is a safety margin.

How do I enable FLOPs tracking on SageMaker AI?

Enabling tracking takes one configuration line. Clone the Amazon SageMaker Generative AI recipes repository, add compute_flops: true to a training recipe, optionally export a PRETRAIN_FLOPS value, and launch the job with the SageMaker Python SDK. The callback then runs during training and uploads its JSON output when the job finishes.

  1. Clone the repository. Use git clone https://github.com/aws-samples/amazon-sagemaker-generativeai.git.
  2. Edit the recipe. Add compute_flops: true to a file such as hf_recipes/meta-llama/Llama-3.2-3B-Instruct--vanilla-peft-qlora.yaml.
  3. Set pretraining compute if known. For example, export PRETRAIN_FLOPS="1.5e24" for Llama-3-70B. Skip this if the base model card does not document it.
  4. Launch and collect. Run the training job, then read flops_meter.json from the S3 output location.
model_name_or_path: meta-llama/Llama-3.2-3B-Instruct
use_peft: true
compute_flops: true
per_device_train_batch_size: 8
num_train_epochs: 10

Prerequisites listed by AWS are an AWS account with SageMaker AI access, a configured CLI, Python 3.11 or later, and familiarity with Hugging Face Transformers and PyTorch.

What does flops_meter.json contain?

The flops_meter.json file records both compute estimates, the model and instance details, the threshold rule chosen, and a boolean saying whether the job exceeded it. AWS recommends Flops_architecture as the primary figure because it reflects the actual recipe. Flops_hardware is a safety margin. The file is copied to S3 and DynamoDB for audit trails.

A representative AWS example for a Llama-3.2-3B LoRA job reports Flops_architecture of 1.45e+13, Flops_hardware of 1.52e+15, a threshold type of default_3.3e22, and exceeds_30pct set to false. It also records N_total, N_trainable, token count, GPU model, instance type, job name and training duration. The pipeline's output-processing step persists the same record to DynamoDB.

{
  "Flops_architecture": "1.45e+13",
  "Flops_hardware": "1.52e+15",
  "threshold_type": "default_3.3e22",
  "exceeds_30pct": false,
  "tokens_processed": 2150,
  "gpu_name": "NVIDIA A10G"
}

What are the limits of FLOPs-based compliance?

The tool measures compute; it does not issue legal advice. The thresholds come from Commission guidelines rather than the Act itself, and crossing one does not automatically make an organisation a provider — it signals a case that needs assessment. The hardware estimate assumes full GPU use, and the result depends on the PRETRAIN_FLOPS value you supply.

Scope is also worth stating plainly. The meter covers compute tracking during fine-tuning on SageMaker AI; it does not decide classification, write legal filings, or assess the separate question of whether a modification meaningfully changes a model. Treat the JSON as evidence for an internal review, not as a determination. AWS also documents cleanup steps for stopping jobs and removing S3 and DynamoDB records so the walkthrough does not leave charges running.

Frequently asked questions about the Fine-Tuning FLOPs Meter

These questions cover installation, threshold selection, and how to interpret the numbers. They are drawn from the toolkit's documented workflow and are meant to help engineers decide which figure to report and when a result needs a legal review rather than a quick conclusion.

Do I need to know my base model's pretraining FLOPs?

No. If you omit PRETRAIN_FLOPS, the meter applies the 3.3×10^22 FLOPs default. Setting a documented value from the model card switches it to the 30-percent path for models above 10^23 FLOPs, which is usually more precise.

Can I use the meter outside SageMaker AI?

The toolkit is open source and is distributed through the SageMaker Generative AI recipes repository, but AWS documents the TrainerCallback integration and the ProcessTrainingOutputs upload step as part of a SageMaker pipeline. Reusing it elsewhere means wiring your own storage and audit persistence.

Which FLOPs number should I report?

AWS recommends Flops_architecture because it reflects your actual training configuration. Flops_hardware is a conservative upper bound based on 100 percent GPU utilisation and is useful as a safety margin for cautious reporting.

Does exceeding the threshold make me a provider automatically?

No. The AWS post states that crossing a threshold triggers case-by-case assessment rather than a legal reclassification. The guidelines are indicative criteria, and the Commission says it will base enforcement on them.

References

  1. Navigating EU AI Act requirements for LLM fine-tuning on Amazon SageMaker AIaws.amazon.com