Padding the sentences is consuming huge memory I prepared a lstm model using tensorflow which has a max_sequence_length of 5000 and I'm padding the small sentences with 0's. I then deployed and tested the model with multiple calls at a time. I then encountered a memory error because the max_sequence_length is consuming a lot of memory.

Is there is any alternative to writing the model more efficiently using some thing as an alternative to padding?
Assuming you have tried alternatives like storing it in csr matrices in scipy, you can move away from padding to avoid memory issues by declaring your batch_size=1 and may be create batches using a groupby for equal length sequences. If you are using keras, then please check Masking.