---
title: 'StateFactory: Zero-Shot Reward Prediction'
url: https://www.emergentmind.com/topics/statefactory
type: topic
---

# StateFactory: Zero-Shot Reward Prediction

StateFactory is a zero-shot reward prediction framework based on factorized representations that transforms unstructured observations into explicit object–attribute graphs, enabling robust, generalizable reward estimation in partially observable, goal-augmented Markov Decision Processes (MDPs). By structuring the world and goal states hierarchically and using semantic similarity as the core metric, StateFactory provides strong zero-shot reward generalization and improved downstream planning performance, as demonstrated on diverse domains in the RewardPrediction benchmark [2603.09400].

## 1. Factorized World-State Representation

StateFactory operates in a partially observable, goal-augmented MDP, denoted as $\mathcal{M} = \langle \mathcal{S}, \mathcal{A}, \mathcal{O}, \mathcal{T}, \mathcal{R}, \mathcal{G}, \phi, \Omega \rangle$, where at each time $t$, the agent receives an observation $o_t = \Omega(s_t) \in \mathcal{O}$ and the goal $g \in \mathcal{G}$ is provided as a language string. StateFactory defines two mappings—world-state extraction and goal-state interpretation—both implemented via prompt-based large language model (LLM) calls:

- **World-state extraction**:
  $$
  \hat{s}_t = f_{\mathrm{state}}(g, \hat{g}_{t-1}, \hat{s}_{t-1}, o_t, a_{t-1})
  $$
- **Goal-state interpretation**:
  $$
  \hat{g}_t = f_{\mathrm{goal}}(g, \hat{g}_{t-1}, \hat{s}_t, o_t, a_{t-1})
  $$

Each factorized state $\hat{s}_t$ is a set of object instances:
$$
\hat{s}_t = \{ e_i \}_{i=1}^N, \quad e_i = \langle d_i, \{ (\alpha_{i,l}, v_{i,l}) \}_{l=1}^{L_i} \rangle
$$
where $d_i$ is the object identity (e.g., “Mug”) and $(\alpha_{i,l}, v_{i,l})$ are attribute–value pairs (e.g., “location$\mapsto$on table”). This induces a bipartite object–attribute graph structure suitable for hierarchical reasoning.

## 2. Reward Estimation as Hierarchical Semantic Similarity

Rewards are defined as semantic similarity between the current state $\hat{s}_t$ and the interpreted goal state $\hat{g}_t$. The per-step reward is:
$$
\hat{r}_t = \mathrm{sim}(\hat{s}_t, \hat{g}_t) = \frac{1}{|\hat{g}_t|} \sum_{e_k \in \hat{g}_t} \Bigl[ \max_{e_i \in \hat{s}_t} \left( \mathrm{sim}(d_k, d_i)\, \psi_{\mathrm{attr}}(e_k, e_i) \right) \Bigr]
$$
with attribute satisfaction
$$
\psi_{\mathrm{attr}}(e_k, e_i) = \tfrac{1}{|A_k|} \sum_{(\alpha_k, v_k) \in A_k} \mathrm{sim}(v_k, v_i^*)
$$
where $v_i^*$ is selected by maximum key similarity:
$$
\alpha^* = \arg\max_{\alpha' \in \mathrm{keys}(e_i)} \mathrm{sim}(\alpha_k, \alpha')
$$
Similarity is computed via cosine distance in the all-MiniLM-L6-v2 text embedding space (384 dimensions). Only object-attribute matches with sufficient identity similarity contribute nontrivially, enforcing hierarchical, context-sensitive reward attribution.

Performance is evaluated against human-annotated ground-truth rewards using the EPIC distance (policy-invariant): 
$$
D_{\mathrm{EPIC}}(\hat R, R) = \frac{1}{\sqrt{2}\,\sqrt{1-\rho(\hat R,R)}}
$$
where $\rho$ is the Pearson correlation.

## 3. Architecture and Inference Protocol

StateFactory is a zero-shot method that leverages a pipeline of LLM prompt modules:

- **Module A:** Extracts world state into a structured JSON object–attribute graph.
- **Module B:** Applies filtering to maintain only task-relevant state history.
- **Module C:** Builds a dynamic, interpreted goal blueprint encoding static entities and permissible state evolutions.

No finetuning or parameter updates are performed. The system uses GPT-OSS-20B (temperature 0.01, 8k context) for all prompt-based reasoning, and the all-MiniLM-L6-v2 embedding model for similarity computations. Reward estimation is carried out in inference-only mode, avoiding correlation with specific training data.

## 4. Benchmarking and Empirical Results

StateFactory is evaluated on the RewardPrediction benchmark, which consists of 2,454 stepwise, human-verified trajectories across five domains: AlfWorld, ScienceWorld, WebShop, BlocksWorld, and TextWorld.

| Model                  | Overall EPIC ↓ |
|------------------------|:-------------:|
| VLWM-critic (Llama3.2) |     0.738     |
| LLM-as-Judge           |     0.322     |
| StateFactory           |     0.297     |

StateFactory achieves a 60% reduction in EPIC distance relative to VLWM-critic, and an 8% lower EPIC distance than LLM-as-a-Judge (both are prior SOTA reward modeling baselines). On ablations, hierarchical object-attribute states (EPIC 0.30) outperform both object-centric (0.35) and flat denoised text (0.43) variants. Oracle (“offline”) vs. online goal representation is stable (EPIC 0.28 vs 0.30).

## 5. Integration with Reactive and Planning Agents

StateFactory directly augments downstream agents by providing differential reward signals:

For reactive system-1 (ReAct), at every step, action value is scored as:
$$
\Delta r = \hat{r}(s_{t+1}, g) - \hat{r}(s_t, g) - \lambda \cdot \mathbf{1}[\text{repetition}]
$$
where reward increments and penalties are injected into the prompt to influence the action proposal.

Integration results (success rate increases):
- AlfWorld: 34.33% → 55.97%
- BlocksWorld: 85.00% → 93.00%
- ScienceWorld: 22.63% → 35.03%

For system-2 (planning), StateFactory rewards are used for node evaluation in Monte Carlo Tree Search (MCTS) over world model rollouts, providing reward guidance at each simulated state.

## 6. Analysis, Limitations, and Future Directions

StateFactory’s compact, structured representation enables generalizable, policy-invariant reward estimation and robust transfer across domains, as corroborated by ablation analyses: the embedding probe shows that higher triplet discrimination accuracy strongly correlates with lower reward error.

Limitations include high dependency on the quality of LLM extraction—very long or noisy observations can cause degradation—and significant inference costs due to three sequential LLM calls and embedding similarity computation per step. Future work is expected to address efficiency and robustness by training lightweight extractors on generated object-attribute labels, incorporating visual encoders for raw sensory inputs, and developing learned key-alignment modules.

In summary, StateFactory provides an explicit, compositional, and semantically robust framework for general reward prediction through LLM-mediated, factorized world-state construction, outperforming both supervised and direct LLM-judgment baselines in both zero-shot reward accuracy and downstream agent performance [2603.09400].

Source: https://www.emergentmind.com/topics/statefactory