Skip to main content

Implementation of Multistep Quasimetric Estimator

Project description

Multistep Quasimetric Estimation - (wip)

Exploration and eventually practical implementation for the Multistep Quasimetric Estimation proposed by Zheng et al. of Berkeley

Install

pip install MQE

Usage

import torch
from torch import nn

from MQE import MQE, MRN, Policy, ContinuousAction
from x_mlps_pytorch import MLP

state_dim, action_dim = 16, 4

mrn = MRN(
    sym_network = MLP(32, 64),
    asym_network = MLP(32, 64),
    distance_groups = 8
)

mqe = MQE(
    state_encoder = MLP(state_dim, 32),
    state_action_encoder = MLP(state_dim + action_dim, 32),
    metric_residual_network = mrn
)

policy = Policy(
    action_dim = action_dim,
    dim = 32,
    state_encoder = MLP(state_dim, 32),
    goal_encoder = MLP(state_dim, 32),
    action_dist = ContinuousAction()
)

states = torch.randn(4, 10, state_dim)
actions = torch.randn(4, 10, action_dim)
goals = torch.randn(4, 10, state_dim)

# train critic from offline trajectories

critic_loss, _ = mqe(states, actions, goals)

critic_loss.backward()

# train actor using critic

policy_loss, _ = mqe.extract_policy(
    policy,
    states,
    actions,
    goals,
    bc_loss_weight = 0.1
)

policy_loss.backward()

# inference

action = policy(states[:, 0], goals[:, 0]).sample() # (4, 4)

Citations

@misc{zheng2026multistepquasimetriclearningscalable,
    title   = {Multistep Quasimetric Learning for Scalable Goal-conditioned Reinforcement Learning},
    author  = {Bill Chunyuan Zheng and Vivek Myers and Benjamin Eysenbach and Sergey Levine},
    year    = {2026},
    eprint  = {2511.07730},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url     = {https://arxiv.org/abs/2511.07730},
}
@misc{liu2023metricresidualnetworkssample,
    title   = {Metric Residual Networks for Sample Efficient Goal-Conditioned Reinforcement Learning},
    author  = {Bo Liu and Yihao Feng and Qiang Liu and Peter Stone},
    year    = {2023},
    eprint  = {2208.08133},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url     = {https://arxiv.org/abs/2208.08133},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mqe-0.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mqe-0.1.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file mqe-0.1.0.tar.gz.

File metadata

  • Download URL: mqe-0.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for mqe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 95664053a0979a40546bef5106d666012293223cae775eb7138a3718984b501e
MD5 459d6ef97035c33b6218a69d56b3b863
BLAKE2b-256 9d75dc08f1bdad9df6a6bf0719580af734ccc36c33a0cbae5a6dda3b80a1d5cb

See more details on using hashes here.

File details

Details for the file mqe-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mqe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for mqe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3d12fed40d29eced4eb4b8d6f88631b17045125f759b84d3d1ac0ba9406b6507
MD5 2433b4399bc289a061e0d573a2bc3829
BLAKE2b-256 18fb768377f3f9d00e42ee8f878c9e6653a9506d2971475d5ab85879732c12fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page