Pretty straightforward:
/give @s stick{AttributeModifiers:[{AttributeName:"minecraft:generic.movement_speed",Name:"test",Amount:0.5d,Operation:0,UUID:[I;0,0,0,0],Slot:"mainhand"}]}
/give @s stick{AttributeModifiers:[{AttributeName:"minecraft:generic.movement_speed",Name:"test",Amount:0.5d,Operation:0,UUID:[I;0,0,0,1],Slot:"mainhand"}]}
/give @s stick{AttributeModifiers:[{AttributeName:"minecraft:generic.movement_speed",Name:"test",Amount:0.5d,Operation:0,UUID:[I;0,0,1,1],Slot:"mainhand"}]}
/give @s stick{AttributeModifiers:[{AttributeName:"minecraft:generic.movement_speed",Name:"test",Amount:0.5d,Operation:0,UUID:[I;0,1,1,1],Slot:"mainhand"}]}
/give @s stick{AttributeModifiers:[{AttributeName:"minecraft:generic.movement_speed",Name:"test",Amount:0.5d,Operation:0,UUID:[I;0,1,1,0],Slot:"mainhand"}]}
/give @s stick{AttributeModifiers:[{AttributeName:"minecraft:generic.movement_speed",Name:"test",Amount:0.5d,Operation:0,UUID:[I;0,1,0,0],Slot:"mainhand"}]}
/give @s stick{AttributeModifiers:[{AttributeName:"minecraft:generic.movement_speed",Name:"test",Amount:0.5d,Operation:0,UUID:[I;0,1,0,1],Slot:"mainhand"}]}
Observe how only a few of those items have a functional attribute modifier (note, only difference between the commands is the UUID)
Functional commands: 4, 5, 7
Non-functional commands: 1, 2, 3, 6
Did a code analysis, it seems like Minecraft just discards all attribute modifiers where the first two or the last two numbers of the UUID are 0:
net.minecraft.world.item.ItemStack