Trang chủ‎ > ‎IT‎ > ‎Data Science - Python‎ > ‎Tensorflow‎ > ‎

Sales Automation Through a Deep Learning Platform

A deep learning platform that actually sells to the customer.

This article outlines a successful sales automation platform that uses deep learning to drive customers down an order flow.


Most sales processes are mostly linear and have a flow. A good sales agent knows how to guide the customer down this path gracefully. If the customer is deviating from the flow the sales agent knows how to sell the product and continue on with the order flow. With this sales architecture platform the deep learning model can sell the product to the client and also keep context of the situation while maintaining the sales order flow.

Automatic voice sales systems are already place but such systems do not have the ability to sell the product and drive the customer farther down the sales process that this architecture provides.

Platform Design

This architecture is based on having the sales process mapped out into finite states. For example when ordering a plane ticket, a state could be ‘getting the date for departure’, or ‘getting the date for arrival’. These states are essentially a singular step in the order process. All of these steps are held together in underlying structure with a finite state machine to keep track of the states. Each state has its own properties. It’s not necessarily important that these states are mapped numerically in order because each order may deviate and the platform will have to bring the customer between different states.

Each state dictates what the network response will be. Using a bucketed response that is pre determined based on the state — this method is effective because it is very structured and the network will always give a correct response.

A trivial example of an order flow

In this platform there is middle ware for session storage. This session storage keeps track of certain customer information such as name, location and other information related to the order process. This temporal storage is an external key value store that is used with a unique session identifier. The storage used in this case was redis. The impact of this is holding data specific to the sale and makes it feel personalized. The sales network responds with information already input into they system such as “Alright Mr. Smith the next step is to get your credit information”.

When the customer gives input it is then given a unique sessionID, this sessionID is handed to the finite state machine and then encoded returning a current state matrix and a possible states matrix. These two matrices along with the raw user input is passed to a Wide and Recurrent Model. This model is based on the Wide and Deep model but replaces a feed forward network with a recurrent neural network for language processing. The target label in this model is what should be the next state in the finite state machine. The model is given the current state, all possible states and what the user said, taking this information into account, the network determines what is the correct next state to go in the order process. As of writing this article there are no known articles/papers that reference such a model as Wide and Recurrent. An example of this can be seen in this code example using the Keras package.

model = Sequential()
model.add(Embedding(max_features, 128, dropout=0.2))
model.add(GRU(128, dropout_W=0.2, dropout_U=0.2))
current_state = Sequential()
current_state.add(Dense(num_states, input_dim=num_states, activation="relu"))
possible_states = Sequential()
possible_states.add(Dense(num_states, input_dim=num_states, activation="relu"))
model.add(Dense(num_states, activation='softmax'))
final_answer = Sequential()
merge = (Merge([current_state, possible_states, model], mode='concat'))
final_answer.add(Dense(num_states, activation='softmax'))
final_answer.compile(optimizer='rmsprop', loss='categorical_crossentropy',

For each state in the order flow there is a hook that takes the user if it detects they’re uncertain or they have a question taking them to an intermediate state and will answer their questions and try to sell them. This model is a deep memory network with episodic memory and is fed a set of common questions particular for that business that it can easily interpret the users question and accurately answer. This piece is what sets apart this platform from other automated order processes. The deep memory network efficiently allows for recall of prepared statements such as how does the product function, or what is the warranty on this product and other questions customers might ask a sales associate.

The dynamic memory network for selling the customer


For this model to succeed it is necessary to have data sets that contain what a user might say in each state with what the correct next state is for that response, as well as a data set of what frequently asked questions that allow for the customer to be sold on with what successfully drives the customer down the order flow. In practice this data has been generated based off of domain knowledge and scripting of the order process. The session column indicates the order session, the text is what the customer says and the label is the correct next state. Example training set looks like the following based on selling a space trip:

1,of course,planets
1,Jupiter is cool with me,passengers
1,I want the premium meal plan,housing
1,what ones are good,list_meal
1,the hilton,payment
1,can you tell me which ones there are,list_housing
1,use it,done
2,that would be awesome,planets
2,Mars would be dope,passengers
2,the average one,housing
2,which one is the best?,list_meal
2,the ritz carlton,payment
2,I dont understant,list_housing


In practice this platform allowed for an MVP of a sales automation process that eliminated the need for human to human interaction through voice chat as well as text chat. This platform could scale up and work for large corporations who primary function is selling through agents. This platform is necessary for rigid business order processes to create uniformity throughout the sales process and delivers professional sales methods to increase the likelihood of order completion.