Let R be a noncommutative prime ring of characteristic different from 2, U the Utumi quotient ring of R, C (= Z(U)) the extended centroid of R. Let 0 not equal a is an element of R and f(x(1), ..., x(n)) a multilinear polynomial over C which is noncentral valued on R. Suppose that G and H are two nonzero generalized derivations of R such that a(H (f (x)) f (x) f (x)G(f (x))) is an element of C for all x = (x(1), ..., x(n)) is an element of R-n. In this paper, we prove that one of the following holds: (1) f(x(1), ..., x(n))(2) is central valued on R and there exist b, p, q is an element of U such that H(x) = px + xb for all x is an element of R, G(x) = bx + xq for all x is an element of R with a(p - q) is an element of C; (2) there exist p,q is an element of U such that H(x) = px xq for all x is an element of R, G(x) = qx for all x is an element of R with ap = 0; (3) f(x(1), ..., x(n))(2) is central valued on R and there exist q is an element of U, lambda is an element of C and an outer derivation g of U such that H(x) = xq + lambda(x) - g(x) for all x is an element of R, G(x) = qx + g(x) for all x is an element of R, with a is an element of C; (4) R satisfies s(4) and there exist b, p is an element of U such that H(x) = px + xb for all x is an element of R, G(x) = bx + xp for all x is an element of R.