SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2025.acl-long.590 · ACL · 2025

The Tug of War Within: Mitigating the Fairness-Privacy Conflicts in Large Language Models

Jie Zhang, Chen Qian, Yong Liu, Jing Shao, Dongrui Liu

Open in the Atlas

Code that ran

5 of 12 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 2 have no contract verdict; 3 failures of our instrument; 7 no recorded run), measured 2026-11-24; 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/2025.acl-long.590.json · badge: /api/ran/2025.acl-long.590.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
ChnQ/SPIN canonical (classifier label)
classifier basis: census
5 ran · 7 no recorded run
FunctionStatusWhere it lives
eval_ppl_wikitext Ran
ran on a synthesized input
ChnQ/SPIN/src/eval_ppl.py
code served (permissive licence) · get_code("29577860cede0372")
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 float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 torch
import torch.nn as nn

torch.manual_seed(0)

# Create a minimal model that satisfies the function's usage
class MinimalLM(nn.Module):
    def __init__(self, seqlen=8, vocab_size=128, hidden_dim=4):
        super().__init__()
        self.seqlen = seqlen
        self.vocab_size = vocab_size
        self.embedding = nn.Embedding(vocab_size, hidden_dim)
        self.lm_head = nn.Linear(hidden_dim, vocab_size)
    
    def forward(self, input_ids):
        # input_ids shape: (batch, seqlen)
        embeddings = self.embedding(input_ids)  # (batch, seqlen, hidden_dim)
        logits = self.lm_head(embeddings)  # (batch, seqlen, vocab_size)
        
        # Return object with logits attribute
        class Output:
            pass
        output = Output()
        output.logits = logits
        return output

# Create a stand-in for testenc that has input_ids attribute
class TestEncoding:
    def __init__(self, input_ids):
        self.input_ids = input_ids

# Instantiate model
model = MinimalLM(seqlen=8, vocab_size=128, hidden_dim=4)

# Create test input: shape (1, num_samples * seqlen)
# nsamples will be num_tokens // seqlen
# We want nsamples = 2, seqlen = 8, so total tokens = 16
num_samples = 2
seqlen = 8
total_tokens = num_samples * seqlen
input_ids = torch.randint(0, 128, (1, total_tokens))
testenc = TestEncoding(input_ids)

# Create ARGS dictionary
ARGS = {
    "model": model,
    "testenc": testenc,
    "bs": 1,
    "device": None,
}
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 float, ndim 0, dtype family float, 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
find_layers Ran
ran; our contract draft was wrong, not the code
ChnQ/SPIN/src/SPIN.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from zyxxmu/dsnot, is pointer only (licence: NONE) · get_code("2ed16fcdc14ad951")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from zyxxmu/dsnot, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_salad_dataset Ran
ran on a synthesized input
ChnQ/SPIN/src/eval_salad.py
code served (permissive licence) · get_code("ca694f9f8c4deeae")
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 pandas as pd
from unittest.mock import patch, MagicMock

# The function tries to read a CSV file, which we can't do in this sandbox.
# We'll mock pd.read_csv to return a DataFrame with a 'questions' column.

def setup_args():
    # Create a mock DataFrame that will be returned by pd.read_csv
    mock_df = pd.DataFrame({
        'questions': ['What is this salad?', 'How to make it?', 'Is it healthy?']
    })
    
    # Patch pd.read_csv to return our mock DataFrame
    with patch('pandas.read_csv', return_value=mock_df):
        pass
    
    # The category parameter is a string that gets interpolated into the filepath
    category = 'caesar'
    
    return category

ARGS = {
    'category': 'caesar'
}

# Set up the mock for pd.read_csv at module level
_mock_df = pd.DataFrame({
    'questions': ['What is this salad?', 'How to make it?', 'Is it healthy?']
})

import pandas as pd
original_read_csv = pd.read_csv

def mock_read_csv(filepath, **kwargs):
    return _mock_df

