SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1612.01627 · 2016

Sequential Matching Network: A New Architecture for Multi-turn Response Selection in Retrieval-based Chatbots

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 0 failures of our instrument; 0 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/1612.01627.json · badge: /api/ran/1612.01627.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
yangliuy/NeuralResponseRanking community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
FunctionStatusWhere it lives
rank_crossentropy_loss Ran
ran on a synthesized input
yangliuy/NeuralResponseRanking/matchzoo/losses/rank_losses.py
code served (permissive licence) · get_code("bcfc9e8b905d3ef1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tensorflow as tf
import numpy as np

# Set random seed for reproducibility
np.random.seed(0)
tf.random.set_seed(0)

# Create small test tensors for y_true and y_pred
# The function expects batches where every (neg_num + 1) samples form a group
# (1 positive + neg_num negatives)
# Let's use neg_num=2, so batch size should be divisible by 3
batch_size = 6  # 2 groups of 3 (1 pos + 2 neg each)
num_classes = 4

# y_true: shape (batch_size, 1) - labels for ranking loss
y_true = tf.constant(
    np.random.randint(0, 2, size=(batch_size, 1)).astype(np.float32),
    dtype=tf.float32
)

# y_pred: shape (batch_size, 1) - logits for ranking loss
y_pred = tf.constant(
    np.random.randn(batch_size, 1).astype(np.float32),
    dtype=tf.float32
)

# Define the kwargs parameter with neg_num
kwargs_dict = {'neg_num': 2}

# Define the ARGS dictionary
ARGS = {
    'kwargs': kwargs_dict
}

# Test: construct and call the function
def rank_crossentropy_loss(kwargs=None):
    neg_num = 1
    if isinstance(kwargs, dict) and 'neg_num' in kwargs:
        neg_num = kwargs['neg_num']

    def _cross_entropy_loss(y_true, y_pred):
        y_pos_logits = tf.keras.layers.Lambda(lambda a: a[::neg_num + 1, :], output_shape=(1,))(y_pred)
        y_pos_labels = tf.keras.layers.Lambda(lambda a: a[::neg_num + 1, :], output_shape=(1,))(y_true)
        logits_list, labels_list = ([y_pos_logits], [y_pos_labels])
        for i in range(neg_num):
            y_neg_logits = tf.keras.layers.Lambda(lambda a: a[i + 1::neg_num + 1, :], output_shape=(1,))(y_pred)
            y_neg_labels = tf.keras.layers.Lambda(lambda a: a[i + 1::neg_num + 1, :], output_shape=(1,))(y_true)
            logits_list.append(y_neg_logits)
            labels_list.append(y_neg_labels)
        logits = tf.concat(logits_list, axis=1)
        labels = tf.concat(labels_list, axis=1)
        return tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(labels=labels, logits=logits))
    return _cross_entropy_loss

# Verify the setup works
loss_fn = rank_crossentropy_loss(**ARGS)
loss_value = loss_fn(y_true, y_pred)

ARGS = {
    'kwargs': {'neg_num': 2}
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
keras, numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
rank_hinge_loss Ran
ran on a synthesized input
yangliuy/NeuralResponseRanking/matchzoo/losses/rank_losses.py
code served (permissive licence) · get_code("ddc9d8a2cabd27e1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tensorflow as tf
from tensorflow import keras
from keras import backend as K
from keras.layers import Lambda
import numpy as np

def rank_hinge_loss(kwargs=None):
    margin = 1.0
    if isinstance(kwargs, dict) and 'margin' in kwargs:
        margin = kwargs['margin']

    def _margin_loss(y_true, y_pred):
        y_pos = Lambda(lambda a: a[::2, :], output_shape=(1,))(y_pred)
        y_neg = Lambda(lambda a: a[1::2, :], output_shape=(1,))(y_pred)
        loss = K.maximum(0.0, margin + y_neg - y_pos)
        return K.mean(loss)
    return _margin_loss


ARGS = {
    'kwargs': {
        'margin': 2.0
    }
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
keras, numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
serialize Ran
ran on a synthesized input
yangliuy/NeuralResponseRanking/matchzoo/losses/rank_losses.py
code served (permissive licence) · get_code("3d063b0c90233541")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

def rank_loss_fn(predictions, targets):
    """A simple rank loss function for testing."""
    return torch.mean((predictions - targets) ** 2)

# Give the function a __name__ attribute
rank_loss_fn.__name__ = "rank_loss"

ARGS = {
    "rank_loss": rank_loss_fn
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 3 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

We study response selection for multi-turn conversation in retrieval-based chatbots. Existing work either concatenates utterances in context or matches a response with a highly abstract context vector finally, which may lose relationships among utterances or important contextual information. We propose a sequential matching network (SMN) to address both problems. SMN first matches a response with each utterance in the context on multiple levels of granularity, and distills important matching information from each pair as a vector with convolution and pooling operations. The vectors are then accumulated in a chronological order through a recurrent neural network (RNN) which models relationships among utterances. The final matching score is calculated with the hidden states of the RNN. An empirical study on two public data sets shows that SMN can significantly outperform state-of-the-art methods for response selection in multi-turn conversation.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("1612.01627")
get_code_for_paper("1612.01627")
have("1612.01627")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/1612.01627.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/1612.01627.svg)](https://syntology.ai/paper/1612.01627)

Connect an agent — have() is free.