changin document based on SGD