A multifactor model, extracting the common factors in returns and then tests whether expected returns are explained by the cross-sections of the loadings of security returns on the factors, have been popularly studied in cross-sectional return predictability in an efficient stock market. We deploy a long short-term memory (LSTM) networks in a multifactor model using individual stock returns in predicting out-of-sample return of the S&P 500 composite index from December, 2007 to December, 2010. We find that a LSTM network, a state-of-the art technique for sequence learning outperforms a factor regression by principal components. The outperformance, measured by the mean squared errors, is clear in predicting composite returns during the most recent financial crisis (January, 2008-June, 2009) when the LSTM is trained by data after dimensionality reduction by various autoencoders including denoising, and contractive autoencoder. Furthermore, we suggest a unique architecture of a multitasking network, consolidating an autoencoder and a LSTM network, resulting the best performance in application of a AE+LSTM network to a multifactor model.