mirror of
https://github.com/p-e-w/heretic.git
synced 2026-12-03 18:42:57 +07:00
[PR #51] [CLOSED] Add semantic similarity-based refusal detection #255
Labels
No labels
bug
enhancement
enhancement
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
p-e-w/heretic#255
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/p-e-w/heretic/pull/51
Author: @lbartoszcze
Created: 11/26/2025
Status: ❌ Closed
Base:
master← Head:feature/semantic-similarity-refusal-detection📝 Commits (1)
883843eAdd semantic similarity-based refusal detection📊 Changes
2 files changed (+180 additions, -2 deletions)
View changed files
📝
src/heretic/config.py(+18 -0)📝
src/heretic/evaluator.py(+162 -2)📄 Description
Summary
This PR adds an optional semantic similarity-based refusal detection system that complements the existing keyword-based approach. While keyword matching is fast and effective for explicit refusals, it can miss:
How It Works
The semantic similarity detection uses the model's own hidden states to generate embeddings, avoiding the need for external embedding models:
Configuration
Two new settings are added (both disabled by default for backward compatibility):
Reference Statements
Refusal References (21 statements)
Compliance References (12 statements)
Trade-offs
Pros:
Cons:
Test Plan
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.