Skip to content
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

Reset scores for validators #1359

Merged
merged 1 commit into from
May 30, 2023
Merged

Reset scores for validators #1359

merged 1 commit into from
May 30, 2023

Conversation

adriansmares
Copy link
Contributor

@adriansmares adriansmares commented May 28, 2023

Summary

References #1307

This PR proposes that the weights for UIDs with a validator permit are reset on every weight check round. The reasoning is that a UID may gain a validator permit after it has been queried in the past, which in turn allows it to 'freeze' its current weights and avoid any form of decay.

Changes

  • Reset the moving averages for keys which have a validator permit.
    • The reasoning here is that keys with a validator permit are not queried during the training process - their weights do not decay and are instead stable, which affects the evaluation process of the validators.

@Eugene-hu
Copy link
Contributor

hey @adriansmares, I don't believe the uid weights would freeze. If they are only running a validator, then their weights should decay as a server that isn't replying. All uids are randomly queried on the network, and we pass 0s for any uids that are unsuccessful in replying. (https://github.com/opentensor/bittensor/blob/master/neurons/text/prompting/validators/core/neuron.py#L367)

@adriansmares
Copy link
Contributor Author

The UIDs with validator permit are completely skipped from the available_uids - there is no unsuccessful attempt towards the validator UIDs such that they would get a zero score, and in turn decay.

available_uids = torch.tensor( [ uid for uid, ax in enumerate( self.metagraph.axons ) if (ax.is_serving) and (not self.metagraph.validator_permit[uid]) ], dtype = torch.int64 ).to( self.device )

This means that validators will never be part of either the successful UIDs, or the unsuccessful UIDs. This means that they get to keep their original score during the first scatter, and they won't get zeroed in the second scatter either, because they are not unsuccessful.

Take a simplified network of 3 UIDs: 1st is the successful one, the 2nd one is the unsuccessful one, and the 3rd is the validator. The score of the validator is untouched:

>>> import torch
>>> moving_average_scores=torch.tensor([125, 150, 200])
>>> event_uids=torch.tensor([0])
>>> unsuccesfull_uids=torch.tensor([1])
>>> scattered_rewards = moving_average_scores.scatter(0, event_uids, torch.tensor([100]))
>>> scattered_rewards
tensor([100, 150, 200])
>>> scattered_rewards = scattered_rewards.scatter(0, unsuccesfull_uids, torch.zeros_like(unsuccesfull_uids))
>>> scattered_rewards
tensor([100,   0, 200])

@Eugene-hu
Copy link
Contributor

ahh okay, yes, the query uids were changed due to the nature of forwarding within the validators. Very nice catch @adriansmares!

Copy link
Contributor

@ifrit98 ifrit98 left a comment

Choose a reason for hiding this comment

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

LGTM! Great eye @adriansmares 👁️

@ifrit98 ifrit98 merged commit 5241134 into opentensor:master May 30, 2023
@adriansmares adriansmares deleted the fix/vpermit-weights-erase branch May 30, 2023 15:30
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.

3 participants