We have a monoid M, and a function $f: M \rightarrow \{0, 1\}$. We're promised that this function factors through a (surjective) homomorphism to a finite abelian group (considered as a commutative monoid), $M \rightarrow G \rightarrow \{0, 1\}$, but not told what the group is.

Can we recover any information about the structure of G, just given $f$? I'm particularly interested in the case where M is the monoid of positive integers under multiplication.

[Edit: As I realized after reading Mariano's comment, we can take f = 0 identically and obtain no information whatsoever about G. So a better question might be, under what assumptions on f can we recover G? Or information about G? In particular, if the function from $G \rightarrow \{0, 1\}$ takes on its two values approximately equally often, can we say anything?]

More generally, and more interestingly: Can we recover any information about the structure of G, *assuming that the black-box is allowed to lie about a small fraction of values of the function*?