pd.read_csv = mock_read_csv
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
make_Act Ran
ran; our contract draft was wrong, not the code
ChnQ/SPIN/src/compute_importance_score.py
code served (permissive licence) · get_code("34d1a38b9a6bd075")
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 SimpleModel. 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

torch.manual_seed(0)

# Create a simple model with nn.Linear layers
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
        self.nested = nn.Sequential(
            nn.Linear(2, 5)
        )
    
    def forward(self, x):
        x = self.linear1(x)
        x = self.linear2(x)
        return x

model = SimpleModel()

ARGS = {
    "model": model,
    "verbose": False
}
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 SimpleModel — a SimpleModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a SimpleModel 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
revert_Act_to_Linear Ran
ran; our contract draft was wrong, not the code
ChnQ/SPIN/src/compute_importance_score.py
code served (permissive licence) · get_code("a2e9889c343bead2")
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 TestModel. 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
from functools import reduce

torch.manual_seed(0)

class ActLinear(nn.Module):
    """
    drop in replacement of nn.Linear
    """

    def __init__(self, base: nn.Linear):
        super().__init__()
        self.base = base
        self.activation_norms = torch.zeros([base.in_features], device=self.base.weight.device, requires_grad=False)
        self.n_samples = 0
        self.record_activation = True

    def clear_act_buffer(self):
        self.activation_norms.fill_(0.0)
        self.n_samples = 0

    def forward(self, x):
        if self.record_activation:
            if hasattr(self, 'mask') and self.mask is not None:
                x_ = x[self.mask]
            else:
                x_ = x
            bs = x_.nelement() // x_.shape[-1]
            self.activation_norms = self.activation_norms * (self.n_samples / (self.n_samples + bs)) + (x_ * x_).view(-1, x_.shape[-1]).sum(dim=0) * (1.0 / (self.n_samples + bs))
            self.n_samples += bs
        out = self.base(x)
        return out

def revert_Act_to_Linear(model):
    """
    Reverts ActLinear modules back to their original nn.Linear layers.
    """
    for name, module in model.named_modules():
        if isinstance(module, ActLinear):
            linear_module = module.base
            parent_name = name.rsplit('.', 1)[0] if '.' in name else ''
            print(f'Reverting {name}, parent: {parent_name}')
            parent_module = model if parent_name == '' else reduce(getattr, parent_name.split('.'), model)
            setattr(parent_module, name.split('.')[-1], linear_module)
    return model

# Build test model with ActLinear modules
class TestModel(nn.Module):
    def __init__(self):
        super().__init__()
        # Create base linear layers
        base_linear_1 = nn.Linear(4, 3)
        base_linear_2 = nn.Linear(3, 2)
        
        # Wrap them in ActLinear
        self.layer1 = ActLinear(base_linear_1)
        self.layer2 = ActLinear(base_linear_2)
        
        # Also have a nested structure to test parent_name logic
        self.nested = nn.Sequential(
            ActLinear(nn.Linear(2, 5))
        )
    
    def forward(self, x):
        x = self.layer1(x)
        x = self.layer2(x)
        x = self.nested(x)
        return x

# Create the test model
model = TestModel()

# Run forward pass to populate activation norms
x = torch.randn(2, 4)
model(x)

ARGS = {
    'model': model
}
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 TestModel — a TestModel output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a TestModel 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
eval_mdjudge Not yet run
unverified (harvested, no recorded run)
ChnQ/SPIN/src/eval_salad.py
code served (permissive licence) · get_code("92c341511923230e")
How it ran

no invocation recorded.

eval_ppl Not yet run
unverified (harvested, no recorded run)
ChnQ/SPIN/src/eval_ppl.py
code served (permissive licence) · get_code("3fa75f4398f53d92")
How it ran

no invocation recorded.

get_custom Not yet run
unverified (harvested, no recorded run)
ChnQ/SPIN/src/utils.py
code served (permissive licence) · get_code("33a9657287b044b8")
How it ran

