SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2506.00608 · EMNLP · 2025

PAKTON: A Multi-Agent Framework for Question Answering in Long Legal Agreements

Giorgos Stamou, Maria Lymperaiou, Giorgos Filandrianos, Petros Raptopoulos

arXiv · PDF · Open in the Atlas

Code that ran

4 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (3 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 0 failures of our instrument; 3 no recorded run), measured 2026-11-24; 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/2506.00608.json · badge: /api/ran/2506.00608.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
petrosrapto/PAKTON community
Papers with Code archive
4 ran · 3 no recorded run
FunctionStatusWhere it lives
Document Ran
ran on a synthesized input · constructed an object; no result was computed
petrosrapto/PAKTON/Experiments and Evaluation/Quantitative/RAG Performance - LegalBenchRAG/legalbenchrag/legalbenchrag/methods/pakton.py
code served (permissive licence) · get_code("3d75cc9c7babc7cc")
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 an instance of its own class, Document: the run constructed the object and did not call it, so no result was computed. 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
from pydantic import BaseModel

class Document(BaseModel):
    file_path: str
    content: str

ARGS = {
    "file_path": "/path/to/document.txt",
    "content": "This is the document content with some text."
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pydantic, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Document — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Document 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
RetrievedSnippet Ran
ran on a synthesized input · constructed an object; no result was computed
petrosrapto/PAKTON/Experiments and Evaluation/Quantitative/RAG Performance - LegalBenchRAG/legalbenchrag/legalbenchrag/methods/pakton.py
code served (permissive licence) · get_code("51da2eff8d79f05c")
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 an instance of its own class, RetrievedSnippet: the run constructed the object and did not call it, so no result was computed. 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 os
import tempfile
from pydantic import BaseModel, computed_field

# Create a temporary directory and file for the corpus
temp_dir = tempfile.mkdtemp()
corpus_dir = os.path.join(temp_dir, 'data', 'corpus')
os.makedirs(corpus_dir, exist_ok=True)

# Create a sample file in the corpus
sample_file_path = os.path.join(corpus_dir, 'sample.txt')
sample_content = "This is a sample document with some text content for testing."
with open(sample_file_path, 'w') as f:
    f.write(sample_content)

# Change working directory to temp_dir so relative paths work
original_cwd = os.getcwd()
os.chdir(temp_dir)

# Define the Snippet and RetrievedSnippet classes
class Snippet(BaseModel):
    file_path: str
    span: tuple[int, int]

    @computed_field
    @property
    def answer(self) -> str:
        with open(f'./data/corpus/{self.file_path}') as f:
            return f.read()[self.span[0]:self.span[1]]

class RetrievedSnippet(Snippet):
    score: float

# Construct ARGS with valid parameters
ARGS = {
    'file_path': 'sample.txt',
    'span': (0, 10),
    'score': 0.95
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pydantic — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RetrievedSnippet — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a RetrievedSnippet 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
Snippet Ran
ran on a synthesized input · constructed an object; no result was computed
petrosrapto/PAKTON/Experiments and Evaluation/Quantitative/RAG Performance - LegalBenchRAG/legalbenchrag/legalbenchrag/methods/pakton.py
code served (permissive licence) · get_code("aaf0ff21e48c89a0")
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 an instance of its own class, Snippet: the run constructed the object and did not call it, so no result was computed. 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 os
import tempfile
from pathlib import Path

# Create a temporary directory structure for the test
temp_dir = tempfile.mkdtemp()
corpus_dir = os.path.join(temp_dir, 'data', 'corpus')
os.makedirs(corpus_dir, exist_ok=True)

# Create a test file with some content
test_file_path = os.path.join(corpus_dir, 'test_file.txt')
test_content = "This is a test file with some content for snippet extraction."
with open(test_file_path, 'w') as f:
    f.write(test_content)

# Change to temp directory so relative path works
original_cwd = os.getcwd()
os.chdir(temp_dir)

# Define arguments for Snippet
ARGS = {
    'file_path': 'test_file.txt',
    'span': (10, 14)  # This will extract "is a" from the content
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pydantic — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Snippet — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Snippet 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
find_unique_substring_position Ran
ran, honoured the contract we drafted
petrosrapto/PAKTON/Experiments and Evaluation/Quantitative/RAG Performance - LegalBenchRAG/legalbenchrag/legalbenchrag/methods/pakton.py
code served (permissive licence) · get_code("4b527ddc3a989c4f")
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 int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape 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 functools

@functools.lru_cache(maxsize=1024)
def find_unique_substring_position(original_text, chunk):
    """
    Finds the longest unique substring of `chunk` in `original_text` and returns
    its adjusted position in `original_text`. Falls back to full chunk search if needed.
    Uses lru_cache decorator for automatic caching of results.
    """
    n = len(chunk)
    for length in range(n, 0, -1):
        for start in range(n - length + 1):
            substring = chunk[start:start + length]
            first_index = original_text.find(substring)
            if first_index == -1:
                continue
            last_index = original_text.rfind(substring)
            if first_index == last_index:
                return first_index - start
    idx = original_text.find(chunk)
    return idx if idx != -1 else -1


# Setup code to construct valid arguments
original_text = "The quick brown fox jumps over the lazy dog"
chunk = "quick brown"

ARGS = {
    "original_text": original_text,
    "chunk": chunk
}
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 int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
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
PAKTON Not yet run
unverified (harvested, no recorded run)
petrosrapto/PAKTON/Experiments and Evaluation/Quantitative/RAG Performance - LegalBenchRAG/legalbenchrag/legalbenchrag/methods/pakton.py
code served (permissive licence) · get_code("5d4b56d232355dc1")
How it ran

no invocation recorded.

QueryResponse Not yet run
unverified (harvested, no recorded run)
petrosrapto/PAKTON/Experiments and Evaluation/Quantitative/RAG Performance - LegalBenchRAG/legalbenchrag/legalbenchrag/methods/pakton.py
code served (permissive licence) · get_code("f3b1b404d11e87f6")
How it ran

no invocation recorded.

RetrievalMethod Not yet run
unverified (harvested, no recorded run)
petrosrapto/PAKTON/Experiments and Evaluation/Quantitative/RAG Performance - LegalBenchRAG/legalbenchrag/legalbenchrag/methods/pakton.py
code served (permissive licence) · get_code("4e13dc10c8c35530")
How it ran

no invocation recorded.

Also present in other papers' code

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

Repositories linked to this paper

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

Abstract

Contract review is a complex and timeintensive task that typically demands specialized legal expertise, rendering it largely inaccessible to non-experts. Moreover, legal interpretation is rarely straightforward-ambiguity is pervasive, and judgments often hinge on subjective assessments. Compounding these challenges, contracts are usually confidential, restricting their use with proprietary models and necessitating reliance on open-source alternatives. To address these challenges, we introduce PAKTON: a fully open-source, endto-end, multi-agent framework with plug-andplay capabilities. PAKTON is designed to handle the complexities of contract analysis through collaborative agent workflows and a novel multi-stage retrieval-augmented generation (RAG) component, enabling automated legal document review that is more accessible, adaptable, and privacy-preserving. Experiments demonstrate that PAKTON outperforms both general-purpose and pretrained models in predictive accuracy, retrieval performance, explainability, completeness, and grounded justifications as evaluated through a human study and validated with automated metrics. 1

For agents

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

get_harvested_code_for_paper("2506.00608")
get_code_for_paper("2506.00608")
have("2506.00608")

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

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

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

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

Connect an agent — have() is free.