Skip to content

Point Cloud Foundation Models: Fine-tuning Sonata and Utonia for Segmentation

Published: at 06:55 PMSuggest Changes

In the PointNet++ post we built a segmentation network from scratch and trained it end to end. That is still the best way to understand point-based learning, but in 2026 it is no longer the best starting point for a real project. Self-supervised point cloud foundation models such as Sonata (Meta, CVPR 2025) and Utonia (Pointcept, ICML 2026) ship pre-trained Point Transformer V3 (PTv3) encoders whose features are already semantically meaningful. Instead of learning geometry from zero, you attach a small head and fine-tune. In this guide we load both encoders, turn their hierarchical output into per-point features, run a linear probe and a full fine-tune on a LiDAR dataset, and set up an honest comparison against a PointNet++ baseline.

Table of Contents

Open Table of Contents

Why Foundation Models for Point Clouds

Labeling point clouds is expensive. Annotating a single square kilometer of aerial LiDAR point by point can take days, and indoor datasets like ScanNet or S3DIS took years to assemble. Models trained from scratch, like PointNet++, need a lot of that labeled data before they generalize.

Foundation models change the economics. They are pre-trained with self-supervised objectives on large collections of unlabeled scans, so they learn generic geometric and semantic structure (planes, edges, object parts, “this region looks like vegetation”) without any labels. Downstream you only need enough labels to map those features to your classes.

The Sonata paper illustrates the effect with linear probing: freezing the encoder and training only a single linear layer on top. On ScanNet semantic segmentation, Sonata reports linear-probe accuracy rising from 21.8% to 72.5% mIoU, and, with only 1% of the ScanNet training labels, an improvement from 25.8% to 45.3% mIoU. Those are the authors’ numbers, not something we reproduce here, but they explain why the field is moving away from training point networks from scratch.

Sonata and Utonia in a Nutshell

Both projects share the same building blocks:

The differences that matter in practice:

AspectSonataUtonia
PaperCVPR 2025ICML 2026
GoalReliable self-supervised point featuresOne encoder for all point cloud domains
Hugging Facefacebook/sonataPointcept/Utonia
Model namessonatautonia, utonia_small, utonia_tiny
Python packagesonatautonia
Weights licenseCC-BY-NC 4.0CC-BY-NC 4.0

Utonia builds on Sonata (and Concerto) and is explicitly trained to work across indoor scans, outdoor LiDAR, objects and robotic manipulation data, which makes it the more natural choice for aerial or mobile LiDAR. The code for both is Apache 2.0, but the weights are non-commercial because of the datasets used in pre-training. Check this before you build a product on them.

Installation

Both repositories offer a standalone conda environment (CUDA 12.4, PyTorch 2.5.0) and a “package mode” for embedding the model in your own code. For a fine-tuning project, package mode is the right choice. Install PyTorch and CUDA first, then the sparse and attention dependencies:

# Adjust cu124 / torch versions to match your environment
pip install spconv-cu124
pip install torch-scatter -f https://data.pyg.org/whl/torch-2.5.0+cu124.html
pip install git+https://github.com/Dao-AILab/flash-attention.git  # optional
pip install huggingface_hub timm

# Install the encoders as packages
git clone https://github.com/facebookresearch/sonata.git
cd sonata && python setup.py install && cd ..

git clone https://github.com/pointcept/utonia.git
cd utonia && python setup.py install && cd ..

# Utilities for this tutorial
pip install "laspy[lazrs]" open3d "numpy==1.26.4"

FlashAttention is optional. If it is not available, both libraries accept a custom_config that disables it, which we handle in the loading code below. NumPy is pinned to 1.26.4 because the repositories note that Open3D does not yet support NumPy 2.x in their setup.

Loading the Pre-trained Encoders

Weights are downloaded from Hugging Face on first use and cached under ~/.cache/sonata/ckpt or ~/.cache/utonia/ckpt (override with download_root). Let’s write one helper that loads either encoder and falls back gracefully when FlashAttention is missing:

