  We consider $N$ Bernoulli random variables, which are independent conditional
on a common random factor determining their probability distribution. We show
that certain expected functionals of the proportion $L_N$ of variables in a
given state converge at rate $1/N$ as $N\rightarrow \infty$. Based on these
results, we propose a multi-level simulation algorithm using a family of
sequences with increasing length, to obtain estimators for these expected
functionals with a mean-square error of $\epsilon^2$ and computational
complexity of order $\epsilon^{-2}$, independent of $N$. In particular, this
optimal complexity order also holds for the infinite-dimensional limit.
Numerical examples are presented for tranche spreads of basket credit
derivatives.
