Skip to content

[BugFix] VLM RLVR add reward func#851

Merged
rchardx merged 2 commits into
areal-project:mainfrom
PopSoda2002:bug_fix/rlvr
Jan 26, 2026
Merged

[BugFix] VLM RLVR add reward func#851
rchardx merged 2 commits into
areal-project:mainfrom
PopSoda2002:bug_fix/rlvr

Conversation

@PopSoda2002

@PopSoda2002 PopSoda2002 commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

Description

Add a async_reward_fn similar with RLVR workflow:

# NOTE: load reward function dynamically if given as string
if isinstance(self.reward_fn, str):
    self.reward_fn = import_from_string(self.reward_fn)
    self.async_reward_fn = AsyncRewardWrapper(self.reward_fn)

Related Issue

Fixes #(issue)
#850

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Checklist

  • I have read the Contributing Guide
  • I have run formatting tools (pre-commit or manual)
  • I have run relevant unit tests and they pass
  • I have added tests for new functionality
  • I have updated documentation if needed
  • My branch is up to date with main
  • This PR introduces breaking changes (if yes, fill out details below)
  • If this PR changes documentation, I have built and previewed it locally with
    jb build docs
  • No critical issues raised by AI reviewers (/gemini review)

Breaking Change Details (if applicable):

Additional Context


Need help? Check the Contributing Guide or ask in
GitHub Discussions!

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @PopSoda2002, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug by enhancing the VisionRLVRWorkflow to support dynamic loading of reward functions. This change allows reward functions to be specified as string paths, which are then imported and wrapped for asynchronous execution, thereby improving the configurability and robustness of the reward function handling within the VLM RLVR workflow. The update provides greater flexibility for defining and integrating reward mechanisms.

Highlights

  • Dynamic Reward Function Loading: Implemented functionality to dynamically load the reward function if it is provided as a string path, enhancing flexibility and configuration options for the VisionRLVRWorkflow.
  • Asynchronous Reward Wrapper: Introduced AsyncRewardWrapper to handle the dynamically loaded reward function, ensuring compatibility with asynchronous operations within the workflow.
  • Type Hint Updates: Modified type hints for reward_fn and tokenizer parameters in the VisionRLVRWorkflow constructor to explicitly allow string types, reflecting the new dynamic loading capability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for dynamically loading a reward function from a string path in VisionRLVRWorkflow, making it consistent with the parent RLVRWorkflow. The change is functionally correct and fixes a bug where using a string path for reward_fn would previously lead to an AttributeError. My review includes one suggestion to improve code style and maintainability by moving local imports to the top of the file, which also aligns the implementation more closely with existing patterns in the codebase.

Comment thread areal/workflow/vision_rlvr.py Outdated

@rchardx rchardx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rchardx
rchardx merged commit 2102c6a into areal-project:main Jan 26, 2026
1 check passed
leandermaben pushed a commit to leandermaben/AReaL that referenced this pull request Mar 24, 2026
This pull request adds support for dynamically loading a reward function from a string path in `VisionRLVRWorkflow`, making it consistent with the parent `RLVRWorkflow`. The change is functionally correct and fixes a bug where using a string path for `reward_fn` would previously lead to an `AttributeError`.
SathyaGnanakumar pushed a commit to danielkiely/AReaL that referenced this pull request Apr 29, 2026
This pull request adds support for dynamically loading a reward function from a string path in `VisionRLVRWorkflow`, making it consistent with the parent `RLVRWorkflow`. The change is functionally correct and fixes a bug where using a string path for `reward_fn` would previously lead to an `AttributeError`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] AttributeError: 'VisionRLVRWorkflow' object has no attribute 'async_reward_fn'

2 participants