import importlib.util

import torch


def has_flash_attn() -> bool:
    return importlib.util.find_spec("flash_attn") is not None


def load_encoder(name: str = "utonia", device: str = "cuda"):
    """Load a pre-trained PTv3 encoder from Sonata or Utonia."""
    flash = has_flash_attn()

    if name.startswith("utonia"):
        import utonia

        # Utonia reads the architecture from the checkpoint; only flash changes
        custom_config = None if flash else dict(enable_flash=False)
        model = utonia.model.load(
            name, repo_id="Pointcept/Utonia", custom_config=custom_config
        )
    elif name == "sonata":
        import sonata

        # Sonata's README also reduces the patch size when flash is disabled
        custom_config = (
            None
            if flash
            else dict(enc_patch_size=[1024 for _ in range(5)], enable_flash=False)
        )
        model = sonata.model.load(
            "sonata", repo_id="facebook/sonata", custom_config=custom_config
        )
    else:
        raise ValueError(f"Unknown encoder: {name}")

    return model.to(device)

utonia_small and utonia_tiny are lighter variants. Their feature widths differ from the base model and are read from the checkpoint automatically, which is why our segmentation head below infers its input size instead of hard-coding it.

Preparing LiDAR Tiles

Our running example is an aerial LiDAR dataset in LAS/LAZ format with ASPRS classification codes. If you need a refresher on the format, see Introduction to .LAS and .LAZ Point Cloud Formats; for tiling large surveys, Processing Point Clouds with PDAL shows how to split them with filters.splitter.

Reading Points and Labels

The encoders expect coord, color and normal. LAS files rarely contain normals, so we estimate them with Open3D. We also remap ASPRS codes to a compact set of training classes and center each tile so coordinates are small:

import laspy
import numpy as np
import open3d as o3d

# ASPRS code -> training class (everything else is ignored)
ASPRS_TO_CLASS = {2: 0, 3: 1, 4: 1, 5: 1, 6: 2, 9: 3}  # ground, veg, building, water
CLASS_NAMES = ["ground", "vegetation", "building", "water"]
IGNORE_INDEX = -1


def estimate_normals(coord: np.ndarray, radius: float = 1.0) -> np.ndarray:
    pcd = o3d.geometry.PointCloud(o3d.utility.Vector3dVector(coord))
    pcd.estimate_normals(
        o3d.geometry.KDTreeSearchParamHybrid(radius=radius, max_nn=30)
    )
    pcd.orient_normals_to_align_with_direction([0.0, 0.0, 1.0])
    return np.asarray(pcd.normals, dtype=np.float32)


def load_tile(path: str) -> dict:
    las = laspy.read(path)
    coord = np.vstack([las.x, las.y, las.z]).T.astype(np.float64)
    coord -= coord.mean(axis=0)  # center the tile
    coord = coord.astype(np.float32)

    if {"red", "green", "blue"} <= set(las.point_format.dimension_names):
        # LAS stores 16-bit color; the transforms expect 0-255
        color = np.vstack([las.red, las.green, las.blue]).T / 256.0
    else:
        color = np.zeros_like(coord)  # the READMEs recommend zero-filling
    color = color.astype(np.float32)

    lut = np.full(256, IGNORE_INDEX, dtype=np.int64)
    for code, cls in ASPRS_TO_CLASS.items():
        lut[code] = cls
    segment = lut[np.asarray(las.classification, dtype=np.int64)]

    return dict(
        coord=coord,
        color=color,
        normal=estimate_normals(coord),
        segment=segment,
    )

Missing channels should be zero-filled rather than dropped, because the input layer of the pre-trained encoder expects a fixed number of feature channels.

The Transform Pipeline

Utonia exposes a convenience utonia.transform.default(...). Its first argument, scale, controls granularity (larger values give finer results); the official outdoor demo uses 0.2 with apply_z_positive=False. For Sonata, the default pipeline is sonata.transform.default(); the README’s explicit pipeline uses GridSample with grid_size=0.02, which reflects its indoor-scale training data:

