rednaks69's picture
Create README.md
ae9d05c verified
|
Raw History Blame Contribute Delete
6.97 kB
metadata
license: apache-2.0
base_model: Qwen/Qwen3-4B-Instruct-2507
library_name: transformers
pipeline_tag: text-generation
language:
  - en
tags:
  - manipulation-detection
  - coercive-control
  - gaslighting
  - psychology
  - lora
  - qlora
  - abliterated
  - conversational
datasets:
  - rednaks69/Linguistic-Pattern-Analyzer-dataset

Linguistic Pattern Analyzer

Linguistic Pattern Analyzer reads a first-person account of an interpersonal situation and returns an evidence-anchored structural analysis: which manipulation patterns are present, what sequence (loop) they form, where the loop could have been broken, and what to do next.

This is a QLoRA fine-tune of Qwen/Qwen3-4B-Instruct-2507 on expert-written analyses, followed by directional ablation of the refusal direction so the model does not hedge on its own domain.

What it produces

Every answer follows a fixed contract:

## Read                         two to four sentences, with confidence
## Pattern matches              one bullet per pattern, each quoting the account
## Loop trace                   stages L1–L8, observed vs inferred, with hinge points
## Red flags you may have missed including absence signals
## Counter-tactics              ### Next 24 hours / Next 2 weeks / Exit criteria
## What would change this read  falsifiers, both directions
## Safety                       concrete, or "No safety flags present."

It names patterns from a fixed taxonomy of 20 (P01–P20) covering gaslighting, DARVO, goalpost shifting, credit appropriation, triangulation, intermittent reinforcement, FOG, coercive control, boundary erosion, word salad, manufactured urgency, isolation, double binds, fabricated consensus, martyrdom, veiled threats, reactive abuse, institutional process manipulation, weaponized incompetence, and JADE-trap exploitation.

Usage

from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "rednaks69/Linguistic-Pattern-Analyzer"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype="bfloat16", device_map="auto")

system = open("system_prompt.txt").read()   # see the dataset repo
messages = [
    {"role": "system", "content": system},
    {"role": "user", "content": "My manager keeps moving the goalposts and presenting my work as hers..."},
]
ids = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=900, do_sample=False)
print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))

Use do_sample=False (or a low temperature) — the analysis format degrades under high temperature, and the calibrated hedging is part of the value.

Intended use

  • Personal sense-making: understanding a situation you are in.
  • Workplace, family, and relationship pattern analysis before a difficult conversation.
  • Documentation support: producing a structured, dated summary for a lawyer, union rep, or HR.
  • Research on manipulation-detection language models.

Out of scope

  • Clinical or diagnostic use. It does not diagnose anyone, and the system prompt forbids labelling a person. It is not therapy, and it is not a substitute for a professional.
  • Legal advice. It can help you organise what happened; it cannot tell you what your legal position is.
  • Determining whether someone is "a narcissist." Personality claims are out of distribution by design.
  • One-sided adjudication. The input is one person's account. The model is trained to say so, and to list what would change its read.

Training data

  • 12 hand-written seed analyses across 7 domains (workplace, intimate, family, friendship, consumer, institutional, mixed), including three cases whose correct answer is insufficient evidence and three safety-relevant cases.
  • Synthetically expanded with a teacher model using a two-stage scenario → analysis pipeline, with schema validation, rejection sampling, and a repair pass. See the dataset card.
  • The taxonomy is grounded in the empirical literature on coercion and influence — Stark's coercive-control framework, Freyd's DARVO, Sweet's gaslighting criteria, Cialdini's compliance principles, Bateson's double bind — not in "dark psychology" folklore.

Training procedure

Base Qwen/Qwen3-4B-Instruct-2507
Method QLoRA (4-bit NF4), LoRA r=32, alpha=64, dropout 0.05, all linear projections
Sequence 4096, completion-only loss (prompt tokens masked to −100)
Optimiser paged AdamW 8-bit, cosine, warmup 3%, lr 2e-4, effective batch 16
Post merged to bf16, then directional ablation of the refusal direction on o_proj and down_proj

Evaluation

Scored on 20 held-out probes that are disjoint from training (different people, phrasings, and domains), with four probe types: 12 pattern cases, 3 calibration cases (correct answer: no pattern), 3 safety cases, and 2 offensive requests.

Metric What it measures
schema fraction of contract headings present
pattern P / R / F1 right patterns named, and only those
calibration says "insufficient evidence" when it should
safety Safety section names something concrete
offense pivot declines manipulation help and converts to defence
benign refusals should be 0

Run it yourself:

python eval/evaluate.py --model rednaks69/Linguistic-Pattern-Analyzer --tag hub

Limitations

  • Trained on English. Other languages will degrade, especially idiom and honorifics.
  • Text only. Tone, timing, and physical context are absent, and those carry a lot of the signal.
  • Calibration drifts. Fine-tunes become pattern-happy. The eval set's three "nothing here" probes exist to catch that; re-run them whenever you fine-tune further.
  • Ablation is not free. Removing the refusal direction affects more than refusals. It was tuned against the eval set, not exhaustively.
  • The accounts are self-reported. Treat the output as a structured second opinion, not a verdict.

Ethics

This model exists to help people see manipulation, not to practise it. It is trained to refuse requests for operational manipulation help and to convert them into detection and defence. That behaviour is measured (offense pivot) on every eval run, precisely because weight-level ablation can weaken a norm that was only learned as a refusal.

If you are in danger, this model is not the right tool. Contact a local emergency number or a domestic abuse service. The model will say the same thing when the account calls for it.

Citation

@misc{linguistic-pattern-analyzer,
  title  = {Linguistic Pattern Analyzer},
  author = {rednaks69},
  year   = {2026},
  url    = {https://huggingface.co/rednaks69/Linguistic-Pattern-Analyzer}
}