Skip to content

Conversation

@eoinfennessy
Copy link
Contributor

What does this PR do?

Closes #3708

Scaffolds the fine_tuning API. This is intended to be an OpenAI compatible API that may allow us to deprecate our post-training API. No providers have been implemented / migrated. Current conformance summary is provided below.

OpenAI Fine-Tuning API Conformance Summary

Conformance Score: 88.1% (63 schema issues, 1 missing property, 0 breaking changes)

✅ Implementation Status

6 Endpoints Implemented:

  • POST /v1/fine_tuning/jobs - Create fine-tuning job
  • GET /v1/fine_tuning/jobs - List fine-tuning jobs
  • GET /v1/fine_tuning/jobs/{id} - Retrieve fine-tuning job
  • POST /v1/fine_tuning/jobs/{id}/cancel - Cancel fine-tuning job
  • GET /v1/fine_tuning/jobs/{id}/checkpoints - List job checkpoints
  • GET /v1/fine_tuning/jobs/{id}/events - List job events

OpenAI-Compatible Models:

  • FineTuningJob - Core job object with all OpenAI fields
  • FineTuneMethod - Supports supervised, DPO, and reinforcement methods
  • FineTuningJobHyperparameters - Training configuration with auto defaults
  • FineTuningJobEvent - Job logging and events
  • FineTuningJobCheckpoint - Training checkpoints

🔧 Key Technical Details

Nullable Field Handling:

  • Applied nullable_openai_style for required nullable fields (e.g., finished_at, error, validation_file)
  • Applied remove_null_from_anyof for optional non-nullable fields (e.g., hyperparameters, seed, organization_id)
  • Ensures OpenAPI 3.0 compatibility while maintaining functional equivalence

Breaking Changes: None (verified with oasdiff)

📊 Remaining Issues (Non-Breaking)

The 63 remaining issues are format/representation differences that don't affect API functionality:

  • ~30 issues: Nullable field format differences (anyOf vs nullable: true - functionally equivalent)
  • ~12 issues: Hyperparameter union representation differences
  • ~10 issues: Default value improvements (better UX)
  • ~8 issues: Optional field representation
  • ~3 issues: Other minor format differences

1 Missing Property: metadata query parameter on GET /fine_tuning/jobs (FastAPI doesn't support deepObject style parameters natively)

🎯 Conformance Strategy

Prioritized functional compatibility over strict format matching:

  • All request/response types match OpenAI's structure
  • No breaking changes for API consumers
  • Format differences are benign (different valid representations of the same schema)

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 28, 2026
@mergify
Copy link

mergify bot commented Jan 28, 2026

This pull request has merge conflicts that must be resolved before it can be merged. @eoinfennessy please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs-rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce fine_tuning API

1 participant