Identify LLMs by their response fingerprints
Project description
Research Question
Is it possible to identify which LLM generated a response by analyzing its semantic patterns across multiple standardized prompts?
Approach
LLM Fingerprint uses semantic similarity patterns across multiple prompts to create model-specific "fingerprints":
-
Fingerprint Creation: Generate multiple responses from known LLMs using standardized prompts
- Fixed sampling parameters to ensure consistent sampling behavior
- Multiple response samples per prompt to account for sampling variance
- Several distinct prompts to capture model characteristics
-
Similarity Analysis: Measure semantic similarity within and between prompt response groups
- Within-prompt similarity reveals consistency characteristics
- Cross-prompt similarity patterns create a unique model signature
-
Model Identification: Match patterns from unknown models against the fingerprint database
- Generate responses from the unknown model using the same standardized prompts
- Compare similarity patterns with known models
- Identify the closest matching fingerprint
Usage
Set required environment variables. See .envrc.example for more details.
Creating Model Fingerprints
# Generate samples for known model responses
llm-fingerprint generate \
--language-model "model-1" "model-2" "model-3" \
--prompts-path "./data/prompts/prompts_general_v1.jsonl" \
--samples-path "samples.jsonl" \
--samples-num 4
# Upload samples to ChromaDB
llm-fingerprint upload \
--language-model "embedding-model" \
--samples-path "samples.jsonl" \
--collection-name "samples"
Identifying Unknown Models
# Generate samples for unknown model (or use an external service)
# Let's suppose the we don't know we are using model-2
llm-fingerprint generate \
--language-model "model-2" \
--prompts-path "./data/prompts/prompts_single_v1.jsonl" \
--samples-path "unk-samples.jsonl" \
--samples-num 1
# Query ChromaDB for model identification
llm-fingerprint query \
--language-model "embedding-model" \
--samples-path "unk-samples.jsonl" \
--results-path "results.jsonl" \
--results-num 2
# matches.jsonl will contain the results
# {"model": "model-2", "score": ... }
# {"model": "model-1", "score": ... }
Installation
The preferred way to install llm-fingerprint is using uv (although you can also use pip).
# Clone the repository
git clone https://github.com/S1M0N38/llm-fingerprint.git
cd llm-fingerprint
# Create a virtual environment
uv venv
# Install the package
uv sync # --all-groups # for installing ml and dev groups
Requirements
- Python 3.11+
- OpenAI-compatible API endpoints (
/chat/completionsand/embeddings) - Access to ChromaDB (locally or hosted)
Contributing
This toy/research project is still in its early stages, and I welcome any feedback, suggestions, and contributions! If you're interested in discussing ideas or have questions about the approach, please start a conversation in GitHub Discussions.
For detailed information on setting up your development environment, understanding the project structure, and the contribution workflow, please refer to CONTRIBUTING.md.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_fingerprint-0.5.2.tar.gz.
File metadata
- Download URL: llm_fingerprint-0.5.2.tar.gz
- Upload date:
- Size: 119.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4ba76242900d01112f9175575e6c567c6f9670d96d73f240d52350a29083e98
|
|
| MD5 |
915c813c53f482d4d775d65d9925761b
|
|
| BLAKE2b-256 |
46b36f6daef4e12d611f96fa1d7dfaeed472c2e9dbb930708365f353da37ff91
|
File details
Details for the file llm_fingerprint-0.5.2-py3-none-any.whl.
File metadata
- Download URL: llm_fingerprint-0.5.2-py3-none-any.whl
- Upload date:
- Size: 14.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
783e1ee90bb1430291bae7103ca443434bffa435cfa556a2f3884948bafac2c2
|
|
| MD5 |
a2f26f783b409a5ce943b20138db5fb0
|
|
| BLAKE2b-256 |
fad1b84f3988e25609abfe747a4d8bfe0d83343016615f9f98eceb2d35ea20fd
|