Giter Site home page Giter Site logo

Comments (7)

machanic avatar machanic commented on July 16, 2024

I mean does the algorithm logic procedure the same in L2 and Linf norm versions?

from rays.

jinghuichen avatar jinghuichen commented on July 16, 2024

Technically speaking, there is no barrier in applying RayS to L2 norm case. The only caveat here is that our discrete formulation is defined based on Linf norm and therefore our search method favors Linf norm case. We did not really invest in how to build L2 norm version of RayS as robust training methods are commonly defined based on Linf norm. Personally, I believe that RayS can be directly applied to L2 norm but in order to achieve the best performance, one may need to change optimization formulation and search strategy carefully.

from rays.

machanic avatar machanic commented on July 16, 2024

@jinghuichen Can you made a new version of Ray to be also apply to L2 norm? I still cannot understand how to modify the code to apply L2 norm case.

from rays.

jinghuichen avatar jinghuichen commented on July 16, 2024

Thanks for your interest and sorry that RayS itself only support Linf norm case currently. It would be nice to further have L2 norm support, however, we might not have enough bandwidth recently and therefore it could take some time. I will be happy to further discuss with you if you wanna help/collaborate or having any other question

from rays.

machanic avatar machanic commented on July 16, 2024

I think there is no difference between L2 norm and Linf norm in your algorithm, because RayS is an unbounded attack(which means it does not require a L_p norm projection step.)
In traditional query-based attack that both supports L2 norm and Linf norm attack (eg. Bandits).
The update of adversarial image is :

x = x + lr * g / torch.norm(g, 2)  #L2 norm and g is gradient
x = x + lr * torch.sign(g)  #Linf norm and g is gradient which is similar with your self.sgn_t

However, you directly uses L2 normalized sign:

sgn_norm = torch.norm(sgn.view(len(x), -1), 2, 1)

in line https://github.com/uclaml/RayS/blob/master/RayS.py#L89
Another possible difference may lie in the radius, but it is calculated is by binary search in def binary_search. For example, you wrote self.d_t[to_update_ind] = d_end[to_update_ind], and d_end is determined by using binary search ( divide by 2, and 2, ...)
So the radius computation does not involve with L2 or Linf norm.
Conclusion:
I beilieve the only difference of RayS in L2 and Linf norms lies in the count of queries and attack success rate. (The Statistics, rather than the procedure of finding adversarial image).

from rays.

machanic avatar machanic commented on July 16, 2024

@uclaml @jinghuichen Am I correct?

from rays.

jinghuichen avatar jinghuichen commented on July 16, 2024

What you describe is a naive way to extend RayS to L2 norm case and it can work in my opinion. However, as I mentioned before, this trivial extension may not lead to the best performance. The reason is that we are currently searching directions of [-1,1]^d, which is kind of optimal in Linf norm case but may be not quite well for L2 norm (successful L2 norm attack may concentrate on 1 or few pixels rather than add perturbations on all pixels). This is why I mentioned that we may need to rethink about optimization formulation and search strategy carefully.

from rays.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.