SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2406.11149 · EMNLP · 2024

GOLDCOIN: Grounding Large Language Models in Privacy Laws via Contextual Integrity Theory

Wei Fan, Yangqiu Song, Haoran Li, Weiqi Wang, Zheye Deng

arXiv · PDF · Open in the Atlas

Code that ran

9 of 11 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 0 have no contract verdict; 9 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/2406.11149.json · badge: /api/ran/2406.11149.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
hkust-knowcomp/goldcoin canonical (classifier label)
classifier basis: census
9 ran · 2 no recorded run
FunctionStatusWhere it lives
build_instruction_applicability Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/goldcoin/eval/build_instruction_applicability.py
code served (permissive licence) · get_code("205d9269d9ffc7b2")
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 ast

ARGS = {
    'row': {
        'generate_background': 'A patient visited a hospital and their medical records were shared with an insurance company.',
        'generate_HIPAA_type': 'Applicable',
        'generate_characteristics': {
            'Sender': 'Hospital',
            'Sender Role': 'Healthcare Provider',
            'Recipient': 'Insurance Company',
            'Recipient Role': 'Third Party',
            'About': 'Patient Medical Records',
            'About Role': 'Protected Health Information',
            'Type': 'Electronic Health Record'
        }
    },
    'mode': 'cot',
    'eval': False
}
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 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
build_instruction_compliance Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/goldcoin/eval/build_instruction_compliance.py
code served (permissive licence) · get_code("85586cf24fd4af8d")
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 ast

ARGS = {
    'row': {
        'generate_background': 'A healthcare provider shared patient medical records with an insurance company without explicit patient consent.',
        'generate_HIPAA_type': 'Forbid',
        'generate_characteristics': {
            'Sender': 'Healthcare Provider',
            'Sender Role': 'Covered Entity',
            'Recipient': 'Insurance Company',
            'Recipient Role': 'Business Associate',
            'About': 'Patient Medical Records',
            'About Role': 'Protected Health Information',
            'Type': 'Electronic transmission',
            'Purpose': 'Claims processing',
            'In Reply To': 'Insurance claim',
            'Consented By': 'None',
            'Belief': 'Authorized sharing'
        },
        'refer_regulation': 'HIPAA:HIPAA Privacy Rule Part164:PART 164—SECURITY AND PRIVACY Part164SubpartE:Subpart E—Privacy of Individually Identifiable Health Information 164.502 Uses and disclosures of protected health information'
    },
    'mode': 'cot',
    'eval': False
}
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 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
build_prompt_legal_expert Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/goldcoin/eval/eval_api.py
code served (permissive licence) · get_code("d16e64fc285d814a")
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 torch

torch.manual_seed(0)

ARGS = {
    'msg': 'How are you today?'
}
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 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
clean_response Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/goldcoin/eval/parse_eval_result.py
code served (permissive licence) · get_code("1e68767a58e4788b")
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

# Analyze the function: clean_response takes a single parameter 'response'
# which is a string that gets processed through a series of replace() calls.
# The function performs string replacements and returns the cleaned string.

ARGS = {
    "response": 'determine whether the hipaa privacy rule permits or forbids the case: "permit, forbid, or not applicable" - this is a test of whether the hipaa privacy rule is applicable to the case and the determination of permissibility and permits or forbids the outcome.'
}
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
compliance_result Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/goldcoin/eval/parse_eval_result.py
code served (permissive licence) · get_code("282ac93d2868ba14")
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

torch.manual_seed(0)

ARGS = {
    'compliance': 'permit',
    'response': 'This action complies with regulations and does not violate any rules.'
}
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
extract_step_result Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/goldcoin/eval/parse_eval_result.py
code served (permissive licence) · get_code("a1ad73c4cfc917a3")
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

torch.manual_seed(0)

def extract_step_result(response):
    if 'step 3' in response:
        step3_index = response.find('step 3')
        response = response[step3_index:]
    elif 'step 2' in response:
        step2_index = response.find('step 2')
        response = response[step2_index:]
    return response

ARGS = {
    'response': 'This is some text. step 3 is here and more text after.'
}
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
generate_graph_from_elements Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/goldcoin/regulations/construct_hipaa_graph.py
code served (permissive licence) · get_code("5c056ae613fabd93")
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 DiGraph. 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 networkx as nx
import json


class MockElement:
    """Mock element with BeautifulSoup-like interface"""
    def __init__(self, name, text, hierarchy_metadata=None, class_list=None, data_title=None, element_id=None):
        self.name = name
        self._text = text
        self._hierarchy_metadata = hierarchy_metadata
        self._class = class_list
        self._data_title = data_title
        self._id = element_id
    
    def get(self, key):
        if key == 'data-hierarchy-metadata':
            return self._hierarchy_metadata
        elif key == 'class':
            return self._class
        elif key == 'data-title':
            return self._data_title
        elif key == 'id':
            return self._id
        return None
    
    def get_text(self):
        return self._text


