Change to sparse encoder in thread_encoder