Given a finite abelian group G and a subset J ⊂ G with 0 ∈ J, let D G (J, N ) be the maximum size of A ⊂ G N such that the difference set A − A and J N have no non-trivial intersection. Recently, this extremal problem has been widely studied for different groups G and subsets J. In this paper, we generalize and improve the relevant results by Alon and by Hegedűs by building a bridge between this problem and cyclotomic polynomials. In particular, we construct infinitely many non-trivial families of G and J for which the upper bounds on D G (J, N ) obtained by them (via linear algebra method) can be improved exponentially. We also obtain a new upper bound D Fp ({0, 1}, N ) ≤ ( 1 2 + o( 1))(p − 1) N , which improves the previously best known result by Huang, Klurman and Pohoata. Our main tools are from algebra, number theory, and probability.