ROSAME
ROSAME learns lifted STRIPS action models (the preconditions and effects of every action schema) from traces of states and actions. States may be probabilistic (each proposition true with some probability, for example the output of a classifier or a noisy sensor) as well as symbolic, and the model is a PyTorch module, so it can be trained jointly with a perception network end to end.
- Learns from traces whose object sets differ and whose lengths differ, batched on CPU or GPU.
- Robust to noise: the learned model is a probability over roles for every lifted literal.
- Reads PDDL domains and problems, and writes learned models as PDDL or JSON.
- Depends only on PyTorch.
ROSAME was introduced in Neuro-Symbolic Learning of Lifted Action Models from Visual Traces (Xi, Gould and Thiébaux, ICAPS 2024).
Installation
pip install rosame
ROSAME needs PyTorch 2.0 or later. To use a GPU, install the PyTorch build for your platform first, following pytorch.org.
The planning structures (Domain, Instance, ActionModel, Trace, ...) come from
planning-structs, which is installed with ROSAME
and imported as planning_structs.
Quickstart
import rosame
from planning_structs import Trace
# 1. The domain: types, predicates and action signatures. Preconditions and effects are what we learn,
# so the PDDL may leave them empty (any present are ignored for learning).
pddl = rosame.io.read_pddl_domain("""
(define (domain switches)
(:requirements :strips :typing)
(:types switch - device room device)
(:predicates (powered) (robot-at ?r - room) (in ?d - device ?r - room) (connected ?a ?b - room)
(on ?s - switch) (off ?s - switch))
(:action move :parameters (?from ?to - room) :precondition (and) :effect (and))
(:action turn-on :parameters (?s - switch ?r - room) :precondition (and) :effect (and))
(:action turn-off :parameters (?s - switch ?r - room) :precondition (and) :effect (and)))
""")
# 2. Traces: objects, T + 1 states and T actions. Each trace may use different objects.
static = ["(powered)", "(in s1 r2)", "(connected r1 r2)", "(connected r2 r3)", "(connected r3 r1)"]
traces = [
Trace(objects=[("r1", "room"), ("r2", "room"), ("r3", "room"), ("s1", "switch")],
states=[static + ["(robot-at r1)", "(off s1)"],
static + ["(robot-at r2)", "(off s1)"],
static + ["(robot-at r2)", "(on s1)"],
static + ["(robot-at r2)", "(off s1)"]],
actions=["(move r1 r2)", "(turn-on s1 r2)", "(turn-off s1 r2)"]),
# ... more traces, with other rooms and switches
]
# 3. Learn, then inspect or save the model.
result = rosame.learn(pddl.domain, traces)
print(result.action_model)
result.model.to_pddl(pddl_domain=pddl, path="learned.pddl") # keeps your parameter names
States can be given as sets of true atoms (above), as {atom: probability} dictionaries, or as
tensors of probabilities over the trace's propositions:
Trace(objects, states=[{"(robot-at r1)": 0.94, "(on s1)": 0.12, "(off s1)": 0.85}, ...], actions=[...])
Three ways to use ROSAME
The package is layered; use the level that fits your project.
1. rosame.learn: train on traces in one call (above). Options cover the loss
hyperparameters, early stopping, device and memory budget; see the user guide.
2. Your own training loop with the building blocks, for example to train a perception model
jointly. The grounder turns a batch of traces with different object sets into index tensors; ROSAME
grounds the whole batch at once; ROSAMELoss is the objective of the paper.
from rosame import Grounder, ROSAME, ROSAMELoss
grounder, model = Grounder(domain), ROSAME(domain)
loss_fn = ROSAMELoss(prior_weight=0.2, endpoint_weight=1.0, reduction="transition")
optimizer = torch.optim.Adam(list(model.parameters()) + list(perception.parameters()), lr=1e-3)
batch = grounder.collate(objects_per_trace, actions_per_trace) # in your DataLoader's collate_fn
states = perception(images) # [B, T + 1, P_max] probabilities
pre, add, dele = model(batch) # [B, T, P_max], padding is 0
loss = loss_fn(pre, add, dele, states[:, :-1], states[:, 1:], batch)
loss.backward(); optimizer.step()
3. The model alone. ROSAME(batch) returns grounded precondition / add / delete probabilities for
every proposition of every transition. Use any objective you like.
Data formats
| Form | |
|---|---|
| objects | [("r1", "room"), ("s1", "switch"), ...], including any domain constants the states use |
| atom | "(in s1 r2)", "in s1 r2", ("in", "s1", "r2") or ("in", ("s1", "r2")) |
| state | iterable of true atoms, {atom: probability}, or a tensor [P] |
| action | an atom-like call such as "(move r1 r2)", or None for an unknown action (that step is skipped) |
| proposition order | Grounder(domain).instance(objects).propositions, needed only for tensor states |
Traces can be stored as JSON lines (rosame.io.read_traces_jsonl / write_traces_jsonl), and
domains as PDDL or as a JSON specification (rosame.io.read_domain_json).
What ROSAME assumes
STRIPS with typing: positive preconditions, add and delete effects, and every literal of an action schema refers only to the action's parameters (no constants), each parameter bound to a distinct object. A literal plays exactly one of four roles: none, add effect, precondition, or precondition and delete effect. Transitions whose action repeats an object are skipped. The user guide explains these assumptions and their consequences in detail.
Documentation
- User guide: concepts, data, batching, the loss and its hyperparameters, learning options, PDDL/JSON input and output, joint training with perception, troubleshooting.
- Changelog and contributing guide.
Code for the papers
The code used for each paper is kept unchanged on its own branch and tag:
| Paper | Branch | Tag |
|---|---|---|
| Neuro-Symbolic Learning of Lifted Action Models from Visual Traces (ICAPS 2024) | paper/icaps24 |
icaps24 |
| Learning Lifted Action Models from Unsupervised Visual Traces (ICAPS 2026) | paper/icaps26 |
icaps26 |
The icaps24 tag marks the code exactly as published; the paper/icaps24 branch also contains
later fixes.
Citation
@inproceedings{xgt:24,
author = {Kai Xi and Stephen Gould and Sylvie Thi{\'{e}}baux},
title = {Neuro-Symbolic Learning of Lifted Action Models from Visual Traces},
booktitle = {Proceedings of the 34th International Conference on Automated Planning and Scheduling ({ICAPS}-24)},
year = {2024},
pages = {653-662}
}
@inproceedings{xgt:26,
author = {Kai Xi and Stephen Gould and Sylvie Thi{\'{e}}baux},
title = {Learning Lifted Action Models from Unsupervised Visual Traces},
booktitle = {Proceedings of the 36th International Conference on Automated Planning and Scheduling, ({ICAPS}-26)},
year = {2026}
}
License
See LICENSE.
Metadata
Release files for rosame 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rosame-0.2.0.tar.gz | 44.6 kB | With provenance | Details for rosame-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rosame-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for rosame-0.2.0-py3-none-any.whl |
Total release size: 78.1 kB
Release files / rosame-0.2.0.tar.gz
| Download URL | rosame-0.2.0.tar.gz |
|---|---|
| Size | 44.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9861e43f240c0bb3ff5d5cd384ed7a40595747fb95f12416aea4c228e3c9593f
|
|
BLAKE2b-256 checksum How to use checksums |
863dbce50d86db092e736b55d391aee9e63dc648494414774bb5ed76cbfd0f07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logRelease files / rosame-0.2.0-py3-none-any.whl
| Download URL | rosame-0.2.0-py3-none-any.whl |
|---|---|
| Size | 33.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f4872d5abe82049cbf04d08142585455f31026b6270cb8a3bf610bee554b7dfd
|
|
BLAKE2b-256 checksum How to use checksums |
5180e1332b5bc15a2f9fcd43bb10ea0dd272df1d7d51c2639b94200f4a82430c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logSecurity for rosame 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for rosame-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.