C++

UForm for C++

cmake -B build_release -D CMAKE_BUILD_TYPE=Release -D UFORM_BUILD_LIBRARIES=ON && cmake --build build_release && cmake --install build_release 4.0.0-rc.1 · c58749fe

Ask your coding agent about this page, or add the docs server to it

curl -s 'https://www.unum.cloud/docs/uform/cpp.md' | claude -p "How would this fit my code?"

The C++ SDK is a header-only layer over the stable C ABI in c/uform/, so it compiles no tower and links the same library C does.

It needs a C++23 compiler: GCC 15, Clang 22 with libstdc++ 15 or libc++ 22, Xcode 26 or VS 2026; CUDA code needs nvcc 13.5. Building from source needs CMake 4.3, or 4.4 with CUDA, which pip install cmake provides where the system package is older. It throws nothing: every call answers auto [value, status], and every handle is an RAII owner. Every verb is a batch, and every output whose length the call decides lands in an arena you reuse.

  • model_t encodes text, images, video and audio into pooled embeddings, per-token states and token vectors, and scores calibrated choices over text.
  • trainer_t trains one on GPUs, joined across hosts by a mesh_t.
  • executor_t owns the threads or streams every call runs on, apart from any model.

Topics

Installation1The SDK's headers call into the compiled library, so build and install it first from a checkout.
QuickstartEncode two captions and a photo into one space, then pick the caption closest to the photo.
Receivers and Deferred Calls12The receiver decides where a verb runs and how it completes, while the verb and its arguments stay the same.
Executors7An executor owns host threads or device streams, the activation scratch, and the pinned buffers staging passes through, grown to a high-water mark.
Arenas8Every output whose length only the call knows, the embeddings, the states and their offsets, lands in an arena_t you pass, and the verb answers views over it without copying.
Encoding18One verb per input form, each spelled as in C, and each taking its inputs, the encode_outputs_t to keep, a config, and last the arena.
Choices1text_choose(texts, choices, ..) scores each item's legal choices, one byte each, through one forward, and answers a tape_view<float> of one probability per choice that sums to one per item.
Models17model_t::load_ram and model_t::load_vram copy a safetensors checkpoint into host memory or onto GPUs, and load_ram_buffer and load_vram_buffer take the checkpoint's bytes instead.
Training9Training is GPU-only.
Errors3Every fallible call answers a status_t alone, or an expected<T>, a plain pair unpacked as auto [value, status], whose value is default-constructed on failure.
DesignThe architecture and conventions behind the library.