import utonia
import sonata


def build_transform(name: str):
    if name.startswith("utonia"):
        # Outdoor LiDAR: no z-positive shift, coordinates not normalized
        return utonia.transform.default(
            0.2, apply_z_positive=False, normalize_coord=False
        )
    return sonata.transform.default()

The scale value is a hyperparameter worth tuning for your sensor and point density. The default pipelines include GridSample, which returns the inverse index we rely on to map predictions back to every original point.

From Hierarchical Output to Per-Point Features

Calling the encoder returns the coarsest level of the hierarchy. To get one feature vector per (grid-sampled) point, walk back through pooling_parent links, concatenating each level’s features with the upsampled child features. This is exactly what the official segmentation demos (demo/2_sem_seg.py in both repositories) do before applying their linear head:

def upcast_features(point):
    """Walk up the pooling hierarchy, concatenating features at each level."""
    while "pooling_parent" in point.keys():
        parent = point.pop("pooling_parent")
        inverse = point.pop("pooling_inverse")
        parent.feat = torch.cat([parent.feat, point.feat[inverse]], dim=-1)
        point = parent
    return point

The resulting point.feat has one row per voxel produced by GridSample. Indexing with point.inverse maps it back to the original points, so we can compute the loss against the original labels.

Before training anything, it is worth running the PCA visualization demos from either repository on one of your tiles (for example python demo/7_pca_outdoor.py in Utonia). If roofs, trees and ground show up as distinct colors in the PCA projection, the features already separate your classes and a small head will do well.

Building the Segmentation Model

We wrap encoder and head into one nn.Module. The head uses nn.LazyLinear, so its input width is inferred on the first forward pass, regardless of which encoder variant we load:

import torch.nn as nn


class FoundationSegmenter(nn.Module):
    def __init__(self, encoder, num_classes: int, head: str = "linear"):
        super().__init__()
        self.encoder = encoder
        if head == "linear":
            self.head = nn.LazyLinear(num_classes)
        else:
            self.head = nn.Sequential(
                nn.LazyLinear(256),
                nn.LayerNorm(256),
                nn.GELU(),
                nn.Dropout(0.1),
                nn.Linear(256, num_classes),
            )

    def forward(self, data_dict: dict) -> torch.Tensor:
        point = self.encoder(data_dict)
        point = upcast_features(point)
        feat = point.feat[point.inverse]  # (N_original, C)
        return self.head(feat.float())

Remember that LazyLinear must see one batch before you build the optimizer, otherwise its parameters are still uninitialized. We do that warm-up in the training script.

Moving a Sample to the GPU

The transforms return a dict of tensors and metadata. Following the READMEs, we move only the tensors:

def to_device(data_dict: dict, device: str = "cuda") -> dict:
    for key, value in data_dict.items():
        if isinstance(value, torch.Tensor):
            data_dict[key] = value.to(device, non_blocking=True)
    return data_dict


def prepare(sample: dict, transform, device: str = "cuda"):
    labels = torch.from_numpy(sample["segment"]).to(device)
    # Copy the arrays: some transforms modify them in place (see below)
    data = {k: v.copy() for k, v in sample.items() if k != "segment"}
    data = to_device(transform(data), device)
    return data, labels

We keep the original labels outside the transform and compare them against feat[point.inverse], so the training code does not depend on which keys each library’s Collect step keeps.

The .copy() is not optional. Several Pointcept-style transforms write into the input arrays instead of returning new ones: Utonia’s RandomScale does data_dict["coord"] *= scale, and CenterShift subtracts in place. Because we keep the tiles in memory and transform them again on every step, skipping the copy would shrink the stored coordinates by a factor of 0.2 each time a tile is used, until every point collapses into the same voxel. The official demos never hit this because they transform each cloud only once.

