SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2505.16732 · NeurIPS · 2025

Sequential Monte Carlo for Policy Optimization in Continuous POMDPs

Sahel Iqbal, Simo Särkkä, Hany Abdulsamad

arXiv · PDF · Open in the Atlas

Code that ran

15 of 44 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (8 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 8 have no contract verdict; 6 failures of our instrument; 29 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2505.16732.json · badge: /api/ran/2505.16732.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
Sahel13/particle-pomdp community
Papers with Code archive
15 ran · 29 no recorded run
FunctionStatusWhere it lives
AttentionPolicy Ran
ran on a synthesized input · constructed an object; no result was computed
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("17abe752f04b80a8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, AttentionPolicy: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
import jax.numpy as jnp
from jax import random
from flax.core import FrozenDict
from typing import Dict, Any
import chex

PRNGKey = chex.PRNGKey

def dummy_init(rng_key: PRNGKey, particle_dim: int, action_dim: int, batch_size: int, num_particles: int) -> Dict[str, Any]:
    """Initialize dummy parameters for attention policy."""
    return {
        'w': jnp.ones((action_dim, particle_dim)),
        'b': jnp.zeros(action_dim)
    }

def dummy_reset(batch_size: int) -> None:
    """Reset attention policy state."""
    return None

def dummy_sample(rng_key: PRNGKey, particles: jnp.ndarray, weights: jnp.ndarray, params: Dict[str, Any]) -> tuple:
    """Sample from attention policy."""
    batch_size = particles.shape[0]
    num_particles = particles.shape[1]
    action_dim = params['w'].shape[0]
    
    actions = random.normal(rng_key, (batch_size, action_dim))
    info = jnp.ones((batch_size,))
    
    return actions, info

def dummy_log_prob(actions: jnp.ndarray, particles: jnp.ndarray, weights: jnp.ndarray, params: Dict[str, Any]) -> jnp.ndarray:
    """Compute log probability."""
    batch_size = actions.shape[0]
    log_probs = jnp.zeros(batch_size)
    return log_probs

def dummy_sample_and_log_prob(rng_key: PRNGKey, particles: jnp.ndarray, weights: jnp.ndarray, params: Dict[str, Any]) -> tuple:
    """Sample and compute log probability."""
    batch_size = particles.shape[0]
    action_dim = params['w'].shape[0]
    
    actions = random.normal(rng_key, (batch_size, action_dim))
    log_probs = jnp.zeros(batch_size)
    info = jnp.ones((batch_size,))
    
    return actions, log_probs, info

def dummy_entropy(params: Dict[str, Any]) -> jnp.ndarray:
    """Compute entropy."""
    return jnp.array(0.5)

ARGS = {
    'dim': 4,
    'init': dummy_init,
    'reset': dummy_reset,
    'sample': dummy_sample,
    'log_prob': dummy_log_prob,
    'sample_and_log_prob': dummy_sample_and_log_prob,
    'entropy': dummy_entropy,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
chex, flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AttentionPolicy — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AttentionPolicy output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
BeliefInfo Ran
ran on a synthesized input · constructed an object; no result was computed
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("fbcd88c48e6bee65")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, BeliefInfo: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax.numpy as jnp
from jax import random
import numpy as np

# Create small test arrays for BeliefInfo
key = random.PRNGKey(0)

# Essential statistics - shape (2, 4)
ess = jnp.ones((2, 4), dtype=jnp.float32)

# Mean - shape (4,)
mean = jnp.array([1.0, 2.0, 3.0, 4.0], dtype=jnp.float32)

# Covariance matrix - shape (4, 4)
covar = jnp.eye(4, dtype=jnp.float32)

ARGS = {
    'ess': ess,
    'mean': mean,
    'covar': covar,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BeliefInfo — the run constructed an instance of its own class and did not call it; no shape is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
BeliefState Ran
ran on a synthesized input · constructed an object; no result was computed
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("13bad645d0db5008")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, BeliefState: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
import jax.numpy as jnp
from jax import random
import numpy as np

# Set random seed for reproducibility
key = random.PRNGKey(0)

# Create small JAX arrays for each attribute
batch_size = 2
particle_dim = 4
num_particles = 2

# particles: Array of shape (batch_size, particle_dim)
particles = jnp.array(
    [[0.1, 0.2, 0.3, 0.4],
     [0.5, 0.6, 0.7, 0.8]]
)

# log_weights: Array of shape (batch_size,)
log_weights = jnp.array([0.0, -0.5])

# weights: Array of shape (batch_size,), normalized to sum to 1
weights = jnp.array([0.7, 0.3])

# resampling_indices: Array of shape (batch_size,), integer indices
resampling_indices = jnp.array([0, 1])

ARGS = {
    "particles": particles,
    "log_weights": log_weights,
    "weights": weights,
    "resampling_indices": resampling_indices,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BeliefState — the run constructed an instance of its own class and did not call it; no shape is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
HistoryParticles Ran
ran on a synthesized input · constructed an object; no result was computed
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("caa7f644357e4e2d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, HistoryParticles: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
from jax import numpy as jnp, random
from jax import Array
from typing import Union

# Set seed for reproducibility
key = random.PRNGKey(0)

# Define Carry types as in the function signature
GRUCarry = Array
LSTMCarry = tuple[Array, Array]
Carry = Union[LSTMCarry, GRUCarry]

# Create sample data for HistoryParticles
# Using distinct dimensions: batch=2, action_dim=4, obs_dim=3, hidden_dim=5

# Actions: shape (2, 4) - batch_size=2, action_dim=4
actions = jnp.ones((2, 4), dtype=jnp.float32)

# Observations: shape (2, 3) - batch_size=2, obs_dim=3
observations = jnp.ones((2, 3), dtype=jnp.float32)

# Carry: list of Carry objects (mix of GRU and LSTM carry states)
# For 2 particles, create 2 different carry states
gru_carry = jnp.ones((5,), dtype=jnp.float32)  # GRU: single hidden state, dim=5
lstm_carry = (jnp.ones((5,), dtype=jnp.float32), jnp.ones((5,), dtype=jnp.float32))  # LSTM: (h, c) tuple

carry_list = [gru_carry, lstm_carry]

ARGS = {
    "actions": actions,
    "carry": carry_list,
    "observations": observations,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type HistoryParticles — the run constructed an instance of its own class and did not call it; no shape is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
HistoryState Ran
ran on a synthesized input · constructed an object; no result was computed
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("0eece047422502fd")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, HistoryState: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
import jax.numpy as jnp
from jax import random

# Create small JAX arrays for testing
key = random.PRNGKey(0)

# Create sample actions array (batch_size=2, action_dim=4)
actions = jnp.ones((2, 4))

# Create sample carry - list of Carry objects
# GRUCarry is just an Array
# LSTMCarry is a tuple of two Arrays
gru_carry = jnp.ones((2, 4))
lstm_carry = (jnp.ones((2, 4)), jnp.ones((2, 4)))
carry = [gru_carry, lstm_carry]

# Create sample observations array (batch_size=2, obs_dim=3)
observations = jnp.ones((2, 3))

# Create HistoryParticles
particles = {
    'actions': actions,
    'carry': carry,
    'observations': observations
}

# Create log_weights array (batch_size=2)
log_weights = jnp.array([0.1, 0.2])

# Create normalized weights (batch_size=2)
weights = jnp.array([0.4, 0.6])

# Create resampling_indices array (batch_size=2)
resampling_indices = jnp.array([0, 1])

# Create rewards array (batch_size=2)
rewards = jnp.array([1.0, 2.0])

ARGS = {
    'particles': particles,
    'log_weights': log_weights,
    'weights': weights,
    'resampling_indices': resampling_indices,
    'rewards': rewards
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type HistoryState — the run constructed an instance of its own class and did not call it; no shape is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
ObservationModel Ran
ran on a synthesized input · constructed an object; no result was computed
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("c3c32c6451adb09a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, ObservationModel: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
from jax import Array, random, numpy as jnp
import chex
from typing import Dict, NamedTuple, Protocol, Union, Any

# Define the protocols as given
class LogProbObservation(Protocol):
    def __call__(self, z: Array, s: Array) -> Array:
        """Compute the log density of $h(z_t \\mid s_t)$."""

class SampleObservation(Protocol):
    def __call__(self, rng_key: chex.PRNGKey, s: Array) -> Array:
        """Sample from $h(z_t \\mid s_t)$."""

class ObservationModel(NamedTuple):
    """The observation model $h(z_t \\mid s_t)$."""
    sample: SampleObservation
    log_prob: LogProbObservation

# Create concrete implementations of the protocols
def sample_observation(rng_key: chex.PRNGKey, s: Array) -> Array:
    """Sample from observation distribution given state s."""
    # s has shape (..., state_dim), return samples of shape (..., obs_dim)
    obs_dim = 4
    return random.normal(rng_key, shape=s.shape[:-1] + (obs_dim,))

def log_prob_observation(z: Array, s: Array) -> Array:
    """Compute log probability of observation z given state s."""
    # z: (..., obs_dim), s: (..., state_dim)
    # Return log probabilities of shape (...)
    # Simple Gaussian: -0.5 * ||z||^2
    return -0.5 * jnp.sum(z ** 2, axis=-1)

# Create the observation model
observation_model = ObservationModel(
    sample=sample_observation,
    log_prob=log_prob_observation
)

ARGS = {
    "sample": observation_model.sample,
    "log_prob": observation_model.log_prob,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
chex, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ObservationModel — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ObservationModel output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
RecurrentPolicy Ran
ran on a synthesized input · constructed an object; no result was computed
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("a11c612a5c2b7ebc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, RecurrentPolicy: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
import jax.numpy as jnp
from jax import random
from flax.core import FrozenDict
from typing import Any, Dict

# Create small mock implementations for each protocol method

def mock_init(rng_key, obs_dim: int, action_dim: int, batch_dim: int) -> Dict[str, Any]:
    """Initialize parameters."""
    return FrozenDict({
        'weights': jnp.ones((obs_dim, 8)),
        'bias': jnp.zeros(8)
    })

def mock_reset(batch_size: int) -> list:
    """Reset carry state - return list of GRU carries."""
    # GRUCarry is Array, so return list of arrays
    return [jnp.zeros((batch_size, 8))]

def mock_sample(rng_key, carry: list, actions, observations, params) -> tuple:
    """Sample action and return carry, sampled_actions, log_std."""
    batch_size = observations.shape[0]
    new_carry = [jnp.ones((batch_size, 8))]
    sampled_actions = jnp.zeros_like(actions)
    log_std = jnp.zeros((batch_size, actions.shape[-1]))
    return new_carry, sampled_actions, log_std

def mock_log_prob(next_actions, carry: list, actions, observations, params) -> jnp.ndarray:
    """Compute log probability."""
    batch_size = observations.shape[0]
    return jnp.zeros(batch_size)

def mock_pathwise_carry(actions, observations, params) -> list:
    """Compute carry from actions and observations."""
    batch_size = observations.shape[0]
    return [jnp.ones((batch_size, 8))]

def mock_pathwise_log_prob(actions, observations, params) -> jnp.ndarray:
    """Compute pathwise log probability."""
    batch_size = observations.shape[0]
    return jnp.zeros(batch_size)

def mock_sample_and_log_prob(rng_key, carry: list, actions, observations, params) -> tuple:
    """Sample and compute log prob."""
    batch_size = observations.shape[0]
    new_carry = [jnp.ones((batch_size, 8))]
    sampled_actions = jnp.zeros_like(actions)
    log_std = jnp.zeros((batch_size, actions.shape[-1]))
    log_prob = jnp.zeros(batch_size)
    return new_carry, sampled_actions, log_std, log_prob

def mock_carry_and_log_prob(next_actions, carry: list, actions, observations, params) -> tuple:
    """Update carry and compute log prob."""
    batch_size = observations.shape[0]
    new_carry = [jnp.ones((batch_size, 8))]
    log_prob = jnp.zeros(batch_size)
    return new_carry, log_prob

def mock_entropy(params) -> jnp.ndarray:
    """Compute entropy."""
    return jnp.array(0.5)

ARGS = {
    'dim': 8,
    'init': mock_init,
    'reset': mock_reset,
    'sample': mock_sample,
    'log_prob': mock_log_prob,
    'pathwise_carry': mock_pathwise_carry,
    'pathwise_log_prob': mock_pathwise_log_prob,
    'sample_and_log_prob': mock_sample_and_log_prob,
    'carry_and_log_prob': mock_carry_and_log_prob,
    'entropy': mock_entropy,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
chex, flax, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RecurrentPolicy — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a RecurrentPolicy output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
TransitionModel Ran
ran on a synthesized input · constructed an object; no result was computed
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("fbce0b9594a13a87")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, TransitionModel: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
import jax.numpy as jnp
from jax import random
import chex

# Define sample transition function
def sample_transition_fn(rng_key, s, a):
    """Sample next state from transition model."""
    # Simple stochastic transition: s_next = s + a + noise
    noise = random.normal(rng_key, shape=s.shape) * 0.1
    return s + a + noise

# Define log probability transition function
def log_prob_transition_fn(sn, s, a):
    """Compute log probability of next state given current state and action."""
    # Assume Gaussian transition with mean = s + a
    mean = s + a
    # Log probability of Gaussian with fixed variance
    var = 0.01
    log_prob = -0.5 * jnp.sum((sn - mean) ** 2 / var)
    return log_prob

# Create TransitionModel instance
from jax import Array
from typing import NamedTuple

class TransitionModel(NamedTuple):
    """The transition kernel $f(s_t \\mid s_{t-1}, a_{t-1})$."""
    sample: 'SampleTransition'
    log_prob: 'LogProbTransition'

# Construct ARGS dictionary
ARGS = {
    'sample': sample_transition_fn,
    'log_prob': log_prob_transition_fn,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
chex, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type TransitionModel — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a TransitionModel output the recorded ndim 1 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
custom_split Ran
ran; our contract draft was wrong, not the code
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("086446b41c921271")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from jax import random
import chex

# Create a PRNGKey for the rng_key parameter
key = random.PRNGKey(0)

# Define the number of sub-keys to generate
num_subkeys = 5

# Construct the ARGS dictionary
ARGS = {
    "rng_key": key,
    "num": num_subkeys,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
chex, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
expected_reward Ran
ran; our contract draft was wrong, not the code
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("dfe3485e88c1b4ff")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ArrayImpl, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
from jax import Array, random, numpy as jnp
import numpy as np

# Define a simple reward function that takes state, action, and time index
def simple_reward_fn(s: Array, a: Array, t: Array) -> Array:
    """Simple reward function that returns a scalar."""
    # Sum over state and action dimensions to produce a scalar
    return jnp.sum(s) + jnp.sum(a) + jnp.asarray(t, dtype=jnp.float32)

# Create belief state with small tensors
num_particles = 2
state_dim = 4
action_dim = 3

# Particles: shape (num_particles, state_dim)
particles = jnp.array(np.random.randn(num_particles, state_dim), dtype=jnp.float32)

# Log weights: shape (num_particles,)
log_weights = jnp.array(np.array([-0.5, -0.7]), dtype=jnp.float32)

# Weights (normalized): shape (num_particles,)
weights = jnp.array(np.array([0.6, 0.4]), dtype=jnp.float32)

# Resampling indices: shape (num_particles,)
resampling_indices = jnp.array(np.array([0, 1]), dtype=jnp.int32)

# Create BeliefState
class BeliefState:
    def __init__(self, particles, log_weights, weights, resampling_indices):
        self.particles = particles
        self.log_weights = log_weights
        self.weights = weights
        self.resampling_indices = resampling_indices

belief_state = BeliefState(
    particles=particles,
    log_weights=log_weights,
    weights=weights,
    resampling_indices=resampling_indices
)

# Action: shape (action_dim,)
action = jnp.array(np.random.randn(action_dim), dtype=jnp.float32)

# Time index
time_idx = 0

# Reward function
reward_fn = simple_reward_fn

ARGS = {
    "belief_state": belief_state,
    "action": action,
    "time_idx": time_idx,
    "reward_fn": reward_fn
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
log_ess Ran
ran, honoured the contract we drafted
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("3fa696d057531d54")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ArrayImpl, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
from jax import Array, random, numpy as jnp

# Create valid log_weights array
# log_weights should be a 1D array of log-space weights for particles
key = random.PRNGKey(0)
log_weights = random.normal(key, shape=(5,))

ARGS = {
    "log_weights": log_weights
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
propagate_belief Ran
ran; our contract draft was wrong, not the code
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("629f1ddd4988a7a5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ArrayImpl, ndim 3, dtype family float, shape (2, 1, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
from jax import Array, random, numpy as jnp
import chex
from typing import NamedTuple

class LogProbTransition:
    def __call__(self, sn: Array, s: Array, a: Array) -> Array:
        """Compute the log density of f(s_t | s_{t-1}, a_{t-1})."""
        return jnp.sum(s * a, axis=-1)

class SampleTransition:
    def __call__(self, rng_key: chex.PRNGKey, s: Array, a: Array) -> Array:
        """Sample from f(s_t | s_{t-1}, a_{t-1})."""
        noise = random.normal(rng_key, shape=s.shape)
        return s + 0.1 * a[None] + 0.01 * noise

class TransitionModel(NamedTuple):
    """The transition kernel f(s_t | s_{t-1}, a_{t-1})."""
    sample: SampleTransition
    log_prob: LogProbTransition

rng_key = random.PRNGKey(0)

sample_fn = SampleTransition()
log_prob_fn = LogProbTransition()

model = TransitionModel(
    sample=sample_fn,
    log_prob=log_prob_fn
)

particles = jnp.ones((2, 4))

action = jnp.array([0.5, 0.3, 0.2, 0.1])

ARGS = {
    "rng_key": rng_key,
    "model": model,
    "particles": particles,
    "action": action
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
chex, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 3, dtype family float, shape (2, 1, 4) — shape (2, 1, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
reweight_belief Ran
ran; our contract draft was wrong, not the code
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("aa80eee012122ae9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned BeliefState. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
from jax import Array, random, numpy as jnp
import chex
from typing import NamedTuple

class BeliefState(NamedTuple):
    particles: Array
    log_weights: Array
    weights: Array
    resampling_indices: Array

class ObservationModel(NamedTuple):
    sample: callable
    log_prob: callable

# Create a simple observation model
def dummy_log_prob(z: Array, s: Array) -> Array:
    """Compute log probability of observation given state."""
    # z has shape (), s has shape (4,)
    # Return scalar log probability for each particle
    return -jnp.sum((z - s) ** 2)

def dummy_sample(rng_key, s: Array) -> Array:
    """Sample observation given state."""
    return s + random.normal(rng_key, s.shape)

observation_model = ObservationModel(
    sample=dummy_sample,
    log_prob=dummy_log_prob
)

# Create a BeliefState with small tensors
# M=2 particles, state dimension=4
num_particles = 2
state_dim = 4

particles = jnp.ones((num_particles, state_dim))
log_weights = jnp.array([0.0, 0.0])  # shape (2,)
weights = jnp.array([0.5, 0.5])  # shape (2,)
resampling_indices = jnp.array([0, 1])  # shape (2,)

belief_state = BeliefState(
    particles=particles,
    log_weights=log_weights,
    weights=weights,
    resampling_indices=resampling_indices
)

# Create an observation (scalar)
observation = jnp.array(0.5)

ARGS = {
    "model": observation_model,
    "state": belief_state,
    "observation": observation
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
chex, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type BeliefState — a BeliefState output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
sample_marginal_obs Ran
ran; our contract draft was wrong, not the code
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("6aa8ddf03cd39b4e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ArrayImpl, ndim 1, dtype family float, shape (3,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
from jax import Array, random, numpy as jnp
import chex
from typing import NamedTuple

class BeliefState(NamedTuple):
    particles: Array
    log_weights: Array
    weights: Array
    resampling_indices: Array

class ObservationModel(NamedTuple):
    sample: callable
    log_prob: callable

# Set up JAX random key
rng_key = jax.random.PRNGKey(0)

# Create tiny belief state
# particles: (M, state_dim) - M particles, each with state_dim features
num_particles = 2
state_dim = 4
particles = jnp.ones((num_particles, state_dim))

# log_weights: (M,) - log weight for each particle
log_weights = jnp.array([0.0, jnp.log(1.0)])

# weights: (M,) - normalized weights summing to 1
weights = jnp.array([0.5, 0.5])

# resampling_indices: (M,) - indices after resampling
resampling_indices = jnp.array([0, 1])

state = BeliefState(
    particles=particles,
    log_weights=log_weights,
    weights=weights,
    resampling_indices=resampling_indices
)

# Create observation model with sample and log_prob callables
def sample_obs(rng_key, s):
    """Sample observation given state s"""
    obs_dim = 3
    return jnp.ones(obs_dim)

def log_prob_obs(z, s):
    """Log probability of observation z given state s"""
    return jnp.array(0.0)

obs_model = ObservationModel(
    sample=sample_obs,
    log_prob=log_prob_obs
)

ARGS = {
    "rng_key": rng_key,
    "obs_model": obs_model,
    "state": state
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
chex, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 1, dtype family float, shape (3,) — shape (3,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
systematic_resampling Ran
ran; our contract draft was wrong, not the code
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("c24af8993a86c4c0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ArrayImpl, ndim 1, dtype family int, shape (5,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import jax
import jax.numpy as jnp
import chex

# Set seed for reproducibility
jax.config.update('jax_default_prng_impl', 'threefry2x32')

# Create a PRNGKey
rng_key = jax.random.PRNGKey(0)

# Create weights array - small particle weights that sum to 1
weights = jnp.array([0.1, 0.2, 0.3, 0.4])

# Number of samples to draw
num_samples = 5

ARGS = {
    "rng_key": rng_key,
    "weights": weights,
    "num_samples": num_samples,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
chex, jax — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ArrayImpl, ndim 1, dtype family int, shape (5,) — shape (5,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
CarryAndLogProbRecurrentPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("a1ef90cedf2fc2b1")
How it ran

no invocation recorded.

EntropyAttentionPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("05c9f57348fb470d")
How it ran

no invocation recorded.

EntropyRecurrentPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("4722555ecf97977a")
How it ran

no invocation recorded.

InitializeAttentionPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("333dfcf608c59957")
How it ran

no invocation recorded.

InitializeRecurrentPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("1976054432381604")
How it ran

no invocation recorded.

LogProbAttentionPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("e7d2912835a24bcb")
How it ran

no invocation recorded.

LogProbObservation Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("9eaf3502029a60a3")
How it ran

no invocation recorded.

LogProbRecurrentPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("93e66e7c729b7c72")
How it ran

no invocation recorded.

LogProbTransition Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("16a27638ef41a528")
How it ran

no invocation recorded.

PathwiseCarryRecurrentPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("21635573d5169592")
How it ran

no invocation recorded.

PathwiseLogProbRecurrentPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("88af258e3a077113")
How it ran

no invocation recorded.

ResetAttentionPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("c5246fcd5e052c52")
How it ran

no invocation recorded.

ResetRecurrentPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("84b66f7e86845605")
How it ran

no invocation recorded.

RewardFn Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("48c5771347c98d33")
How it ran

no invocation recorded.

SampleAndLogProbAttentionPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("9856dc90f6891135")
How it ran

no invocation recorded.

SampleAndLogProbRecurrentPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("307ed68087bc8258")
How it ran

no invocation recorded.

SampleAttentionPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("d74b1d12fd256ce7")
How it ran

no invocation recorded.

SampleObservation Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("6630b28821155079")
How it ran

no invocation recorded.

SampleRecurrentPolicy Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("c4b2103a327f967e")
How it ran

no invocation recorded.

SampleTransition Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("46a17da8fb983ce2")
How it ran

no invocation recorded.

effective_sample_size Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("2ee44ce129125614")
How it ran

no invocation recorded.

log_potential Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("24925fccd7fc190c")
How it ran

no invocation recorded.

resample_belief Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("f97fc1acfe4854ff")
How it ran

no invocation recorded.

resample_history Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("3b43f9a25a70c88e")
How it ran

no invocation recorded.

smc Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("a21ac1f169e5e7e1")
How it ran

no invocation recorded.

smc_init Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("3e1fb6c489494efc")
How it ran

no invocation recorded.

smc_step Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("71d23ef463a90bd1")
How it ran

no invocation recorded.

weighted_covar Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("4741ff263587e82f")
How it ran

no invocation recorded.

weighted_mean Not yet run
unverified (harvested, no recorded run)
Sahel13/particle-pomdp/ppomdp/smc/_smc.py
code served (permissive licence) · get_code("a27646d734705c31")
How it ran

no invocation recorded.

Also present in other papers' code

Of 44 samples lifted from this paper's linked repositories, 44 carry a function identity and 0 do not. Of the 44 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 44 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Optimal decision-making under partial observability requires agents to balance reducing uncertainty (exploration) against pursuing immediate objectives (exploitation). In this paper, we introduce a novel policy optimization framework for continuous partially observable Markov decision processes (POMDPs) that explicitly addresses this challenge. Our method casts policy learning as probabilistic inference in a non-Markovian Feynman-Kac model that inherently captures the value of information gathering by anticipating future observations, without requiring suboptimal approximations or handcrafted heuristics. To optimize policies under this model, we develop a nested sequential Monte Carlo (SMC) algorithm that efficiently estimates a history-dependent policy gradient under samples from the optimal trajectory distribution induced by the POMDP. We demonstrate the effectiveness of our algorithm across standard continuous POMDP benchmarks, where existing methods struggle to act under uncertainty.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2505.16732")
get_code_for_paper("2505.16732")
have("2505.16732")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2505.16732.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2505.16732.svg)](https://syntology.ai/paper/2505.16732)

Connect an agent — have() is free.