Training is GPU-only. uform_mesh_bootstrap joins this process to a run once, through files in a directory every host sees, and after it processes talk only over NVLink and InfiniBand.
The mesh is the process-wide half of the transport, which every trainer borrows; uform_mesh_describe reports the topology every process agreed on, its multimem tier, and the gpu_class every GPU of the run dispatches as, the executor’s pin or the devices’ own.
Every process bootstraps with the same count, multicast extent, directory, job and GPU class, or the call reports uform_status_config_mismatch_k.
uform_trainer_init_vram makes a trainer on a VRAM executor, owning one replica of the tower per device, its gradients, the Adafactor moments, the reconstruction heads and the learnable temperatures.
One uform_trainer_step is one optimizer step over this process’s share of the global batch: forward, the losses, backward, the world gradient reduction, and the update.
Items arrive tagged with a uform_modality_t, grouped into bags that travel together, with attract, repel and ignore relations indexing the step’s own items.
Beside the masked and pooled contrastive losses, a trainer relaxes two optional terms, each read when its weight is positive:
late_interaction trains the token head with hard MaxSim scores between the items each step’s sides names a query, a document or both.
choices trains the byte decoder on the legal bytes each step’s choices tape gives, the tape uform_text_choose reads, and their target probabilities in the choice_targets tape, shaped as the probabilities it lands, within the batch’s max_choices_per_item.
uform_pair_loss_form_t picks how a contrastive term turns a row of scores into forces: balanced, ranked or SigLIP’s sigmoid, where derived keeps sigmoid for pooled embeddings and ranked for token vectors.
The step’s stats report every loss as its world mean, with late_interaction_loss and choices_loss beside the contrastive and masked terms, the items truncated at a row’s width, and the segments dropped whole for want of room.
A training call that fails after a GPU recorded a fault, such as a peer missing a multimem barrier or an InfiniBand round past its deadline, carries that fault as its outcome message. uform_trainer_save writes the safetensors checkpoint the model verbs load.
Every path, the mesh’s directory, a resume checkpoint and a save’s path, arrives as the operating system’s own bytes, not necessarily UTF-8, and one holding a NUL byte is refused with uform_status_invalid_argument_k; the mesh’s job is a UTF-8 name.
uform_pair_loss_form_tHow a contrastive term turns a row of scores into forces, mirroring the trainer's pair-loss forms; zero keeps the term's own form: sigmoid for pooled vertices, ranked for token vectors.
The optional Matryoshka prefix widths, strictly ascending, each a multiple of 8, at most 8 of them, every one scored; NULL scores the full width alone.
matryoshka_dimensions_count
size_t
Entries in matryoshka_dimensions.
temperature_groups
size_t
Learnable (inverse temperature, bias) pairs, one per group a step's items select; one.
inverse_temperature
float
The starting inverse temperature of every group; 10 under the sigmoid form, SigLIP's, else 1.
bias
float
The starting logit bias of every group; −10 under the sigmoid form, SigLIP's, else zero.
uform_late_interaction_tHow the late-interaction loss scores the per-token vectors of query and document segments; every zero derives the default named.
The pair loss over each query's row of hard MaxSim scores; ranked.
uform_late_interaction_side_tWhich side of a late-interaction score an item takes, mirroring the trainer's sides: a query's tokens score a document's, and a symmetric pair plays both.
The floor the cosine settles at; zero derives 1e-5.
warmup_steps
size_t
Steps from zero to the peak; zero derives a tenth of steps, at most 400.
steps
size_t
Steps the run takes across resumes, which the cosine spans; zero is refused.
uform_trainer_tA training run: the tower replicas, gradients, optimizer moments, heads, temperatures and the collectives sized by them, on the executor's devices.
The step's count + 1 non-decreasing offsets into ids, in host memory; NULL names no edges.
ids
uint32_t const *
Item i links to items ids[offsets[i]] up to ids[offsets[i+1]], indices into the step's items, ascending within each run.
weights
float const *
The optional weight of each edge, paired with ids; NULL weighs every edge one.
uform_relations_view_tThe contrastive targets of one step, resolved per pair in this order: a pair ignore names is skipped, one attract names pulls together, one repel names pushes apart, and every other pair follows the run's negatives.
The optimizer step the call applied, counted from one across resumes.
learning_rate
float
The learning rate it applied.
loss
float
The total loss the step minimized.
contrastive_loss
float
The contrastive term; zero when the objective is masked alone.
masked_text_loss
float
The text reconstruction term, before its weight; zero when absent.
masked_image_loss
float
The image reconstruction term, before its weight; zero when absent.
masked_video_loss
float
The video reconstruction term, before its weight; zero when absent.
masked_audio_loss
float
The audio reconstruction term, before its weight; zero when absent.
late_interaction_loss
float
The late-interaction term, weighted; zero when absent.
choices_loss
float
The choices term over the items that made a choice, before its weight; zero when absent.
truncated
size_t
Items cut at a row's width.
dropped
size_t
Segments dropped whole because the batch had no room for them, since the last step that read its stats.
Functions
uform_trainer_init_vramBuilds one replica per device, the NVLink domain its consumers reserve over the mesh, and starts or resumes the run; every process of the run calls it with the same geometry, objective and seed.
The items' bytes, one entry each, of uform_scalar_u8_k: UTF-8 text or an encoded file, as modalities tags it.
bagsuint32_t const *
The optional bag of each item, count of them in host memory; items sharing a bag land on one device.
temperature_groupsuint32_t const *
The optional temperature group of each item, count of them in host memory, each below the run's temperature_groups; NULL puts every item in group zero.
The optional legal choices of each item, one byte each, uform_scalar_u8_k, as uform_text_choose_t reads them; NULL offsets make no choices, and an item offering none makes none.
The target probability of each choice, uform_scalar_f32_k, in choices order, as uform_text_choose_t lands its probabilities: each item's entry as long as its entry of choices, summing to one.
The optional report; NULL skips it, and with it the readback of the losses.
uform_trainer_saveWrites the weights and the step, which uform_model_load_vram and its siblings serve and uform_trainer_init_vram resumes; only the process of index zero writes, the rest return at once.