{"record":{"id":"df0c143e6603337c","repo":"sgl-project/sglang","slug":"cannot-collate-mixed-vla-noise-presence","errorCode":null,"errorMessage":"Cannot collate mixed VLA noise presence","messagePattern":"Cannot collate mixed VLA noise presence","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/vla/observation.py","lineNumber":55,"sourceCode":"    camera_order = tuple(first.metadata.get(\"camera_order\", ()))\n    images = {\n        name: torch.cat([obs.images[name] for obs in observations], dim=0)\n        for name in camera_order\n    }\n    image_masks = {\n        name: torch.cat([obs.image_masks[name] for obs in observations], dim=0)\n        for name in camera_order\n    }\n    states = [obs.state for obs in observations]\n    noises = [obs.noise for obs in observations]\n    if any(item is None for item in states) and not all(\n        item is None for item in states\n    ):\n        raise ValueError(\"Cannot collate mixed VLA state presence\")\n    if any(item is None for item in noises) and not all(\n        item is None for item in noises\n    ):\n        raise ValueError(\"Cannot collate mixed VLA noise presence\")\n    state = (\n        None\n        if states[0] is None\n        else torch.cat([item for item in states if item is not None], dim=0)\n    )\n    noise = (\n        None\n        if noises[0] is None\n        else torch.cat([item for item in noises if item is not None], dim=0)\n    )\n    return VLAObservationBatch(\n        prompt=[prompt for obs in observations for prompt in obs.prompt],\n        images=images,\n        image_masks=image_masks,\n        state=state,\n        noise=noise,\n        tokens=torch.cat([obs.tokens for obs in observations], dim=0),\n        token_masks=torch.cat([obs.token_masks for obs in observations], dim=0),","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/vla/observation.py#L37-L73","documentation":"Raised by collate_vla_observation_batches when a batch of VLA observations mixes observations that carry a noise tensor with observations whose noise is None. The collated noise must be either a single concatenated tensor or None for the whole batch, so partial presence is rejected.","triggerScenarios":"Calling run_grouped_requests with observations where some have obs.noise set (e.g. for diffusion-style action heads) and others have obs.noise=None.","commonSituations":"Partially enabling noise-conditioned action generation, mixing test seeds that supply noise with ones that do not, or default-initializing noise only on some code paths.","solutions":["Split the batch by noise presence and collate each subgroup separately","Supply explicit noise tensors (e.g. torch.randn with the right shape) for all observations in the group","Ensure the request builder always sets noise when the policy requires it"],"exampleFix":"// before\nbatch = collate_vla_observation_batches(obs_list)  # mixed noise presence\n// after\nnoisy = [o for o in obs_list if o.noise is not None]\ndeterministic = [o for o in obs_list if o.noise is None]\nbatches = [collate_vla_observation_batches(g) for g in (noisy, deterministic) if g]","handlingStrategy":"validation","validationCode":"noises = [o.noise for o in observations]\nif any(n is None for n in noises) and not all(n is None for n in noises):\n    raise ValueError(\"group mixes noise presence; split it first\")","typeGuard":"def group_has_uniform_noise(obs: list[VLAObservation]) -> bool:\n    presence = {o.noise is not None for o in obs}\n    return len(presence) == 1","tryCatchPattern":null,"preventionTips":["Always pass explicit noise tensors when using noise-conditioned action heads","Split batches by noise presence before collation"],"tags":["vla","diffusion-noise","batching","validation"],"backgroundTag":"mixed-none-values-in-batch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}