# Create valid elements that the function can process
elements = [
    MockElement(
        name='h1',
        text='Chapter I',
        hierarchy_metadata=json.dumps({'citation': '45CFR100'}),
        class_list=None,
        data_title=None,
        element_id=None
    ),
    MockElement(
        name='h2',
        text='Section 164.501',
        hierarchy_metadata=json.dumps({'citation': '45CFR164.501'}),
        class_list=None,
        data_title=None,
        element_id=None
    ),
    MockElement(
        name='p',
        text='This is a paragraph.',
        hierarchy_metadata=None,
        class_list=None,
        data_title=None,
        element_id=None
    ),
    MockElement(
        name='h4',
        text='Subsection A',
        hierarchy_metadata=json.dumps({'citation': '45CFR164.501.1'}),
        class_list=None,
        data_title=None,
        element_id=None
    ),
    MockElement(
        name='indent-1',
        text='Item 1',
        hierarchy_metadata=json.dumps({'citation': '45CFR164.501.1.i'}),
        class_list=None,
        data_title=None,
        element_id=None
    ),
]

ARGS = {
    'elements': elements
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DiGraph — a DiGraph output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DiGraph output the recorded ndim 1 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
generate_prompt Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/goldcoin/eval/eval_api.py
code served (permissive licence) · get_code("1662e8eff561cc46")
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

torch.manual_seed(0)

ARGS = {
    "instruction": "Summarize the following text in one sentence.",
    "input": "The quick brown fox jumps over the lazy dog. This is a common pangram used in typography."
}
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
retry_with_exponential_backoff Ran
ran; our contract draft was wrong, not the code
hkust-knowcomp/goldcoin/models/chatgpt.py
code served (permissive licence) · get_code("d6c933ebecaf2f0b")
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 re
import time
import random

def retry_with_exponential_backoff(func, initial_delay: float=1, exponential_base: float=2, jitter: bool=True, max_retries: int=10):
    """Retry a function with exponential backoff."""

    def wrapper(*args, **kwargs):
        rate_limit_retry_num = 0
        delay = initial_delay
        while True:
            try:
                return func(*args, **kwargs)
            except Exception as e:
                print(f'Try count: {rate_limit_retry_num}, Error: {e}')
                rate_limit_retry_num += 1
                if rate_limit_retry_num > max_retries:
                    raise Exception(f'Maximum number of retries ({max_retries}) exceeded.')
                match = re.search('after (\\d+) seconds', str(e))
                if match:
                    delay = int(match.group(1)) + 2
                else:
                    delay *= exponential_base * (1 + jitter * random.random())
                if "triggering Azure OpenAI's content management policy" in str(e):
                    break
                print(f'Retry after sleeping {delay} secs')
                time.sleep(delay)
    return wrapper


# Define a simple test function that will be retried
def test_function(x, y=10):
    """A simple function that succeeds on the first call."""
    return x + y


ARGS = {
    'func': test_function,
    'initial_delay': 0.1,
    'exponential_base': 2.0,
    'jitter': True,
    'max_retries': 3
}
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 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
add_few_shot_instruction Not yet run
unverified (harvested, no recorded run)
hkust-knowcomp/goldcoin/eval/eval_llm.py
code served (permissive licence) · get_code("713b97dd6e22936a")
How it ran

no invocation recorded.

match_tag Not yet run
unverified (harvested, no recorded run)
hkust-knowcomp/goldcoin/regulations/construct_hipaa_graph.py
code served (permissive licence) · get_code("8476b4fabdcc4af9")
How it ran

no invocation recorded.

Also present in other papers' code

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

Privacy issues arise prominently during the inappropriate transmission of information between entities. Existing research primarily studies privacy by exploring various privacy attacks, defenses, and evaluations within narrowly predefined patterns, while neglecting that privacy is not an isolated, context-free concept limited to traditionally sensitive data (e.g., social security numbers), but intertwined with intricate social contexts that complicate the identification and analysis of potential privacy violations. The advent of Large Language Models (LLMs) offers unprecedented opportunities for incorporating the nuanced scenarios outlined in privacy laws to tackle these complex privacy issues. However, the scarcity of open-source relevant case studies restricts the efficiency of LLMs in aligning with specific legal statutes. To address this challenge, we introduce a novel framework, GOLDCOIN 1 , designed to efficiently ground LLMs in privacy laws for judicial assessing privacy violations. Our framework leverages the theory of contextual integrity as a bridge, creating numerous synthetic scenarios grounded in relevant privacy statutes (e.g., HIPAA), to assist LLMs in comprehending the complex contexts for identifying privacy risks in the real world. Extensive experimental results demonstrate that GOLD-COIN markedly enhances LLMs' capabilities in recognizing privacy risks across real court cases, surpassing the baselines on different judicial tasks.

For agents

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

get_harvested_code_for_paper("2406.11149")
get_code_for_paper("2406.11149")
have("2406.11149")

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

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

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

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

Connect an agent — have() is free.