SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.18481 · EMNLP · 2024

Dialog2Flow: Pre-training Soft-Contrastive Action-Driven Sentence Embeddings for Automatic Dialog Flow Extraction

Petr Motlicek, Sergio Burdisso, Srikanth Madikeri

arXiv · PDF · Open in the Atlas

Code that ran

8 of 8 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; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 7 failures of our instrument; 0 no recorded run), measured 2026-11-22; 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/2410.18481.json · badge: /api/ran/2410.18481.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
idiap/dialog2flow canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
evaluate_fewshot Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
idiap/dialog2flow/evaluate_embeddings.py
code served (permissive licence) · get_code("a842549ac19ff514")
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 tuple. 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 numpy as np
from sklearn.metrics import classification_report, ndcg_score
from sklearn.preprocessing import normalize

np.random.seed(0)

# Create small test data
# labels: array of class labels (need at least 2 classes with enough samples)
# For n_shots=1, we need at least max(1*2, 1+5)=6 samples per class
# Let's create 3 classes with 8 samples each = 24 total samples
num_samples = 24
num_classes = 3
embedding_dim = 4

labels = np.array([0, 0, 0, 0, 0, 0, 0, 0,
                    1, 1, 1, 1, 1, 1, 1, 1,
                    2, 2, 2, 2, 2, 2, 2, 2])

# Create embeddings: random vectors of dimension 4
embs = np.random.randn(num_samples, embedding_dim).astype(np.float32)

# n_shots: number of few-shot examples per class
n_shots = 1

ARGS = {
    "labels": labels,
    "embs": embs,
    "n_shots": n_shots
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
get_json_dialog Ran
ran; our contract draft was wrong, not the code
idiap/dialog2flow/extract_trajectories.py
code served (permissive licence) · get_code("be8c8402ca5408aa")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 json
import tempfile
import os

# Create a temporary JSON file with valid Amazon Transcribe post-call analytics format
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "transcript.json")

transcript_data = {
    "Transcript": [
        {
            "ParticipantRole": "user",
            "Content": "Hello, I need help with my account."
        },
        {
            "ParticipantRole": "system",
            "Content": "Sure, I'd be happy to help you."
        },
        {
            "ParticipantRole": "customer",
            "Content": "Thank you, I appreciate it."
        },
        {
            "ParticipantRole": "agent",
            "Content": "What can I assist you with today?"
        }
    ]
}

with open(temp_file, 'w') as f:
    json.dump(transcript_data, f)

ARGS = {
    'path_file': temp_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
get_speaker Ran
ran; our contract draft was wrong, not the code
idiap/dialog2flow/build_graph.py
code served (permissive licence) · get_code("68dee554610ab445")
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

def get_speaker(node):
    return 'system' if node.lower().startswith('system') else 'user'

# The function expects a 'node' parameter that has a .lower() method and supports string comparison
# This means node should be a string

ARGS = {
    'node': 'system_message'
}
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
get_tsv_dialog Ran
ran; our contract draft was wrong, not the code
idiap/dialog2flow/extract_trajectories.py
code served (permissive licence) · get_code("7e11dca1a9d0e42f")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 tempfile
import os

# Create a temporary TSV file with valid dialog format
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, 'dialog.tsv')

with open(temp_file, 'w', newline='') as f:
    f.write("user\tHello, how are you?\n")
    f.write("system\tI'm doing well, thank you!\n")
    f.write("customer\tCan you help me?\n")
    f.write("system\tOf course, what do you need?\n")

ARGS = {
    'path_file': temp_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
get_txt_dialog Ran
ran; our contract draft was wrong, not the code
idiap/dialog2flow/extract_trajectories.py
code served (permissive licence) · get_code("59965ca0b0756d16")
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 list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 tempfile
import os

# Create a temporary text file with valid dialog format
temp_dir = tempfile.mkdtemp()
path_file = os.path.join(temp_dir, "test_dialog.txt")

dialog_content = """system: Hello, how can I help you today?
user: I need assistance with my account
system: Of course, let me pull up your details
customer: Thank you for your help
Invalid line without speaker format
user: That's perfect, thank you!"""

with open(path_file, 'w') as f:
    f.write(dialog_content)

ARGS = {
    'path_file': path_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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
get_utterance Ran
ran; our contract draft was wrong, not the code
idiap/dialog2flow/build_graph.py
code served (permissive licence) · get_code("d45e4728624e8517")
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 re

def get_utterance(node):
    m = re.match('.+:\\s+\\d+_(.+)', node)
    return m.group(1).capitalize()

# The function expects a string parameter 'node' that matches the pattern:
# - starts with one or more characters
# - followed by a colon and whitespace
# - followed by one or more digits
# - followed by underscore and one or more characters
# The function extracts the part after the underscore and capitalizes it

ARGS = {
    'node': 'label: 42_hello_world'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
node2turn Ran
ran; our contract draft was wrong, not the code
idiap/dialog2flow/build_graph.py
code served (permissive licence) · get_code("f03e7cf8618fa953")
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 re

def node2turn(node):
    node = node.replace('system: ', 'agent: ').capitalize()
    m = re.match('(.+):\\s+(?:\\d+_)?(.+)', node)
    return f'{m.group(1)}: {m.group(2).capitalize()}'

ARGS = {
    'node': 'system: user action_1_example'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — 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
sphere Ran
ran, honoured the contract we drafted
idiap/dialog2flow/voronoi_plot.py
code served (permissive licence) · get_code("6ff4e09ade5b648a")
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 tuple, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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 numpy as np

ARGS = {
    "x": 0.0,
    "y": 0.0,
    "z": 0.0,
    "radius": 1.0,
    "resolution": 100
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
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 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 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 8 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

Efficiently deriving structured workflows from unannotated dialogs remains an underexplored and formidable challenge in computational linguistics. Automating this process could significantly accelerate the manual design of workflows in new domains and enable the grounding of large language models in domain-specific flowcharts, enhancing transparency and controllability. In this paper, we introduce Di-alog2Flow (D2F) embeddings, which differ from conventional sentence embeddings by mapping utterances to a latent space where they are grouped according to their communicative and informative functions (i.e., the actions they represent). D2F allows for modeling dialogs as continuous trajectories in a latent space with distinct action-related regions. By clustering D2F embeddings, the latent space is quantized, and dialogs can be converted into sequences of region/action IDs, facilitating the extraction of the underlying workflow. To pretrain D2F, we build a comprehensive dataset by unifying twenty task-oriented dialog datasets with normalized per-turn action annotations. We also introduce a novel soft contrastive loss that leverages the semantic information of these actions to guide the representation learning process, showing superior performance compared to standard supervised contrastive loss. Evaluation against various sentence embeddings, including dialog-specific ones, demonstrates that D2F yields superior qualitative and quantitative results across diverse domains. 1 1 https://github.com/idiap/dialog2flow User: i'm looking for the transplant unit department please Action: INFORM DEPARTMENT System: okay the transfer unit department give me a second let me look okay yes i found the transplant unit department can i help Action: REQMORE

For agents

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

get_harvested_code_for_paper("2410.18481")
get_code_for_paper("2410.18481")
have("2410.18481")

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

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

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

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

Connect an agent — have() is free.