Strategy 1: Linear Probing

Linear probing freezes the encoder and trains only the head. It is fast, needs little memory and tells you how good the pre-trained features are for your classes:

def configure_linear_probe(model: FoundationSegmenter):
    model.encoder.eval()
    for p in model.encoder.parameters():
        p.requires_grad = False
    return torch.optim.AdamW(model.head.parameters(), lr=1e-3, weight_decay=0.01)

Because no gradients flow through the encoder, you can even pre-compute and cache features to disk, then train the head on CPU in seconds. That makes linear probing an excellent first experiment and a cheap way to compare Sonata, Utonia and the smaller Utonia variants on your data.

Strategy 2: Full Fine-tuning

When the probe plateaus, unfreeze the encoder. The key rule is to update the pre-trained weights much more gently than the freshly initialized head, otherwise you destroy the representations you came for. Parameter groups with different learning rates handle this:

def configure_finetune(model: FoundationSegmenter, base_lr: float = 2e-3):
    model.encoder.train()
    for p in model.encoder.parameters():
        p.requires_grad = True
    return torch.optim.AdamW(
        [
            {"params": model.encoder.parameters(), "lr": base_lr * 0.1},
            {"params": model.head.parameters(), "lr": base_lr},
        ],
        weight_decay=0.05,
    )

A common middle ground is to freeze the early stages and only fine-tune the last encoder blocks, which reduces memory and overfitting on small datasets. Inspect model.encoder.named_parameters() to choose which blocks to unfreeze.

Measuring mIoU

Before writing the training loop, we need a validation metric. We use mean IoU over the full-resolution points, accumulating a confusion matrix across all validation tiles so that large tiles weigh more than small ones:

@torch.no_grad()
def evaluate(model, tiles, transform, num_classes=len(CLASS_NAMES)):
    model.eval()
    conf = torch.zeros(num_classes, num_classes, dtype=torch.long, device=DEVICE)

    for sample in tiles:
        data, labels = prepare(sample, transform, DEVICE)
        with torch.autocast("cuda", dtype=torch.bfloat16):
            preds = model(data).argmax(dim=-1)

        valid = labels != IGNORE_INDEX
        idx = labels[valid] * num_classes + preds[valid]
        conf += torch.bincount(idx, minlength=num_classes**2).view(
            num_classes, num_classes
        )

    tp = conf.diag().float()
    union = conf.sum(0).float() + conf.sum(1).float() - tp
    present = union > 0
    return (tp[present] / union[present]).mean().item()

GridSample in mode="train" picks a random point per voxel with NumPy, so two evaluations of the same model can differ slightly. For final numbers, call np.random.seed(0) before evaluate() so the voxel sampling, and therefore the metric, is repeatable across runs.

The Training Loop

Point clouds have a different number of points per tile, so the simplest robust approach is one tile per step with gradient accumulation. (Both libraries support batching several clouds by concatenating them and adding a batch index key, but one tile per step keeps the code short.) We train in bfloat16 autocast, which FlashAttention requires anyway, and use per-point cross-entropy that skips unlabeled points:

import math
import random
from pathlib import Path

DEVICE = "cuda"
ENCODER = "utonia"  # or "utonia_small", "utonia_tiny", "sonata"
STRATEGY = "linear"  # or "finetune"
NUM_EPOCHS = 30
ACCUM_STEPS = 4

# One LAS/LAZ file per tile, already split into train and val folders
train_paths = sorted(Path("data/train").glob("*.la[sz]"))
val_paths = sorted(Path("data/val").glob("*.la[sz]"))

train_tiles = [load_tile(p) for p in train_paths]
val_tiles = [load_tile(p) for p in val_paths]

transform = build_transform(ENCODER)
encoder = load_encoder(ENCODER, DEVICE)
model = FoundationSegmenter(
    encoder,
    num_classes=len(CLASS_NAMES),
    head="linear" if STRATEGY == "linear" else "mlp",
).to(DEVICE)

