OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Models

Lstm Siamese Text Similarity

Lstm Siamese Text Similarity is a Python and Keras implementation of a Siamese bidirectional LSTM model that uses word embeddings to learn phrase and sentence similarity from labeled pairs and predict scores for new pairs.

Independent OpenViST project profile, based on linked sources.

Lstm Siamese Text Similarity — Exploring sentence-pair matching with a trainable bidirectional LSTM
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when you can prepare labeled sentence pairs and want a documented training-to-prediction workflow for a Keras Siamese LSTM.

Who it is for

  • Developers building sentence-pair similarity experiments in Python and Keras.
  • Teams with labeled sentence pairs who want to train a similarity scorer for a specific text domain.

Documented uses

  • Train a model from sentence pairs labeled by similarity.
  • Save the trained model and load it for prediction.
  • Rank new sentence pairs by their predicted similarity scores.
Before you choose

Requirements & limits

The repository is public and specifies an MIT license.

  • Training requires paired sentence examples and similarity labels in the format shown by the README.
  • The example creates word-embedding metadata from the supplied sentences and uses configuration values for sequence length and model parameters.
  • The prediction example uses a locally saved Keras model and returns scores; application integration is not shown.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Train the model on labeled sentence pairs

Prepare paired sentences and similarity labels, then train and save a model.

Before you start

  • Python environment with dependencies installed using pip install -r requirements.txt.
  • CSV data containing sentences1, sentences2 and is_similar columns.

Steps

  1. Read the CSV and collect the two sentence columns and similarity labels.

  2. Create tokenizer and embedding metadata from the combined sentence lists.

  3. Build sentence pairs and configure the model using values from siamese_config.

  4. Call train_model with the pairs, labels and embedding metadata, specifying ./ as the model save directory.

Expected outcome

The training call returns a path for the saved model.

Guide limitations

  • The example does not establish performance for any particular dataset or domain.
Source-based practical guide

Score new sentence pairs with a saved model

Load a trained model and produce prediction scores for input sentence pairs.

Before you start

  • A saved model path from training.
  • The tokenizer and siamese_config values used to prepare test data.

Steps

  1. Load the saved model with Keras load_model.

  2. Prepare the input pairs with create_test_data and the configured maximum sequence length.

  3. Pass the prepared inputs to model.predict and pair each resulting score with its input sentences.

Expected outcome

A list of sentence pairs with prediction scores; the example sorts it by score.

Guide limitations

  • Integration into a separate application is not demonstrated.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
21 November 2026
Original website title
amansrivastava17/lstm-siamese-text-similarity · Official homepage title · retained in its source language