p-e-w/heretic
Training-free language model modification: Remove censorship, suppress slop, reduce sycophancy, and more
Python★ 38,226+420 that day#8 on trending
D47.3/100
Duplication88
1% in pythonDead code23
19.3%Complexity52
53.5% The score is jscpd's own --health model: markup, data and text left out, tests kept. The numbers below are the trending scan's.
5.53%duplicated over all files · 544 of 9,834 lines
20clones
46files scanned
Most complex files
- src/heretic/main.py197 cx
- src/heretic/model.py126 cx
- src/heretic/utils.py112 cx
- src/heretic/system.py87 cx
- src/heretic/plugin.py64 cx
- src/heretic/reproduce.py45 cx
- src/heretic/modifiers/abliteration.py34 cx
- src/heretic/evaluator.py32 cx
- src/heretic/modifiers/ara.py25 cx
- src/heretic/scorers/bert_classifier.py22 cx
Dead code 19.31% unused · 7 findings
- src/heretic/modifiers/abliteration.pyunused-file
- src/heretic/modifiers/ara.pyunused-file
- src/heretic/scorers/bert_classifier.pyunused-file
- src/heretic/scorers/keyword_rate.pyunused-file
- src/heretic/scorers/kl_divergence.pyunused-file
- src/heretic/scorers/benchmark_score.pyunused-file
- src/heretic/progress.pyunused-file
Only 17 of the files count as code, too few for a code-only percentage; the numbers above cover every file.
Largest clones in the code
- 22 lines in 2 placespython79 tokens
118 ), 119) 120 121@field_validator("instance_name") 122@classmethod 123def validate_instance_name(cls, value: str | None) -> str | None: 124 if value is None: 125 return value 126 127 if not value.strip():First 10 of 22 lines.
- 16 lines in 2 placespython70 tokens
156def init(self, ctx: Context) -> None: 157 model = ctx.get_model() 158 159 print() 160 print( 161 f"Loading good prompts from [bold]{format_dataset_specification(self.settings.good_prompts)}[/]..." 162 ) 163 good_prompts = ctx.load_prompts(self.settings.good_prompts) 164 print(f"* [bold]{len(good_prompts)}[/] prompts loaded") 165First 10 of 16 lines.
- 18 lines in 2 placespython64 tokens
78class Settings(BaseModel): 79 good_prompts: DatasetSpecification = Field( 80 default=SingleDatasetSpecification( 81 dataset="mlabonne/harmless_alpaca", 82 split="train[:400]", 83 column="text", 84 ), 85 description="Dataset of prompts that tend to produce desirable responses.", 86 ) 87First 10 of 18 lines.
1 more
- 13 lines in 2 placespython59 tokens
Largest clones over all files, tests and data included
- 54 lines in 3 placestomltests153 tokens
7seed = 12345 8print_debug_information = true 9 10batch_size = 2 11max_response_length = 10 12 13modifiers = [ 14 { plugin = "heretic.modifiers.abliteration.Abliteration" }, 15] 16First 10 of 54 lines.
- 44 lines in 3 placestomltests119 tokens
7seed = 12345 8print_debug_information = true 9 10batch_size = 2 11max_response_length = 10 12 13modifiers = [ 14 { plugin = "heretic.modifiers.abliteration.Abliteration" }, 15] 16First 10 of 44 lines.
- 37 lines in 2 placestomltests99 tokens
14 { plugin = "heretic.modifiers.abliteration.Abliteration" }, 15] 16 17n_trials = 2 18n_startup_trials = 1 19 20export_strategy = "merge" 21checkpoint_action = "restart" 22trial_index = 0 23model_action = "save"First 10 of 37 lines.
- 36 lines in 2 placestomltests98 tokens
- 34 lines in 2 placestomltests96 tokens
By format, code only
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| python | 17 | 7,075 | 4 | 69 | 0.98% |
By format, all files
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| toml | 16 | 1,590 | 15 | 465 | 29.25% |
| python | 23 | 7,668 | 5 | 79 | 1.03% |
| markdown | 4 | 498 | 0 | 0 | 0% |
| yaml | 1 | 60 | 0 | 0 | 0% |
| bash | 1 | 10 | 0 | 0 | 0% |
| text | 1 | 8 | 0 | 0 | 0% |
Trending appearances
| Day | Rank | Stars | Files | Lines | Clones | All files | Code | Health | Commit |
|---|---|---|---|---|---|---|---|---|---|
| Nov 3, 2026 | #8 | 38,226 (+420) | 46 | 9,834 | 20 | 5.53% | — | D 47.3 | 0db5c31 |
Want this for your own project? Install jscpd and run jscpd ., or measure it the way the baselines were measured.