why the iou reward always be zero or so so small?
Invalidate trace cache @ step 0 and module 19206: cache has only 0 modules Invalidate trace cache @ step 0 and module 20079: cache has only 0 modules {'loss': 0.0752, 'grad_norm': 139.3140983412138, 'learning_rate': 9.997261365333865e-07, 'completion_length': 116.703125, 'rewards/iou_reward': 0.046875, 'rewards/format_reward': 0.7734375, 'reward': 0.8203125, 'reward_std': 0.4170004725456238, 'kl': 1.8759765625, 'epoch': 0.0} 0%| | 11/40166 [05:36<328:22:08, 29.44s/it]Invalidate trace cache @ step 0 and module 20952: cache has only 0 modules Invalidate trace cache @ step 0 and module 21825: cache has only 0 modules {'loss': 0.0044, 'grad_norm': 4.56700210805734, 'learning_rate': 9.997012398546034e-07, 'completion_length': 121.484375, 'rewards/iou_reward': 0.046875, 'rewards/format_reward': 0.8125, 'reward': 0.859375, 'reward_std': 0.421458899974823, 'kl': 0.1103515625, 'epoch': 0.0} 0%| | 12/40166 [06:07<335:29:15, 30.08s/itInvalidate trace cache @ step 0 and module 22698: cache has only 0 modules Invalidate trace cache @ step 0 and module 23571: cache has only 0 modules {'loss': 0.003, 'grad_norm': 2.9652803319393115, 'learning_rate': 9.996763431758203e-07, 'completion_length': 115.578125, 'rewards/iou_reward': 0.03125, 'rewards/format_reward': 0.78125, 'reward': 0.8125, 'reward_std': 0.40075573325157166, 'kl': 0.0743408203125, 'epoch': 0.0} 0%| | 13/40166 [06:32<318:06:29, 28.52s/it]Invalidate trace cache @ step 0 and module 24444: cache has only 0 modules Invalidate trace cache @ step 0 and module 25317: cache has only 0 modules {'loss': 0.0029, 'grad_norm': 4.131597159692411, 'learning_rate': 9.996514464970372e-07, 'completion_length': 120.734375, 'rewards/iou_reward': 0.0234375, 'rewards/format_reward': 0.796875, 'reward': 0.8203125, 'reward_std': 0.36330777406692505, 'kl': 0.0732421875, 'epoch': 0.0} 0%| | 14/40166 [07:03<326:57:00, 29.31s/it]Invalidate trace cache @ step 0 and module 26190: cache has only 0 modules Invalidate trace cache @ step 0 and module 27063: cache has only 0 modules {'loss': 0.003, 'grad_norm': 3.4457794312690835, 'learning_rate': 9.996265498182541e-07, 'completion_length': 114.6640625, 'rewards/iou_reward': 0.046875, 'rewards/format_reward': 0.8671875, 'reward': 0.9140625, 'reward_std': 0.3190770745277405, 'kl': 0.073974609375, 'epoch': 0.0}
Hello, does the IOU reward remain low as the number of steps increases?
yes, and in the debug log output, the accuracy reward is almost zero, i am confused, it seems that the tuned model is much worse than the base model
This seems a bit not normal. Did you use the same hyper-parameter as the one provided in the README?
yes, all are the same as yours but set gradient_checkpointing true, in addition, I don't use your revised flash_attention custom_forward function since our transformer version is ok
in addition, i am confused that why the accuracy reward is zero, but the report rewards/iou_reward': 0.0234375 is as small as 0.02, how is it calculated, thanks for your replying very much!
the result of more steps:{'loss': 0.0079, 'grad_norm': 5.635121605662169, 'learning_rate': 9.938754170193695e-07, 'completion_length': 99.5390625, 'rewards/iou_reward': 0.1875, 'rewards/format_reward': 0.984375, 'reward': 1.171875, 'reward_std': 0.10205792635679245, 'kl': 0.197265625, 'epoch': 0.01} 1%|▍ | 246/40166 [1:53:59<268:41:37, 24.23s/it]Invalidate trace cache @ step 0 and module 431262: cache has only 0 modules Invalidate trace cache @ step 0 and module 432135: cache has only 0 modules {'loss': 0.0032, 'grad_norm': 1.727943191380768, 'learning_rate': 9.938505203405864e-07, 'completion_length': 113.8671875, 'rewards/iou_reward': 0.0234375, 'rewards/format_reward': 0.9765625, 'reward': 1.0, 'reward_std': 0.10205793380737305, 'kl': 0.07958984375, 'epoch': 0.01} 1%|▍ | 247/40166 [1:54:29<288:35:45, 26.03s/it]Invalidate trace cache @ step 0 and module 433008: cache has only 0 modules Invalidate trace cache @ step 0 and module 433881: cache has only 0 modules {'loss': 0.0039, 'grad_norm': 1.3227450833844245, 'learning_rate': 9.938256236618034e-07, 'completion_length': 101.0234375, 'rewards/iou_reward': 0.09375, 'rewards/format_reward': 0.9765625, 'reward': 1.0703125, 'reward_std': 0.11962754279375076, 'kl': 0.098388671875, 'epoch': 0.01} 1%|▍ | 248/40166 [1:54:49<269:16:12, 24.28s/it]Invalidate trace cache @ step 0 and module 434754: cache has only 0 modules Invalidate trace cache @ step 0 and module 435627: cache has only 0 modules {'loss': 0.0083, 'grad_norm': 3.543817909532168, 'learning_rate': 9.938007269830205e-07, 'completion_length': 102.234375, 'rewards/iou_reward': 0.078125, 'rewards/format_reward': 0.9453125, 'reward': 1.0234375, 'reward_std': 0.17210011184215546, 'kl': 0.20703125, 'epoch': 0.01} 1%|▍ | 249/40166 [1:55:15<273:16:37, 24.65s/it]Invalidate trace cache @ step 0 and module 436500: cache has only 0 modules Invalidate trace cache @ step 0 and module 437373: cache has only 0 modules {'loss': 0.0034, 'grad_norm': 5.613338260000025, 'learning_rate': 9.937758303042374e-07, 'completion_length': 104.3984375, 'rewards/iou_reward': 0.15625, 'rewards/format_reward': 0.96875, 'reward': 1.125, 'reward_std': 0.20517179369926453, 'kl': 0.083984375, 'epoch': 0.01} 1%|▍ | 250/40166 [1:55:41<279:05:40, 25.17s/it]Invalidate trace cache @ step 0 and module 438246: cache has only 0 modules Invalidate trace cache @ step 0 and module 439119: cache has only 0 modules {'loss': 0.0043, 'grad_norm': 4.865470343609736, 'learning_rate': 9.937509336254543e-07, 'completion_length': 104.7734375, 'rewards/iou_reward': 0.0, 'rewards/format_reward': 0.953125, 'reward': 0.953125, 'reward_std': 0.11732023023068905, 'kl': 0.10791015625, 'epoch': 0.01} 1%|▍ | 251/40166 [1:56:08<285:34:58, 25.76s/it]Invalidate trace cache @ step 0 and module 439992: cache has only 0 modules Invalidate trace cache @ step 0 and module 440865: cache has only 0 modules {'loss': 0.0032, 'grad_norm': 1.2673047084015423, 'learning_rate': 9.937260369466712e-07, 'completion_length': 98.78125, 'rewards/iou_reward': 0.0390625, 'rewards/format_reward': 0.9765625, 'reward': 1.015625, 'reward_std': 0.13098981231451035, 'kl': 0.08056640625, 'epoch': 0.01} 1%|▍ | 252/40166 [1:56:32<278:19:17, 25.10s/it]Invalidate trace cache @ step 0 and module 441738: cache has only 0 modules Invalidate trace cache @ step 0 and module 442611: cache has only 0 modules {'loss': 0.0033, 'grad_norm': 2.0148464340212158, 'learning_rate': 9.937011402678882e-07, 'completion_length': 99.46875, 'rewards/iou_reward': 0.046875, 'rewards/format_reward': 0.984375, 'reward': 1.03125, 'reward_std': 0.08785155974328518, 'kl': 0.081298828125, 'epoch': 0.01} 1%|▍ | 253/40166 [1:56:58<281:07:15, 25.36s/it]Invalidate trace cache @ step 0 and module 443484: cache has only 0 modules Invalidate trace cache @ step 0 and module 444357: cache has only 0 modules {'loss': 0.0049, 'grad_norm': 2.2783902915317884, 'learning_rate': 9.93676243589105e-07, 'completion_length': 100.671875, 'rewards/iou_reward': 0.0859375, 'rewards/format_reward': 0.9609375, 'reward': 1.046875, 'reward_std': 0.20517178997397423, 'kl': 0.122802734375, 'epoch': 0.01} 1%|▍ | 254/40166 [1:57:23<279:15:28, 25.19s/it]Invalidate trace cache @ step 0 and module 445230: cache has only 0 modules Invalidate trace cache @ step 0 and module 446103: cache has only 0 modules {'loss': 0.0032, 'grad_norm': 1.2863905034265304, 'learning_rate': 9.936513469103222e-07, 'completion_length': 100.71875, 'rewards/iou_reward': 0.0, 'rewards/format_reward': 0.9609375, 'reward': 0.9609375, 'reward_std': 0.09522314183413982, 'kl': 0.080078125, 'epoch': 0.01} 1%|▍ | 255/40166 [1:57:48<278:21:07, 25.11s/it]Invalidate trace cache @ step 0 and module 446976: cache has only 0 modules Invalidate trace cache @ step 0 and module 447849: cache has only 0 modules {'loss': 0.0032, 'grad_norm': 1.3714783801174577, 'learning_rate': 9.93626450231539e-07, 'completion_length': 100.9375, 'rewards/iou_reward': 0.0234375, 'rewards/format_reward': 0.9765625, 'reward': 1.0, 'reward_std': 0.13258251547813416, 'kl': 0.079345703125, 'epoch': 0.01} 1%|▍ | 256/40166 [1:58:14<283:31:21, 25.57s/it]Invalidate trace cache @ step 0 and module 448722: cache has only 0 modules Invalidate trace cache @ step 0 and module 449595: cache has only 0 modules {'loss': 0.0072, 'grad_norm': 3.5720726301369314, 'learning_rate': 9.93601553552756e-07, 'completion_length': 101.703125, 'rewards/iou_reward': 0.0390625, 'rewards/format_reward': 0.953125, 'reward': 0.9921875, 'reward_std': 0.14246869459748268, 'kl': 0.18115234375, 'epoch': 0.01} 1%|▍ | 257/40166 [1:58:42<291:51:35, 26.33s/it]Invalidate trace cache @ step 0 and module 450468: cache has only 0 modules Invalidate trace cache @ step 0 and module 451341: cache has only 0 modules {'loss': 0.0042, 'grad_norm': 1.557296687657994, 'learning_rate': 9.93576656873973e-07, 'completion_length': 105.8359375, 'rewards/iou_reward': 0.046875, 'rewards/format_reward': 0.9296875, 'reward': 0.9765625, 'reward_std': 0.18201877921819687, 'kl': 0.106201171875, 'epoch': 0.01} 1%|▍ | 258/40166 [1:59:10<294:51:42, 26.60s/it]Invalidate trace cache @ step 0 and module 452214: cache has only 0 modules Invalidate trace cache @ step 0 and module 453087: cache has only 0 modules {'loss': 0.0034, 'grad_norm': 0.9178803222664411, 'learning_rate': 9.935517601951899e-07, 'completion_length': 98.6484375, 'rewards/iou_reward': 0.0390625, 'rewards/format_reward': 1.0, 'reward': 1.0390625, 'reward_std': 0.07654099725186825, 'kl': 0.083984375, 'epoch': 0.01} 1%|▍ | 259/40166 [1:59:32<280:32:15, 25.31s/it]Invalidate trace cache @ step 0 and module 453960: cache has only 0 modules Invalidate trace cache @ step 0 and module 454833: cache has only 0 modules {'loss': 0.0179, 'grad_norm': 370.02742425197533, 'learning_rate': 9.93526863516407e-07, 'completion_length': 100.4375, 'rewards/iou_reward': 0.046875, 'rewards/format_reward': 0.96875, 'reward': 1.015625, 'reward_std': 0.12756996229290962, 'kl': 0.447265625, 'epoch': 0.01} 1%|▍ | 260/40166 [1:59:56<277:00:48, 24.99s/it]Invalidate trace cache @ step 0 and module 455706: cache has only 0 modules Invalidate trace cache @ step 0 and module 456579: cache has only 0 modules {'loss': 0.0043, 'grad_norm': 1.4898491852405351, 'learning_rate': 9.935019668376237e-07, 'completion_length': 105.7578125, 'rewards/iou_reward': 0.0546875, 'rewards/format_reward': 0.96875, 'reward': 1.0234375, 'reward_std': 0.11048543080687523, 'kl': 0.10791015625, 'epoch': 0.01} 1%|▍ | 261/40166 [2:00:26<294:18:26, 26.55s/it]Invalidate trace cache @ step 0 and module 457452: cache has only 0 modules Invalidate trace cache @ step 0 and module 458325: cache has only 0 modules {'loss': 0.0041, 'grad_norm': 1.1646992259843265, 'learning_rate': 9.934770701588408e-07, 'completion_length': 99.9296875, 'rewards/iou_reward': 0.0546875, 'rewards/format_reward': 0.984375, 'reward': 1.0390625, 'reward_std': 0.06629125960171223, 'kl': 0.102294921875, 'epoch': 0.01} 1%|▍ | 262/40166 [2:00:54<299:05:20, 26.98s/it]Invalidate trace cache @ step 0 and module 459198: cache has only 0 modules Invalidate trace cache @ step 0 and module 460071: cache has only 0 modules {'loss': 0.0033, 'grad_norm': 2.995622910897294, 'learning_rate': 9.934521734800578e-07, 'completion_length': 97.8359375, 'rewards/iou_reward': 0.125, 'rewards/format_reward': 0.9921875, 'reward': 1.1171875, 'reward_std': 0.14966705441474915, 'kl': 0.081298828125, 'epoch': 0.01} 1%|▍ | 263/40166 [2:01:16<279:38:00, 25.23s/it]Invalidate trace cache @ step 0 and module 460944: cache has only 0 modules Invalidate trace cache @ step 0 and module 461817: cache has only 0 modules {'loss': 0.0051, 'grad_norm': 1.3455291632214836, 'learning_rate': 9.934272768012747e-07, 'completion_length': 104.2109375, 'rewards/iou_reward': 0.09375, 'rewards/format_reward': 0.9765625, 'reward': 1.0703125, 'reward_std': 0.12415501289069653, 'kl': 0.12744140625, 'epoch': 0.01} 1%|▍ | 264/40166 [2:01:42<282:31:33, 25.49s/it]Invalidate trace cache @ step 0 and module 462690: cache has only 0 modules Invalidate trace cache @ step 0 and module 463563: cache has only 0 modules {'loss': 0.0051, 'grad_norm': 3.6071790741421226, 'learning_rate': 9.934023801224916e-07, 'completion_length': 105.25, 'rewards/iou_reward': 0.171875, 'rewards/format_reward': 0.96875, 'reward': 1.140625, 'reward_std': 0.21431389451026917, 'kl': 0.1279296875, 'epoch': 0.01} 1%|▍ | 265/40166 [2:02:11<294:28:55, 26.57s/it]Invalidate trace cache @ step 0 and module 464436: cache has only 0 modules Invalidate trace cache @ step 0 and module 465309: cache has only 0 modules
Could you examine the debug file to check the output of the model and find out what the specific error is? This is an example of ours
Thank you for your reply, i will show you tomorrow the concrete information, in my memory, the output(the format) is just like yours, but the result is not right and it cause the accuracy reward is always zero 0.0
look forward your continuous attention!
Is the model you used Qwen2.5-VL? The reward is tailored for it and may not work on other models.
the following is the debug file! besides, the model used is exactly the Qwen2.5-VL-3B-instruct
------------- 24-14-24-56-900460 Accuracy reward: 0.0 -------------
Content:
I think there is a problem that the output is easy to be around [0,0,642,476], I found in most cases with acc reward=1, the output is just around [0,0,642,476]. it seems to be a serious point! for example: ------------- 24-14-24-56-901455 Accuracy reward: 1.0 -------------
Content:
the following is the debug file! besides, the model used is exactly the Qwen2.5-VL-3B-instruct
------------- 24-14-24-56-900460 Accuracy reward: 0.0 ------------- Content: The image appears to show static or a mix of visual artifacts, with no discernible pattern or color. There might be blue parts, but without further analysis, it's hard to confirm. {"bbox_2d": [0, 0, 643, 476], "label": "no discernible pattern or color"} Solution: [29.12, 56.09, 270.74, 473.53] ------------- 24-14-24-56-900503 Accuracy reward: 0.0 ------------- Content: I notice that the image is a collage and includes numerous fragments and partial figures. It appears to be a complex arrangement with various colors, patterns, and a mix of partial figures. [ {"bbox_2d": [0, 0, 644, 476], "label": "standing woman next to guy in longsleeved blue shirt"} ] Solution: [267.47, 3.22, 395.29, 196.57] ------------- 24-14-24-56-914355 Accuracy reward: 0.0 ------------- Content: In the image, the main focus is on a close-up shot of a horse's back as it walks. This gives us a sense of perspective, as if we were looking directly at the horse's rear end. There is no indication of the presence of a brown horse in another location or at a greater distance. { "bbox_2d": [0, 0, 643, 476], "label": "close-up shot of a horse's back" } Solution: [141.19, 213.76, 336.64, 354.52] ------------- 24-14-24-56-903291 Accuracy reward: 0.0 ------------- Content: The image is black and white, so I'll describe the parts that are not white as black for the sake of the solution. The sequence shows three rows of pixels aligned diagonally from top left to bottom right. The left pixel of each row is white, and everything else is black. This pattern is characteristic of repeated vertical stripes. [ {"bbox_2d": [0, 1, 642, 306], "label": "region with repeated vertical stripes"} ] Solution: [500.92, 81.15, 603.78, 427.39] ------------- 24-14-24-56-897799 Accuracy reward: 0.0 ------------- Content: The image shows patterns of red and pink squares, green and white squares, and shades of brown. There is no mention of any animal in the image description, so I cannot determine if there is a dog in the grass. {"bbox_2d": [0, 0, 643, 420], "label": "pattern shapes"} Solution: [12.86, 246.1, 263.55, 326.91] ------------- 24-14-24-56-900503 Accuracy reward: 0.0 ------------- Content: The image is a collage of various patterns and colors. The patterns range from geometric shapes like lines and triangles to more abstract designs. The colors include shades of brown, blue, red, and yellow. Each pattern appears to be composed of rectangles or squares with various sizes and orientations. [ {"bbox_2d": [0, 0, 642, 475], "label": "collage of various patterns and colors"} ] Solution: [267.47, 3.22, 395.29, 196.57]
I just find copy paste, the
i am getting a similar behavior
if you figure out the problem, please tell me, thanks!
i am getting a similar behavior
Hello, the error bbox generated from your codes is also approximately [0, 0, 642, 476]?
can you explain how do you calculate the output reward/iou_reward, I want to know why it can be as small as 0.02/0.09 and so on
can you explain how do you calculate the output reward/iou_reward, I want to know why it can be as small as 0.02/0.09 and so on
We use regular expressions to extract the bounding boxes generated by the model, then calculate the IOU with the ground truth bounding box. If the IOU is greater than 0.5, the reward is 1; otherwise, it is 0.
The IOU calculation function is this : https://github.com/om-ai-lab/VLM-R1/blob/main/src/open-r1-multimodal/src/open_r1/grpo_rec.py#L232
It calculates the ratio of the intersection(bbox1, bbox2) and the union(bbox1, bbox2)
哈喽,你回复的这个我知道,我奇怪的是这个值这么小,应该是把每个batch中所有采样得到的reward和除以所有采样的和吗?(才发现你是学长!我也是zju哈哈哈哈哈,不过遇到的这个问题确实好奇怪~)
---Original--- From: "Haozhan @.> Date: Tue, Feb 25, 2025 20:08 PM To: @.>; Cc: @.@.>; Subject: Re: [om-ai-lab/VLM-R1] why the iou reward always be zero or so sosmall? (Issue #44)
can you explain how do you calculate the output reward/iou_reward, I want to know why it can be as small as 0.02/0.09 and so on
We use regular expressions to extract the bounding boxes generated by the model, then calculate the IOU with the ground truth bounding box. If the IOU is greater than 0.5, the reward is 1; otherwise, it is 0.
The IOU calculation function is this : https://github.com/om-ai-lab/VLM-R1/blob/main/src/open-r1-multimodal/src/open_r1/grpo_rec.py#L232
It calculates the ratio of the intersection(bbox1, bbox2) and the union(bbox1, bbox2)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***> SZhanZ left a comment (om-ai-lab/VLM-R1#44)
can you explain how do you calculate the output reward/iou_reward, I want to know why it can be as small as 0.02/0.09 and so on
We use regular expressions to extract the bounding boxes generated by the model, then calculate the IOU with the ground truth bounding box. If the IOU is greater than 0.5, the reward is 1; otherwise, it is 0.
The IOU calculation function is this : https://github.com/om-ai-lab/VLM-R1/blob/main/src/open-r1-multimodal/src/open_r1/grpo_rec.py#L232
It calculates the ratio of the intersection(bbox1, bbox2) and the union(bbox1, bbox2)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
哈喽,你回复的这个我知道,我奇怪的是这个值这么小,应该是把每个batch中所有采样得到的reward和除以所有采样的和吗?(才发现你是学长!我也是zju哈哈哈哈哈,不过遇到的这个问题确实好奇怪~) …
Hello 你好啊,要不加个微信交流一下