Closing the Gap Between Classification and Retrieval Models