← Selected work

Next Word Prediction — LSTM Language Model

A next-word prediction application powered by a trained TensorFlow/Keras LSTM. The Streamlit interface tokenizes partial sentences, prepares the saved model's input sequence, and displays three ranked next-word suggestions with their model probabilities.

The problem

A next-word prediction application powered by a trained TensorFlow/Keras LSTM. The Streamlit interface tokenizes partial sentences, prepares the saved model's input sequence, and displays three ranked next-word suggestions with their model probabilities.

My contribution

Connected the trained LSTM, tokenizer, and sequence metadata to a Streamlit application; implemented input validation, CPU inference, cached resource loading, ranked vocabulary decoding, and cloud deployment.

Live Next Word Lab showing the phrase the best way to and three ranked LSTM predictions: cheer, find, and live, with model probabilities

Product features

  • Partial-sentence input with three ranked next-word suggestions
  • CPU inference using the original trained Keras H5 model
  • Saved tokenizer with padding and truncation aligned to the model input shape
  • Ranked vocabulary predictions with a visible probability distribution
  • Cached model resources across Streamlit interface reruns
  • Input validation for empty, oversized, and unknown phrases

Engineering work

  • End-to-end model inference: Tokenize a partial sentence, pad or truncate to the saved model's input shape, execute the LSTM on CPU, and decode three ranked predictions back to vocabulary words.
  • Reusable model resources: Cache the original model and tokenizer across Streamlit reruns, load weights without training state, and bound CPU thread counts.
  • Validated inference: Reject empty, oversized, or unknown phrases and present three ranked words with their probability distribution.

Outcome

Delivers the trained sequence model through a browser interface, with three ranked word suggestions and cached CPU inference that reuses model resources across requests.

Architecture & tech stack

Data flow Visitor input → Partial sentence

Implementation A next-word prediction application powered by a trained TensorFlow/Keras LSTM. The Streamlit interface tokenizes partial sentences, prepares the saved model's input sequence, and displays three ranked next-word suggestions with their model probabilities.

Trained LSTM · Three ranked predictions · No external inference API