modify nbc model to reduce memory usage