-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(grpo): add RLSD self-distilled advantage reweighting #9758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f95b420
feat(grpo): add RLSD self-distilled advantage reweighting
qychen2001 f124830
ci(workflows): add Qoder code review and assistant
qychen2001 66a5349
docs(grpo): document RLSD advantage reweighting parameters
qychen2001 29b05b5
update core-review.yaml
hjh0119 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: Qoder Assistant | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
| pull_request_review_comment: | ||
| types: [created] | ||
|
|
||
| jobs: | ||
| qoder-assistant: | ||
| if: | | ||
| contains(github.event.comment.body, '@qoder') && | ||
| !endsWith(github.event.comment.user.login, '[bot]') | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| issues: write | ||
| pull-requests: write | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Build Arguments | ||
| id: build_args | ||
| run: | | ||
| ARGS="REPO: ${{ github.repository }} | ||
| REQUEST_SOURCE: ${{ github.event_name }} | ||
| THREAD_ID: ${{ github.event.comment.node_id }} | ||
| COMMENT_ID: ${{ github.event.comment.id }} | ||
| AUTHOR: ${{ github.event.comment.user.login }} | ||
| BODY: ${{ github.event.comment.body }} | ||
| URL: ${{ github.event.comment.html_url }} | ||
| IS_PR: ${{ github.event.issue.pull_request != null || github.event_name == 'pull_request_review_comment' }} | ||
| ISSUE_OR_PR_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}" | ||
|
|
||
| if [ -n "${{ github.event.comment.pull_request_review_id }}" ]; then | ||
| ARGS="$ARGS | ||
| REVIEW_ID: ${{ github.event.comment.pull_request_review_id }}" | ||
| fi | ||
|
|
||
| if [ -n "${{ github.event.comment.in_reply_to_id }}" ]; then | ||
| ARGS="$ARGS | ||
| REPLY_TO_COMMENT_ID: ${{ github.event.comment.in_reply_to_id }}" | ||
| fi | ||
|
|
||
| echo "args<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$ARGS" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Run Qoder Assistant | ||
| uses: QoderAI/qoder-action@v0 | ||
| with: | ||
| qoder_personal_access_token: ${{ secrets.QODER_PERSONAL_ACCESS_TOKEN }} | ||
| prompt: | | ||
| /assistant | ||
| ${{ steps.build_args.outputs.args }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Qoder Auto Code Review | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| jobs: | ||
| qoder-review-trusted: | ||
| if: contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: Checkout PR head | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
|
|
||
| - name: Run Qoder Code Review | ||
| uses: QoderAI/qoder-action@v0 | ||
| with: | ||
| qoder_personal_access_token: ${{ secrets.QODER_PERSONAL_ACCESS_TOKEN }} | ||
| prompt: | | ||
| /review-pr | ||
| REPO:${{ github.repository }} PR_NUMBER:${{ github.event.pull_request.number }} | ||
|
|
||
| qoder-review-external: | ||
| if: ${{ !contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }} | ||
| runs-on: ubuntu-latest | ||
| environment: qoder-review | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: Checkout PR head | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
|
|
||
| - name: Run Qoder Code Review | ||
| uses: QoderAI/qoder-action@v0 | ||
| with: | ||
| qoder_personal_access_token: ${{ secrets.QODER_PERSONAL_ACCESS_TOKEN }} | ||
| prompt: | | ||
| /review-pr | ||
| REPO:${{ github.repository }} PR_NUMBER:${{ github.event.pull_request.number }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical Bug: If
teacher_per_token_logpsorpolicy_per_token_logpscontainsNaNorinf(e.g.,-infin padded positions), the subtractionteacher_per_token_logps - policy_per_token_logpswill produceNaNorinf. Multiplying bymask(which is0at padded positions) still results inNaNbecauseNaN * 0 = NaNin PyTorch. ThisNaNthen propagates throughtorch.exp,torch.clamp, and the final multiplication, causing the entire returned advantage tensor (and consequently the training loss) to becomeNaN. To prevent this, usetorch.whereto mask the logprob difference before any exponential or clamp operations. Additionally, castseq_negtoreweight.dtypeinstead of.float()to support mixed-precision/half-precision training seamlessly.