# Materialize the LazyLinear weights before creating the optimizer
with torch.no_grad(), torch.autocast("cuda", dtype=torch.bfloat16):
    model(prepare(train_tiles[0], transform, DEVICE)[0])

if STRATEGY == "linear":
    optimizer = configure_linear_probe(model)
else:
    optimizer = configure_finetune(model)

steps_per_epoch = math.ceil(len(train_tiles) / ACCUM_STEPS)
scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(
    optimizer, T_max=NUM_EPOCHS * steps_per_epoch
)
criterion = nn.CrossEntropyLoss(ignore_index=IGNORE_INDEX)

for epoch in range(NUM_EPOCHS):
    model.head.train()
    if STRATEGY == "finetune":
        model.encoder.train()
    random.shuffle(train_tiles)

    for step, sample in enumerate(train_tiles):
        data, labels = prepare(sample, transform, DEVICE)
        with torch.autocast("cuda", dtype=torch.bfloat16):
            logits = model(data)
        loss = criterion(logits.float(), labels) / ACCUM_STEPS
        loss.backward()

        # Step every ACCUM_STEPS tiles, and on the last tile of the epoch so
        # leftover gradients never leak into the next epoch
        if (step + 1) % ACCUM_STEPS == 0 or step + 1 == len(train_tiles):
            torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=1.0)
            optimizer.step()
            scheduler.step()
            optimizer.zero_grad(set_to_none=True)

    val_miou = evaluate(model, val_tiles, transform)
    print(f"epoch {epoch:02d}  val mIoU {val_miou:.3f}")

Note that the transform is applied on every step, which is why prepare() copies the arrays first. The default pipelines add very little randomness: Utonia’s RandomScale receives scale=[s, s], so it always multiplies by the same factor (it acts as a unit conversion, not an augmentation), and the only random part is GridSample in mode="train", which picks a different point inside each voxel on every call. If your dataset is small, add real augmentations such as random rotation around the z axis, random flips and jitter to a custom Compose pipeline for training only. Gradient clipping and mixed precision are covered in more detail in Advanced Techniques in PyTorch.

Comparison with PointNet++

To know whether a foundation model is worth its extra complexity, train the PointNet2Seg model from the PointNet++ post on the same tiles, the same class mapping and the same validation split, and report the same evaluate metric. Then compare along the axes that actually drive the decision:

QuestionHow to measure it
Accuracy with all labelsVal mIoU of PointNet++ vs. linear probe vs. full fine-tune
Label efficiencyRepeat with 1%, 10% and 100% of training tiles
Per-class behaviorPer-class IoU, especially rare classes such as water
Training costTrainable parameters and GPU hours to convergence
Inference costPoints per second and peak GPU memory on a full tile
LicensingCan you ship CC-BY-NC weights? If not, PointNet++ (or your own pre-training) wins by default

The label-efficiency curve is where foundation models usually shine, and it is exactly what the Sonata paper’s 1% ScanNet experiment measures. Do not assume that result transfers to your sensor: aerial LiDAR with sparse points and no color is different from dense RGB-D indoor scans, which is why measuring on your own data matters.

Practical Tips

Conclusion

Point cloud foundation models shift semantic segmentation from “design and train a network” to “pick an encoder and adapt it.” Sonata and Utonia give you pre-trained Point Transformer V3 encoders with a simple dict-in, features-out interface. With a few dozen lines of PyTorch you can upcast their hierarchical features to every point, attach a lazily sized head, and train it either as a cheap linear probe or a full fine-tune with differential learning rates. PointNet++ is still the clearest way to understand point-based learning and a necessary baseline, but measuring both on your own tiles, especially with few labels, will tell you quickly whether a foundation model belongs in your LiDAR pipeline. Just remember to check the non-commercial license on the weights before you ship.

References


Next Post
Agent Skills Meet MCP: Exposing Your Python Tools as Reusable Skills