# Logfire Insight Relay

A callback library for Hugging Face's Trainer that forwards training events, such as loss and epoch boundaries, to an observability backend through Pydantic Logfire, without a training script needing to be modified or a custom callback subclass written for each project.

Logfire Insight Relay sits between a Hugging Face Trainer session and an observability backend as a pluggable relay rather than a one-off callback subclass. A user declares which training events matter, such as on_log, on_epoch_end or on_train_begin, through a declarative subscription model, and the relay forwards each one enriched with contextual metadata, while the Trainer itself stays unaware that anything is listening.

Metadata attached to each event includes a session identifier that groups retries of the same run, a checkpoint lineage for tracing how a model evolved across checkpoints, an environment fingerprint such as Python version, GPU model and library versions, and derived metrics such as learning-rate decay percentage and gradient norms.

It integrates with Hugging Face Transformers and the Trainer callback system, and forwards events to Pydantic Logfire.

Website: https://github.com/neminov4030034/logfire-trainer-trace