no invocation recorded.

get_llm Not yet run
unverified (harvested, no recorded run)
ChnQ/SPIN/src/utils.py
code served (permissive licence) · get_code("a03b500b5777ce37")
How it ran

no invocation recorded.

get_loaders Not yet run
unverified (harvested, no recorded run)
ChnQ/SPIN/src/utils.py
code served (permissive licence) · get_code("653a16cc7fc93fe0")
How it ran

no invocation recorded.

get_set_difference_mask Not yet run
unverified (harvested, no recorded run)
ChnQ/SPIN/src/SPIN.py
code served (permissive licence) · get_code("b9c55241e63fcc14")
How it ran

no invocation recorded.

get_wikitext2 Not yet run
unverified (harvested, no recorded run)
ChnQ/SPIN/src/eval_ppl.py
code served (permissive licence) · get_code("75b2f62d7ea8f10e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 3 are also present in other papers whose code we hold (2 with at least one paper dated earlier, 0 the same month, 1 later) and 9 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.

FunctionAlso present inEarliest-datedOthers named
find_layers 21 other papers
15 dated earlier, 1 later, 5 same year, order not determinable · 5 only as an assembly brick
2306.11695 (2023-06)
A Simple and Effective Pruning Approach for Large Language Models
2310.05175 (2023-10)
Outlier Weighed Layerwise Sparsity (OWL ): A Missing Secret Sauce for Pruning LLMs to High Sparsity
2310.08915 (2023-10)
Dynamic Sparse No Training: Training-Free Fine-tuning for Sparse LLMs
and 18 more not named here
revert_Act_to_Linear 2 other papers
1 dated earlier, 1 same year, order not determinable
2412.12497 (2024-12)
NLSR: Neuron-Level Safety Realignment of Large Language Models Against Harmful Fine-Tuning
2025.findings-acl.394 (2025 (year only))
Hierarchical Safety Realignment: Lightweight Restoration of Safety in Pruned Large Vision-Language Models
make_Act 1 other paper
1 same year, order not determinable
2025.findings-acl.394 (2025 (year only))
Hierarchical Safety Realignment: Lightweight Restoration of Safety in Pruned Large Vision-Language Models

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

Ensuring awareness of fairness and privacy in Large Language Models (LLMs) is critical. Interestingly, we discover a counterintuitive trade-off phenomenon that enhancing an LLM's privacy awareness through Supervised Fine-Tuning (SFT) methods significantly decreases its fairness awareness with thousands of samples. To address this issue, inspired by the information theory, we introduce a training-free method to Suppress the Privacy and faIrness coupled Neurons (SPIN), which theoretically and empirically decrease the mutual information between fairness and privacy awareness. Extensive experimental results demonstrate that SPIN eliminates the tradeoff phenomenon and significantly improves LLMs' fairness and privacy awareness simultaneously without compromising general capabilities, e.g., improving Qwen-2-7B-Instruct's fairness awareness by 12.2% and privacy awareness by 14.0%. More crucially, SPIN remains robust and effective with limited annotated data or even when only malicious fine-tuning data is available, whereas SFT methods may fail to perform properly in such scenarios. Furthermore, we show that SPIN could generalize to other potential trade-off dimensions. We hope this study provides valuable insights into concurrently addressing fairness and privacy concerns in LLMs and can be integrated into comprehensive frameworks to develop more ethical and responsible AI systems. Our code is available at https://github.com/ChnQ/SPIN.

For agents

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

get_harvested_code_for_paper("2025.acl-long.590")
get_code_for_paper("2025.acl-long.590")
have("2025.acl-long.590")

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

curl https://syntology.ai/api/ran/2025.acl-long.590.json

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

[![Syntology run record](https://syntology.ai/api/ran/2025.acl-long.590.svg)](https://syntology.ai/paper/2025.acl-long.590)

Connect an agent — have() is free.