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

Quantization table - initialization and update #19

Open
asif-hanif opened this issue Dec 19, 2022 · 0 comments
Open

Quantization table - initialization and update #19

asif-hanif opened this issue Dec 19, 2022 · 0 comments

Comments

@asif-hanif
Copy link

Hi @RjDuan
Thank you for excellent work. I have a question regarding initialization and update of Q-table.

(1) In paper, you have mentioned that Q-table is initialized with value of 1 and values are gradually increased during optimization (reference line: after Eq-1 in the paper).

However, in the code Q-table is being initialized with a user-provided value e.g. 40

q_ini_table.fill(q_size)


(2) Eq-7 in the paper states that q is updated as follows: $\quad q^{'} = q + \text{sign}(\nabla_{q} \mathcal{L}(x^{'},y))\quad \text{s.t.}\quad||q^{'}-q_{\text{init}}||_{\infty} < \epsilon$

Could you explain if Eq-7 corresponds correctly to the relevant part of the code:

AdvDrop/infod_sample.py

Lines 108 to 110 in 35ceeb0

for k in self.q_tables.keys():
self.q_tables[k] = self.q_tables[k].detach() - torch.sign(self.q_tables[k].grad)
self.q_tables[k] = torch.clamp(self.q_tables[k], self.factor_range[0], self.factor_range[1]).detach()

I have noted following perceived inconsistencies:
a) Negative sign is being used in the update of q-table in code, while Eq-7 uses + sign.
b) Eq-7 with $\ell_{\infty}$ norm suggests that maximum allowable difference in q-table is $\epsilon$ or $\mathrm{q_size}$ i.e. $\mathrm{max}(q^{'}-\mathrm{q_size}) \le \epsilon$, however, code part just keeps each entry of updated q-table in the range of [5, q_size] i.e. $\quad 5 \le q^{'} \le \mathrm{q_size}$

Could you help me clear the above mentioned confusions. Thank you!

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

No branches or pull requests

1 participant