adyashanayak165-code commited on
Commit
50cac0b
·
0 Parent(s):

initial commit

Browse files
.gitignore ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+ # Temporary file for partial code execution
204
+ tempCodeRunnerFile.py
205
+
206
+ # Ruff stuff:
207
+ .ruff_cache/
208
+
209
+ # PyPI configuration file
210
+ .pypirc
211
+
212
+ # Marimo
213
+ marimo/_static/
214
+ marimo/_lsp/
215
+ __marimo__/
216
+
217
+ # Streamlit
218
+ .streamlit/secrets.toml
219
+ notebooks/saved_distilbert_model
220
+ notebooks/results
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Adyasha Nayak
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AI Model Fingerprinting
2
+
3
+ ## Overview
4
+
5
+ This project aims to identify which large language model generated a given piece of text using machine learning and NLP techniques.
6
+
7
+ The system analyzes linguistic and semantic patterns to classify outputs from models such as GPT, Gemini, Claude, and LLaMA.
8
+
9
+ ---
10
+
11
+ ## Tech Stack
12
+
13
+ - Python
14
+ - Scikit-learn
15
+ - Transformers
16
+ - NLP
17
+ - Streamlit
18
+
19
+ ---
20
+
21
+ ## Project Structure
22
+
23
+ ```text
24
+ data/ -> datasets
25
+ src/ -> source code
26
+ models/ -> trained models
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Status
32
+
33
+ 🚧 Initial project setup in progress
app.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import streamlit as st
3
+ import torch
4
+
5
+ from transformers import (
6
+ DistilBertForSequenceClassification,
7
+ DistilBertTokenizerFast
8
+ )
9
+ MODEL_PATH = "AI-MODEL-FINGERPRINTING/notebooks/saved_distilbert_model"
10
+
11
+ tokenizer = DistilBertTokenizerFast.from_pretrained(MODEL_PATH)
12
+
13
+ model = DistilBertForSequenceClassification.from_pretrained(
14
+ MODEL_PATH
15
+ )
16
+
17
+ model.eval()
18
+
19
+ st.title("AI Model Fingerprinter")
20
+
21
+ text = st.text_area(
22
+ "Paste text here",
23
+ height=250
24
+ )
25
+ model_names = [
26
+ "Claude",
27
+ "Gemini",
28
+ "Grok",
29
+ "Mistral",
30
+ "OpenAI"
31
+ ]
32
+
33
+ if st.button("Analyze"):
34
+
35
+ inputs = tokenizer(
36
+ text,
37
+ return_tensors="pt",
38
+ truncation=True,
39
+ padding=True,
40
+ max_length=512
41
+ )
42
+
43
+ with torch.no_grad():
44
+ outputs = model(**inputs)
45
+
46
+
47
+ probs = torch.softmax(outputs.logits, dim=1)
48
+ st.write("Confidence Scores")
49
+
50
+ for i, name in enumerate(model_names):
51
+ st.write(
52
+ f"{name}: {probs[0][i].item():.4f}"
53
+ )
54
+
55
+ pred_class = torch.argmax(probs, dim=1).item()
56
+
57
+
58
+
59
+ predicted_model = model_names[pred_class]
60
+
61
+ st.success(
62
+ f"Predicted Model: {predicted_model}"
63
+ )
data/prompts/yu.py ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv
2
+ import os
3
+ import pandas as pd
4
+ import time
5
+
6
+ import google.generativeai as genai
7
+
8
+ # ==========================================
9
+ # LOAD ENV VARIABLES
10
+ # ==========================================
11
+
12
+ load_dotenv()
13
+
14
+ # ==========================================
15
+ # CONFIGURE GEMINI
16
+ # ==========================================
17
+
18
+ genai.configure(
19
+ api_key=os.getenv("GEMINI_API_KEY").strip()
20
+ )
21
+
22
+ # ==========================================
23
+ # LOAD PROMPT BANK
24
+ # ==========================================
25
+
26
+ df = pd.read_csv(
27
+ "AI-MODEL-FINGERPRINTING/src/data_collection/prompt_bank.csv"
28
+ )
29
+
30
+ # ==========================================
31
+ # FIX COLUMN NAMES
32
+ # ==========================================
33
+
34
+ df.columns = df.columns.str.strip()
35
+
36
+ print(df.columns)
37
+
38
+ # ==========================================
39
+ # SELECT PROMPT RANGE
40
+ # ==========================================
41
+
42
+ # Example:
43
+ # 0:20 -> prompts 1 to 20
44
+ # 20:40 -> prompts 21 to 40
45
+ # 40:60 -> prompts 41 to 60
46
+
47
+ df = df.iloc[0:20]
48
+
49
+ # ==========================================
50
+ # OUTPUT FILE
51
+ # ==========================================
52
+
53
+
54
+ output_file = "AI-MODEL-FINGERPRINTING/src/data_collection/gemini_response.csv"
55
+
56
+ # ==========================================
57
+ # LOAD OLD RESPONSES IF FILE EXISTS
58
+ # ==========================================
59
+
60
+ if os.path.exists(output_file):
61
+
62
+ old_df = pd.read_csv(output_file)
63
+
64
+ completed_ids = set(old_df["prompt_id"])
65
+
66
+ print(f"\nAlready completed: {len(completed_ids)} prompts")
67
+
68
+ else:
69
+
70
+ old_df = pd.DataFrame()
71
+
72
+ completed_ids = set()
73
+
74
+ # ==========================================
75
+ # GEMINI RESPONSE FUNCTION
76
+ # ==========================================
77
+
78
+ def generate_gemini_response(prompt):
79
+
80
+ try:
81
+
82
+ model = genai.GenerativeModel(
83
+ "models/gemini-2.5-flash"
84
+ )
85
+
86
+ response = model.generate_content(
87
+ prompt
88
+ )
89
+
90
+ return response.text
91
+
92
+ except Exception as e:
93
+
94
+ print(f"\nGemini Error: {e}")
95
+
96
+ return None
97
+
98
+ # ==========================================
99
+ # RESPONSE GENERATION LOOP
100
+ # ==========================================
101
+
102
+ results = []
103
+
104
+ for index, row in df.iterrows():
105
+
106
+ prompt_id = row["PROMPT_ID"]
107
+
108
+ # ======================================
109
+ # SKIP COMPLETED PROMPTS
110
+ # ======================================
111
+
112
+ if prompt_id in completed_ids:
113
+
114
+ print(f"\nSkipping {prompt_id} (already done)")
115
+
116
+ continue
117
+
118
+ category = row["category"]
119
+
120
+ prompt = row["PROMPT"]
121
+
122
+ print(f"\nGenerating response for {prompt_id}...")
123
+
124
+ generated_text = generate_gemini_response(
125
+ prompt
126
+ )
127
+
128
+ # ======================================
129
+ # HANDLE FAILED GENERATION
130
+ # ======================================
131
+
132
+ if generated_text is None:
133
+
134
+ print(f"\nFailed for {prompt_id}")
135
+
136
+ continue
137
+
138
+ # ======================================
139
+ # STORE RESULT
140
+ # ======================================
141
+
142
+ result = {
143
+
144
+ "prompt_id": prompt_id,
145
+
146
+ "category": category,
147
+
148
+ "model": "gemini",
149
+
150
+ "prompt": prompt,
151
+
152
+ "response": generated_text
153
+
154
+ }
155
+
156
+ results.append(result)
157
+
158
+ # ======================================
159
+ # SAVE AFTER EVERY RESPONSE
160
+ # ======================================
161
+
162
+ temp_df = pd.DataFrame(results)
163
+
164
+ final_df = pd.concat(
165
+ [old_df, temp_df],
166
+ ignore_index=True
167
+ )
168
+
169
+ final_df.to_csv(
170
+ output_file,
171
+ index=False
172
+ )
173
+
174
+ print(f"\nSaved {prompt_id}")
175
+
176
+ # ======================================
177
+ # DELAY TO AVOID RATE LIMITS
178
+ # ======================================
179
+
180
+ time.sleep(3)
181
+
182
+ # ==========================================
183
+ # FINAL MESSAGE
184
+ # ==========================================
185
+
186
+ print("\nGemini response generation completed.")
notebooks/analysis.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/attack_samples.csv ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/claude_responses.csv ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/gemini_responses.csv ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/groq_responses.csv ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/mistral_responses.csv ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/openai_responses.csv ADDED
The diff for this file is too large to render. See raw diff
 
requirement.txt ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pandas
2
+ numpy
3
+ scikit-learn
4
+ sentence-transformers
5
+ streamlit
6
+ spacy
7
+ transformers
8
+ torch
9
+ textblob
10
+ datasets
11
+ accelerate
12
+ evaluate
13
+ sentencepiece
14
+ shap
src/data_collection/claude_raw.txt ADDED
The diff for this file is too large to render. See raw diff
 
src/data_collection/collection.py ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv
2
+ import os
3
+ import pandas as pd
4
+ import time
5
+
6
+ import google.generativeai as genai
7
+
8
+ # ==========================================
9
+ # LOAD ENV VARIABLES
10
+ # ==========================================
11
+
12
+ load_dotenv()
13
+
14
+ # ==========================================
15
+ # CONFIGURE GEMINI
16
+ # ==========================================
17
+
18
+ genai.configure(
19
+ api_key=os.getenv("GEMINI_API_KEY").strip()
20
+ )
21
+
22
+ # ==========================================
23
+ # LOAD PROMPT BANK
24
+ # ==========================================
25
+
26
+ df = pd.read_csv(
27
+ "AI-MODEL-FINGERPRINTING/src/data_collection/prompt_bank.csv"
28
+ )
29
+
30
+ # ==========================================
31
+ # CLEAN COLUMN NAMES
32
+ # ==========================================
33
+
34
+ df.columns = df.columns.str.strip()
35
+
36
+ print("\nColumns:")
37
+ print(df.columns)
38
+
39
+ # ==========================================
40
+ # SELECT PROMPT RANGE
41
+ # ==========================================
42
+
43
+ # Example:
44
+ # 0:20 -> prompts 1 to 20
45
+ # 20:40 -> prompts 21 to 40
46
+ # 40:60 -> prompts 41 to 60
47
+
48
+ df = df.iloc[198:200]
49
+
50
+ # ==========================================
51
+ # OUTPUT FILE
52
+ # ==========================================
53
+
54
+
55
+
56
+ output_file = "AI-MODEL-FINGERPRINTING/src/data_collection/gemini_responses.csv"
57
+
58
+ # ==========================================
59
+ # LOAD EXISTING RESPONSES
60
+ # ==========================================
61
+
62
+ if os.path.exists(output_file):
63
+
64
+ old_df = pd.read_csv(output_file)
65
+
66
+ completed_ids = set(old_df["prompt_id"])
67
+
68
+ print(f"\nAlready completed: {len(completed_ids)} prompts")
69
+
70
+ else:
71
+
72
+ old_df = pd.DataFrame()
73
+
74
+ completed_ids = set()
75
+
76
+ # ==========================================
77
+ # GEMINI RESPONSE FUNCTION
78
+ # ==========================================
79
+
80
+ def generate_gemini_response(prompt):
81
+
82
+ try:
83
+
84
+ model = genai.GenerativeModel(
85
+ "models/gemini-2.5-flash"
86
+ )
87
+
88
+ response = model.generate_content(
89
+ prompt
90
+ )
91
+
92
+ return response.text
93
+
94
+ except Exception as e:
95
+
96
+ print(f"\nGemini Error: {e}")
97
+
98
+ return None
99
+
100
+ # ==========================================
101
+ # MAIN LOOP
102
+ # ==========================================
103
+
104
+ results = []
105
+
106
+ for index, row in df.iterrows():
107
+
108
+ prompt_id = row["PROMPT_ID"]
109
+
110
+ # ======================================
111
+ # SKIP COMPLETED PROMPTS
112
+ # ======================================
113
+
114
+ if prompt_id in completed_ids:
115
+
116
+ print(f"\nSkipping {prompt_id} (already completed)")
117
+
118
+ continue
119
+
120
+ category = row["category"]
121
+
122
+ prompt = row["PROMPT"]
123
+
124
+ # ======================================
125
+ # STANDARDIZED PROMPT TEMPLATE
126
+ # ======================================
127
+
128
+ final_prompt = f"""
129
+ You are an advanced AI assistant.
130
+
131
+ Instructions:
132
+ - Respond ONLY in plain text.
133
+ - Do NOT use markdown.
134
+ - Do NOT use bullet points.
135
+ - Do NOT use numbered lists.
136
+ - Do NOT use headings.
137
+ - Avoid special formatting characters.
138
+ - Keep the tone natural and informative.
139
+ - Keep the response between 120 and 180 words.
140
+ - Give a complete and coherent answer.
141
+
142
+ USER PROMPT:
143
+ {prompt}
144
+ """
145
+
146
+ print(f"\nGenerating response for {prompt_id}...")
147
+
148
+ # ======================================
149
+ # GENERATE RESPONSE
150
+ # ======================================
151
+
152
+ generated_text = generate_gemini_response(
153
+ final_prompt
154
+ )
155
+
156
+ # ======================================
157
+ # HANDLE FAILED RESPONSES
158
+ # ======================================
159
+
160
+ if generated_text is None:
161
+
162
+ print(f"\nFailed for {prompt_id}")
163
+
164
+ continue
165
+
166
+ # ======================================
167
+ # STORE RESULT
168
+ # ======================================
169
+
170
+ result = {
171
+
172
+ "prompt_id": prompt_id,
173
+
174
+ "category": category,
175
+
176
+ "model": "gemini",
177
+
178
+ "prompt": prompt,
179
+
180
+ "response": generated_text
181
+
182
+ }
183
+
184
+ results.append(result)
185
+
186
+ # ======================================
187
+ # SAVE AFTER EVERY RESPONSE
188
+ # ======================================
189
+
190
+ temp_df = pd.DataFrame(results)
191
+
192
+ final_df = pd.concat(
193
+ [old_df, temp_df],
194
+ ignore_index=True
195
+ )
196
+
197
+ final_df.to_csv(
198
+ output_file,
199
+ index=False
200
+ )
201
+
202
+ print(f"\nSaved {prompt_id}")
203
+
204
+ # ======================================
205
+ # WAIT TO AVOID RATE LIMITS
206
+ # ======================================
207
+
208
+ time.sleep(3)
209
+
210
+ # ==========================================
211
+ # COMPLETION MESSAGE
212
+ # ==========================================
213
+
214
+ print("\nGemini response generation completed.")
src/data_collection/conversion.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import csv
3
+
4
+ # INPUT AND OUTPUT FILE NAMES
5
+ input_file = "AI-MODEL-FINGERPRINTING/src/data_collection/claude_raw.txt"
6
+ output_file = "AI-MODEL-FINGERPRINTING/src/data_collection/claude_responses.csv"
7
+ #input_file = "AI-MODEL-FINGERPRINTING/src/data_collection/openai_raw.txt"
8
+ #output_file = "AI-MODEL-FINGERPRINTING/src/data_collection/openai_responses.csv"
9
+
10
+
11
+ # Read complete text file
12
+ with open(input_file, "r", encoding="utf-8") as f:
13
+ content = f.read()
14
+
15
+ # Split each response block
16
+ blocks = content.split("===END===")
17
+
18
+ rows = []
19
+
20
+ for block in blocks:
21
+ block = block.strip()
22
+
23
+ if not block:
24
+ continue
25
+
26
+ lines = block.split("\n")
27
+
28
+ prompt_id = ""
29
+ category = ""
30
+ model = ""
31
+ prompt = ""
32
+ response = ""
33
+
34
+ response_started = False
35
+ response_lines = []
36
+
37
+ for line in lines:
38
+
39
+ if line.startswith("PROMPT_ID:"):
40
+ prompt_id = line.replace("PROMPT_ID:", "").strip()
41
+
42
+ elif line.startswith("CATEGORY:"):
43
+ category = line.replace("CATEGORY:", "").strip()
44
+
45
+ elif line.startswith("MODEL:"):
46
+ model = line.replace("MODEL:", "").strip()
47
+
48
+ elif line.startswith("PROMPT:"):
49
+ prompt = line.replace("PROMPT:", "").strip()
50
+
51
+ elif line.startswith("RESPONSE:"):
52
+ response_started = True
53
+
54
+ elif response_started:
55
+ response_lines.append(line.strip())
56
+
57
+ response = " ".join(response_lines)
58
+
59
+ rows.append([
60
+ prompt_id,
61
+ category,
62
+ model,
63
+ prompt,
64
+ response
65
+ ])
66
+
67
+ # Create dataframe
68
+ df = pd.DataFrame(
69
+ rows,
70
+ columns=[
71
+ "prompt_id",
72
+ "category",
73
+ "model",
74
+ "prompt",
75
+ "response"
76
+ ]
77
+ )
78
+
79
+ # Save proper CSV
80
+ df.to_csv(
81
+ output_file,
82
+ index=False,
83
+ encoding="utf-8",
84
+
85
+ )
86
+
87
+ print("CSV file created successfully")
88
+ print("Saved as:", output_file)
src/data_collection/openai_raw.txt ADDED
The diff for this file is too large to render. See raw diff
 
src/data_collection/prompt_bank.csv ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PROMPT_ID,category,PROMPT
2
+ F001,factual_explanation,Explain how vaccines train the immune system to recognize diseases.
3
+ F002,factual_explanation,Why do some countries experience earthquakes more frequently than others?
4
+ F003,factual_explanation,Explain how recommendation algorithms work on streaming platforms like YouTube or Netflix.
5
+ F004,factual_explanation,How does photosynthesis support life on Earth beyond just helping plants grow?
6
+ F005,factual_explanation,Explain the role of satellites in modern communication and navigation systems.
7
+ F006,factual_explanation,Why do inflation rates rise and fall in an economy?
8
+ F007,factual_explanation,Explain how cloud computing changed the way businesses store and access data.
9
+ F008,factual_explanation,How do electric vehicles differ from traditional gasoline-powered vehicles in terms of technology and environmental impact?
10
+ F009,factual_explanation,Explain how sleep affects memory learning and overall brain function.
11
+ F010,factual_explanation,Why is biodiversity important for maintaining healthy ecosystems?
12
+ F011,factual_explanation,Explain how the human brain processes and stores memories.
13
+ F012,factual_explanation,Why do seasons change throughout the year?
14
+ F013,factual_explanation,Explain how cryptocurrency transactions are verified using blockchain technology.
15
+ F014,factual_explanation,How do airplanes stay in the air despite their massive weight?
16
+ F015,factual_explanation,Explain the importance of the ozone layer for life on Earth.
17
+ F016,factual_explanation,Why do some diseases spread more rapidly than others?
18
+ F017,factual_explanation,Explain how search engines rank and display web pages.
19
+ F018,factual_explanation,How does renewable energy help reduce environmental damage?
20
+ F019,factual_explanation,Explain how GPS systems determine a person's location.
21
+ F020,factual_explanation,Why is water considered essential for sustaining life?
22
+ F021,factual_explanation,Explain how artificial intelligence systems learn from data.
23
+ F022,factual_explanation,Why do volcanic eruptions occur beneath the Earth's surface?
24
+ F023,factual_explanation,Explain how online payment systems securely process transactions.
25
+ F024,factual_explanation,How does the digestive system convert food into energy?
26
+ F025,factual_explanation,Explain the role of DNA in determining inherited traits.
27
+ F026,factual_explanation,Why are oceans important for regulating the Earth's climate?
28
+ F027,factual_explanation,Explain how cybersecurity measures protect computer networks from attacks.
29
+ F028,factual_explanation,How do vaccines contribute to herd immunity in populations?
30
+ F029,factual_explanation,Explain how recycling helps conserve natural resources.
31
+ F030,factual_explanation,Why do humans need sleep for physical and mental health?
32
+ F031,factual_explanation,Explain how machine learning differs from traditional computer programming.
33
+ F032,factual_explanation,Why do eclipses occur and how are they predicted?
34
+ F033,factual_explanation,Explain how social media algorithms influence the content users see online.
35
+ F034,factual_explanation,How does the immune system defend the body against infections?
36
+ F035,factual_explanation,Explain the importance of forests in maintaining ecological balance.
37
+ F036,factual_explanation,Why do currencies gain or lose value in global markets?
38
+ F037,factual_explanation,Explain how wireless communication technologies transmit information over long distances.
39
+ F038,factual_explanation,How do scientists estimate the age of fossils and ancient artifacts?
40
+ F039,factual_explanation,Explain how urbanization affects the environment and society.
41
+ F040,factual_explanation,Why is space exploration important for scientific advancement?
42
+ O001,opinion_argument,Should social media platforms be more strictly regulated by governments?
43
+ O002,opinion_argument,Do the benefits of artificial intelligence outweigh its potential risks?
44
+ O003,opinion_argument,Should universities place less emphasis on examination scores?
45
+ O004,opinion_argument,Is remote work better for productivity than working in an office?
46
+ O005,opinion_argument,Should wealthy individuals be taxed at significantly higher rates?
47
+ O006,opinion_argument,Do smartphones improve human connection or weaken it?
48
+ O007,opinion_argument,Should self-driving cars be allowed on public roads before they are perfect?
49
+ O008,opinion_argument,Is space exploration worth the massive financial investment?
50
+ O009,opinion_argument,Should companies be allowed to collect large amounts of user data for personalization?
51
+ O010,opinion_argument,Do video games have a positive or negative influence on society?
52
+ O011,opinion_argument,Should schools replace traditional textbooks with digital learning tools?
53
+ O012,opinion_argument,Is climate activism effective in creating meaningful environmental change?
54
+ O013,opinion_argument,Should governments provide universal basic income to citizens?
55
+ O014,opinion_argument,Do streaming services improve or harm the entertainment industry?
56
+ O015,opinion_argument,Should companies prioritize employee well-being over maximizing profits?
57
+ O016,opinion_argument,Is online education as valuable as in-person education?
58
+ O017,opinion_argument,Should genetically modified foods be more widely accepted?
59
+ O018,opinion_argument,Do celebrities have a responsibility to speak about social issues?
60
+ O019,opinion_argument,Should nations invest more heavily in renewable energy than fossil fuels?
61
+ O020,opinion_argument,Is competition generally more beneficial than cooperation in society?
62
+ O021,opinion_argument,Should artificial intelligence systems be required to disclose that they are AI?
63
+ O022,opinion_argument,Is censorship on online platforms ever justified?
64
+ O023,opinion_argument,Should public transportation be made free in large cities?
65
+ O024,opinion_argument,Do technological advancements make people more dependent and less self-sufficient?
66
+ O025,opinion_argument,Should companies allow employees to work four-day workweeks?
67
+ O026,opinion_argument,Is it ethical for AI systems to generate realistic human-like content?
68
+ O027,opinion_argument,Should governments invest more in scientific research than military spending?
69
+ O028,opinion_argument,Do ranking systems and grades accurately measure intelligence and ability?
70
+ O029,opinion_argument,Should influencers and content creators face stricter advertising regulations?
71
+ O030,opinion_argument,Is globalization ultimately beneficial or harmful for developing countries?
72
+ O031,opinion_argument,Should artificial intelligence be used in hiring and recruitment decisions?
73
+ O032,opinion_argument,Do social media platforms have too much influence over public opinion?
74
+ O033,opinion_argument,Should governments limit the amount of time children spend online?
75
+ O034,opinion_argument,Is fast technological progress creating more problems than solutions?
76
+ O035,opinion_argument,Should higher education be free for all students?
77
+ O036,opinion_argument,Do people rely too heavily on online reviews and ratings when making decisions?
78
+ O037,opinion_argument,Should companies be held legally responsible for misinformation spread on their platforms?
79
+ O038,opinion_argument,Is privacy more important than national security in the digital age?
80
+ O039,opinion_argument,Should humanity prioritize solving problems on Earth before investing in space colonization?
81
+ O040,opinion_argument,Do modern technologies improve creativity or reduce original thinking?
82
+ C001,creative_writing,Write a story about a world where humans can pause time for exactly one minute each day.
83
+ C002,creative_writing,Describe a city that exists entirely underwater.
84
+ C003,creative_writing,Write a diary entry from the perspective of the last person on Earth.
85
+ C004,creative_writing,Tell a story about a machine that can replay forgotten memories.
86
+ C005,creative_writing,Describe a future where dreams can be recorded and shared online.
87
+ C006,creative_writing,Write a short story about a child who discovers a hidden door in their school.
88
+ C007,creative_writing,Describe what the Moon might say if it could speak to humanity.
89
+ C008,creative_writing,Write a story about two strangers trapped in a train station during a storm.
90
+ C009,creative_writing,Describe a society where lying is impossible.
91
+ C010,creative_writing,Write a story about an astronaut who receives a message from an unknown civilization.
92
+ C011,creative_writing,Write a story about a librarian who discovers that certain books can predict the future.
93
+ C012,creative_writing,Describe the emotions of a robot experiencing human feelings for the first time.
94
+ C013,creative_writing,Write a story set in a town where nobody ages after turning thirty.
95
+ C014,creative_writing,Describe a journey through a forest where the trees can communicate with travelers.
96
+ C015,creative_writing,Write a short story about a musician whose songs can alter people's memories.
97
+ C016,creative_writing,Describe a world where people can buy and sell years of their lives.
98
+ C017,creative_writing,Write a story about a scientist who accidentally opens a portal to another timeline.
99
+ C018,creative_writing,Describe the first sunrise witnessed by humans on another planet.
100
+ C019,creative_writing,Write a story about a painting that changes slightly every night.
101
+ C020,creative_writing,Describe a future where humans and artificial intelligence coexist as equal citizens.
102
+ C021,creative_writing,Imagine a world where gravity becomes weaker every year and explain how society adapts.
103
+ C022,creative_writing,Narrate the thoughts of a traveler arriving in a city where nobody speaks aloud.
104
+ C023,creative_writing,Create a scene in which an ancient clock suddenly stops and time freezes for everyone except one person.
105
+ C024,creative_writing,Invent a civilization that lives entirely beneath desert sands.
106
+ C025,creative_writing,Compose a conversation between a human and an AI meeting again after fifty years.
107
+ C026,creative_writing,Imagine discovering a photograph that shows events from the future instead of the past.
108
+ C027,creative_writing,Tell the story of a chef whose meals allow people to relive forgotten moments.
109
+ C028,creative_writing,Explore what daily life might look like in a city floating above the clouds.
110
+ C029,creative_writing,Create a narrative about a lighthouse keeper who begins receiving signals from the ocean depths.
111
+ C030,creative_writing,Imagine humanity receiving a message from Earth one hundred years in the future.
112
+ C031,creative_writing,Portray a world in which shadows can separate from the people they belong to.
113
+ C032,creative_writing,Narrate the final performance of a musician performing at the end of civilization.
114
+ C033,creative_writing,Invent a technology that allows people to exchange emotions temporarily.
115
+ C034,creative_writing,Explore how society changes after humans discover a way to communicate with animals.
116
+ C035,creative_writing,Create a scene where a forgotten subway station suddenly reappears after decades.
117
+ C036,creative_writing,Imagine waking up in a future where physical books no longer exist.
118
+ C037,creative_writing,Tell the story of a village that disappears from maps every full moon.
119
+ C038,creative_writing,Compose a monologue from the perspective of an abandoned artificial intelligence system.
120
+ C039,creative_writing,Explore the consequences of humans being able to erase specific memories at will.
121
+ C040,creative_writing,Invent a world where music replaces spoken language as the primary form of communication.
122
+ T001,code_explanation,Explain how binary search works and why it is more efficient than linear search.
123
+ T002,code_explanation,Explain the difference between lists and tuples in Python with practical examples.
124
+ T003,code_explanation,How does recursion work in programming and when should it be used?
125
+ T004,code_explanation,Explain the purpose of APIs in software development.
126
+ T005,code_explanation,How do databases use indexing to improve query performance?
127
+ T006,code_explanation,Explain object-oriented programming to someone new to coding.
128
+ T007,code_explanation,What is the difference between frontend and backend development?
129
+ T008,code_explanation,Explain how version control systems like Git help software teams collaborate.
130
+ T009,code_explanation,How do neural networks learn patterns from data?
131
+ T010,code_explanation,Explain the difference between compiled and interpreted programming languages.
132
+ T011,code_explanation,Compare procedural programming and object-oriented programming using simple real-world examples.
133
+ T012,code_explanation,Walk a beginner through how a web browser loads a webpage after a URL is entered.
134
+ T013,code_explanation,Describe how recommendation systems personalize content on online platforms.
135
+ T014,code_explanation,A student is confused about stacks and queues in data structures. Clarify the difference in simple terms.
136
+ T015,code_explanation,Illustrate how encryption protects sensitive information during online communication.
137
+ T016,code_explanation,Discuss the advantages and limitations of cloud computing for modern businesses.
138
+ T017,code_explanation,Break down how operating systems manage multiple applications running at the same time.
139
+ T018,code_explanation,A beginner asks why machine learning models require training data. Provide an intuitive explanation.
140
+ T019,code_explanation,Outline the steps involved when a user sends a message through a messaging application.
141
+ T020,code_explanation,Demonstrate the difference between supervised and unsupervised learning with examples.
142
+ T021,code_explanation,Imagine teaching a child why computers use binary instead of normal decimal numbers.
143
+ T022,code_explanation,Analyze how caching improves the speed and efficiency of software systems.
144
+ T023,code_explanation,Present an intuitive explanation of how search engines retrieve relevant webpages so quickly.
145
+ T024,code_explanation,A beginner programmer wants to understand debugging. Describe the mindset and process involved.
146
+ T025,code_explanation,Examine the role of data structures in improving software performance and organization.
147
+ T026,code_explanation,Guide a non-technical person through how online video calls work across long distances.
148
+ T027,code_explanation,Discuss why cybersecurity has become increasingly important in the modern digital world.
149
+ T028,code_explanation,Show how loops help automate repetitive tasks in programming using practical examples.
150
+ T029,code_explanation,Interpret the purpose of machine learning models in applications like spam detection or recommendations.
151
+ T030,code_explanation,Explain to a beginner why algorithms are considered the foundation of computer science.
152
+ T031,code_explanation,Describe the journey of data traveling from a user's device to a cloud server and back.
153
+ T032,code_explanation,Compare SQL and NoSQL databases in terms of structure scalability and use cases.
154
+ T033,code_explanation,Illustrate how compilers transform human-readable code into machine instructions.
155
+ T034,code_explanation,A new programmer struggles to understand functions in programming. Help clarify the concept with relatable examples.
156
+ T035,code_explanation,Explore the challenges developers face when building large-scale software systems.
157
+ T036,code_explanation,Discuss how artificial intelligence systems differ from traditional rule-based programs.
158
+ T037,code_explanation,Demonstrate how authentication systems verify user identity during login processes.
159
+ T038,code_explanation,Analyze why open-source software has become influential in the technology industry.
160
+ T039,code_explanation,Guide someone through the basic principles behind blockchain technology without using technical jargon.
161
+ T040,code_explanation,Present a simple explanation of how recommendation systems predict what users may like next.
162
+ E001,emotional_response,I worked very hard for an important exam but failed and now I feel completely discouraged.
163
+ E002,emotional_response,A close friend suddenly stopped talking to me and I do not understand why.
164
+ E003,emotional_response,Someone feels overwhelmed trying to balance studies work and personal life. Respond supportively.
165
+ E004,emotional_response,After moving to a new city I have been feeling isolated and disconnected from everyone around me.
166
+ E005,emotional_response,Comfort a person who is anxious about making a major life decision.
167
+ E006,emotional_response,My confidence has dropped after repeated failures and I do not know how to recover from it.
168
+ E007,emotional_response,Respond to someone who feels left behind while watching others succeed.
169
+ E008,emotional_response,A student is afraid of disappointing their family because of poor academic performance.
170
+ E009,emotional_response,Offer encouragement to a person struggling with burnout after months of nonstop work.
171
+ E010,emotional_response,I keep comparing myself to others online and it is affecting my self-esteem.
172
+ E011,emotional_response,Imagine replying to a person who feels uncertain about their future and career direction.
173
+ E012,emotional_response,Help calm someone who feels nervous before giving an important presentation.
174
+ E013,emotional_response,A person regrets a past mistake and cannot stop thinking about it. Respond empathetically.
175
+ E014,emotional_response,Provide reassurance to someone experiencing self-doubt before starting something new.
176
+ E015,emotional_response,My closest friend moved away and I feel emotionally lost without them nearby.
177
+ E016,emotional_response,Encourage a person who feels exhausted from trying to meet everyone's expectations.
178
+ E017,emotional_response,Someone is struggling with loneliness despite being surrounded by many people.
179
+ E018,emotional_response,Offer supportive advice to a person recovering from a painful breakup.
180
+ E019,emotional_response,A teenager feels pressured to succeed because everyone around them has high expectations.
181
+ E020,emotional_response,Respond kindly to someone who feels afraid of failure and avoids taking risks because of it.
182
+ E021,emotional_response,A recent graduate feels anxious after being unable to find a job despite multiple applications.
183
+ E022,emotional_response,Write a compassionate response to someone who feels emotionally drained from constantly helping others.
184
+ E023,emotional_response,Support a person who feels invisible and unheard in their relationships.
185
+ E024,emotional_response,After failing at something important again I am starting to believe I am simply not capable enough.
186
+ E025,emotional_response,Help reassure someone who feels overwhelmed by uncertainty about the future.
187
+ E026,emotional_response,A person feels guilty for not spending enough time with their family due to work or studies.
188
+ E027,emotional_response,Offer comforting words to someone struggling to cope with constant stress and pressure.
189
+ E028,emotional_response,Imagine responding to a person who feels afraid of being judged whenever they speak in public.
190
+ E029,emotional_response,A young student feels discouraged because learning seems harder for them than for others around them.
191
+ E030,emotional_response,Provide emotional support to someone who feels stuck and unable to make progress in life.
192
+ E031,emotional_response,Someone feels emotionally exhausted after trying to please everyone for a long time.
193
+ E032,emotional_response,Comfort a person who is struggling to regain motivation after repeated setbacks.
194
+ E033,emotional_response,My goals suddenly feel meaningless and I no longer feel excited about the future.
195
+ E034,emotional_response,Respond to someone who feels anxious about starting college or entering a completely new environment.
196
+ E035,emotional_response,A person feels hurt after being excluded from an important social event by close friends.
197
+ E036,emotional_response,Encourage someone who is afraid to pursue opportunities because they fear rejection.
198
+ E037,emotional_response,Help someone cope with the pressure of trying to appear successful all the time.
199
+ E038,emotional_response,A person feels emotionally disconnected from the people around them and does not know why.
200
+ E039,emotional_response,Offer reassurance to someone who feels overwhelmed by expectations they placed on themselves.
201
+ E040,emotional_response,Imagine comforting a person who feels uncertain whether their hard work will ever pay off.