Skip to content

ligand_conditioning is a pure assertion, not a gate -- real ligand tensors are injected regardless of its value #114

Description

@maraxen

Finding

SamplingSpecification.ligand_conditioning does not gate anything. In _sampling_helper.py::_prepare_ligand_context (~:277-290):

if Y is None or Y_t is None or Y_m is None:
    if spec.ligand_conditioning:
        raise ValueError("ligand_conditioning=True requires ligand context tensors ...")
    Y = jnp.zeros(...)  # placeholder
    ...

ligand_conditioning is only consulted to decide whether to RAISE when ligand tensors are absent. If real tensors ARE present (via ligand_context_path, or already on the batch), they are injected into the bundle regardless of ligand_conditioning's valueligand_conditioning=False with real tensors present still gets real ligand conditioning; there is no code path where this field actually suppresses ligand context that would otherwise be there.

Impact

A caller who explicitly sets ligand_conditioning=False expecting an unconditioned ablation, but who (directly or via a campaign row) also has ligand_context_path set or ligand tensors already on the batch, silently gets full ligand conditioning anyway. Conversely ligand_conditioning=True with no tensors present correctly raises — so the field behaves like a one-directional assertion, not a two-way switch.

Found during the 260715/260716 aminx campaign control-knob audit (same investigation that produced #110/#111/#113), while checking which declared knobs actually gate their claimed behavior.

Recommendation

Either make ligand_conditioning=False actually zero out/ignore real tensors when present (so it's a genuine ablation switch), or rename/document the field as what it currently is (a presence-assertion, not a conditioning toggle) so callers don't rely on it to suppress ligand context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions