SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2305.17878 · 2023

Ask an Expert: Leveraging Language Models to Improve Strategic Reasoning in Goal-Oriented Dialogue Models

arXiv · PDF · Open in the Atlas

Code that ran

4 of 6 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 4 have no contract verdict; 0 failures of our instrument; 2 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/2305.17878.json · badge: /api/ran/2305.17878.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
qzx7/bbmhreasoning canonical (classifier label)
classifier basis: census
4 ran · 2 no recorded run
FunctionStatusWhere it lives
get_gpt_result Ran
ran on a synthesized input
qzx7/bbmhreasoning/bbmhr/pipeline/prompting.py
code served (permissive licence) · get_code("89b3e7275cff69a1")
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 dict. 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 logging
import openai
from typing import Any, Dict, List, Optional, Text, TextIO
from unittest.mock import MagicMock, patch

# Setup logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()

# Mock the openai module since we can't make actual API calls
openai.Completion = MagicMock()
openai.Classification = MagicMock()

# Mock responses
mock_completion_response = {
    'id': 'cmpl-mock',
    'object': 'text_completion',
    'created': 1234567890,
    'model': 'text-ada-001',
    'choices': [{'text': ' This is a mock completion.', 'index': 0, 'finish_reason': 'stop'}]
}

mock_classification_response = {
    'object': 'classification',
    'model': 'curie',
    'search_model': 'ada',
    'results': [{'label': 'positive', 'query': 'test query'}]
}

openai.Completion.create = MagicMock(return_value=mock_completion_response)
openai.Classification.create = MagicMock(return_value=mock_classification_response)

# Define arguments for the get_gpt_result function
ARGS = {
    'task': 'completion',
    'gpt_prompt': 'Once upon a time',
    'query': 'test query',
    'stop_words': ['\n', '.'],
    'model_type': 'ada'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
openai — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
load_openers_from_file Ran
ran on a synthesized input
qzx7/bbmhreasoning/bbmhr/parlai/tasks/self_chat/worlds.py
code served (permissive licence) · get_code("4dc28061461f4485")
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 file with some opener lines
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("Once upon a time\n")
temp_file.write("In a galaxy far away\n")
temp_file.write("The quick brown fox\n")
temp_file.close()

ARGS = {
    'filepath': temp_file.name
}
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
post_process_annotation Ran
ran on a synthesized input
qzx7/bbmhreasoning/bbmhr/pipeline/joint_learning.py
code served (permissive licence) · get_code("88508a5475fdac30")
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 numpy as np

# Analyze the function: post_process_annotation takes a single parameter 'annotation' which is Text (str)
# The function performs string operations:
# - Checks if annotation[0] == ' ' (leading space)
# - Checks if annotation.startswith('the seeker')
# - Uses annotation.split('\n') to split by newlines
# - Uses annotation.index(',') to find comma position
# - Returns various substrings

# Test cases for the annotation parameter
annotation_leading_space = " This is a test\nSecond line"
annotation_with_comma = "Some text, and more content\nAnother line"
annotation_the_seeker = "the seeker said something\nMore text"

# For this simple string-processing function, we'll use one test case
# Let's use the first case (leading space) as the main example
test_annotation = " This is a test\nSecond line"

ARGS = {
    "annotation": test_annotation
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, 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
read_prompt Ran
ran on a synthesized input
qzx7/bbmhreasoning/bbmhr/pipeline/prompting.py
code served (permissive licence) · get_code("2065e1a55aa14adf")
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 tempfile
import os

# Create a temporary prompt file
temp_dir = tempfile.mkdtemp()
prompt_file_path = os.path.join(temp_dir, "prompt_template.txt")

# Write some sample prompt template content
sample_prompt_content = """You are a helpful assistant.
Please answer the following question:
{question}

Provide a detailed response."""

with open(prompt_file_path, 'w', encoding='utf-8') as f:
    f.write(sample_prompt_content)

# Define ARGS
ARGS = {
    'prompt_path': prompt_file_path
}
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
read_batch_data Not yet run
unverified (harvested, no recorded run)
qzx7/bbmhreasoning/bbmhr/pipeline/joint_learning.py
code served (permissive licence) · get_code("fa46e509a592d9d6")
How it ran

no invocation recorded.

reformat_source_data Not yet run
unverified (harvested, no recorded run)
qzx7/bbmhreasoning/bbmhr/pipeline/prompting.py
code served (permissive licence) · get_code("14de46d80233861c")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 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 6 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

Existing dialogue models may encounter scenarios which are not well-represented in the training data, and as a result generate responses that are unnatural, inappropriate, or unhelpful. We propose the "Ask an Expert" framework in which the model is trained with access to an "expert" which it can consult at each turn. Advice is solicited via a structured dialogue with the expert, and the model is optimized to selectively utilize (or ignore) it given the context and dialogue history. In this work the expert takes the form of an LLM. We evaluate this framework in a mental health support domain, where the structure of the expert conversation is outlined by pre-specified prompts which reflect a reasoning strategy taught to practitioners in the field. Blenderbot models utilizing "Ask an Expert" show quality improvements across all expert sizes, including those with fewer parameters than the dialogue model itself. Our best model provides a $\sim 10\%$ improvement over baselines, approaching human-level scores on "engingingness" and "helpfulness" metrics.

For agents

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

get_harvested_code_for_paper("2305.17878")
get_code_for_paper("2305.17878")
have("2305.17878")

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

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

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

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

Connect an agent — have() is free.