Sujal Bhat commited on
Commit
35d7369
0 Parent(s):

Initial commit without large files

Browse files
.gitignore ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Virtual environment
2
+ venv/
3
+ env/
4
+ .venv/
5
+
6
+ #pdf files for generating embeddings
7
+ resources/
8
+
9
+ # Python cache files
10
+ __pycache__/
11
+ *.py[cod]
12
+
13
+ # Environment variables
14
+ .env
15
+
16
+ # Local development settings
17
+ .idea/
18
+ .vscode/
19
+
20
+ # OS generated files
21
+ .DS_Store
22
+ Thumbs.db
23
+
24
+ # Logs
25
+ *.log
26
+
27
+ # Distribution / packaging
28
+ dist/
29
+ build/
30
+ *.egg-info/
31
+
32
+ # Jupyter Notebook
33
+ .ipynb_checkpoints
34
+
35
+ # pytest
36
+ .pytest_cache/
37
+
38
+ # mypy
39
+ .mypy_cache/
40
+
41
+ # Coverage reports
42
+ htmlcov/
43
+ .coverage
44
+
45
+ # Chainlit files
46
+ .chainlit/
47
+
48
+ # Editor history
49
+ .history/
Dockerfile ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
3
+ WORKDIR /code
4
+
5
+ COPY ./requirements.txt /code/requirements.txt
6
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
7
+
8
+ COPY . /code
9
+
10
+ CMD ["chainlit", "run", "chainlit_app.py", "--host", "0.0.0.0", "--port", "7860"]
app.py ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Required Libraries
2
+ import fitz # PyMuPDF
3
+ import os
4
+ from langchain_openai import OpenAIEmbeddings
5
+ from langchain.text_splitter import RecursiveCharacterTextSplitter
6
+ from dotenv import load_dotenv
7
+ from qdrant_client import QdrantClient # Import Qdrant client
8
+ import uuid # Add this import at the top of your file
9
+ import json
10
+
11
+ # Load environment variables from .env file
12
+ load_dotenv()
13
+
14
+ # Initialize Qdrant client
15
+ qdrant_api_key = os.getenv("QDRANT_API_KEY") # Get the Qdrant API key from environment variables
16
+ qdrant_client = QdrantClient(
17
+ url="https://9266da83-dbfe-48d6-b2d8-cdf101299284.europe-west3-0.gcp.cloud.qdrant.io",
18
+ api_key=qdrant_api_key,
19
+ timeout=300 # 5 minutes timeout
20
+ )
21
+
22
+ # New function to load processed documents
23
+ def load_processed_docs():
24
+ try:
25
+ with open('processed_docs.json', 'r') as f:
26
+ return set(json.load(f))
27
+ except FileNotFoundError:
28
+ return set()
29
+
30
+ # New function to save processed documents
31
+ def save_processed_docs(processed_docs):
32
+ with open('processed_docs.json', 'w') as f:
33
+ json.dump(list(processed_docs), f)
34
+
35
+ # Modified function to create the Qdrant collection if it doesn't exist
36
+ def create_qdrant_collection(collection_name, vector_size):
37
+ try:
38
+ # Check if the collection already exists
39
+ collection_info = qdrant_client.get_collection(collection_name)
40
+ print(f"Collection '{collection_name}' already exists.")
41
+ except Exception as e:
42
+ # If the collection doesn't exist, create it
43
+ qdrant_client.create_collection(
44
+ collection_name=collection_name,
45
+ vectors_config={
46
+ "size": vector_size,
47
+ "distance": "Cosine"
48
+ }
49
+ )
50
+ print(f"Collection '{collection_name}' created successfully.")
51
+
52
+ # Modified function to store embeddings in Qdrant
53
+ def store_embeddings_in_qdrant(embedded_chunks, collection_name):
54
+ points = []
55
+ for theme, embeddings in embedded_chunks.items():
56
+ for embedding in embeddings:
57
+ points.append({
58
+ "id": str(uuid.uuid4()), # Generate a UUID for each point
59
+ "vector": embedding,
60
+ "payload": {"theme": theme}
61
+ })
62
+
63
+ # Batch upload points
64
+ batch_size = 100
65
+ for i in range(0, len(points), batch_size):
66
+ batch = points[i:i+batch_size]
67
+ try:
68
+ qdrant_client.upsert(
69
+ collection_name=collection_name,
70
+ points=batch
71
+ )
72
+ print(f"Uploaded batch {i//batch_size + 1} to collection '{collection_name}'.")
73
+ except Exception as e:
74
+ print(f"Error uploading batch {i//batch_size + 1}: {e}")
75
+
76
+ print(f"Finished uploading {len(points)} points to collection '{collection_name}'.")
77
+
78
+ # Step 1: Extract Text from PDFs
79
+ def extract_text_from_pdf(pdf_path):
80
+ doc = fitz.open(pdf_path)
81
+ text = ""
82
+ for page in doc:
83
+ text += page.get_text()
84
+ return text
85
+
86
+ # Step 2: Define Themes
87
+ themes = [
88
+ "Safe and Effective Systems",
89
+ "Algorithmic Discrimination Protections",
90
+ "Data Privacy",
91
+ "Notice and Explanation",
92
+ "Human Alternatives",
93
+ "Risk Management",
94
+ "Governance",
95
+ "Trustworthiness",
96
+ "Unclassified"
97
+ ]
98
+
99
+ # Step 3: Chunk the Text
100
+ def chunk_text(text, themes):
101
+ text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
102
+ chunks = text_splitter.split_text(text)
103
+ thematic_chunks = {theme: [] for theme in themes}
104
+ thematic_chunks["Unclassified"] = [] # Add an "Unclassified" category
105
+
106
+ for chunk in chunks:
107
+ theme_found = False
108
+ for theme in themes:
109
+ if theme.lower() in chunk.lower():
110
+ thematic_chunks[theme].append(chunk)
111
+ theme_found = True
112
+ break
113
+ if not theme_found:
114
+ thematic_chunks["Unclassified"].append(chunk)
115
+ return thematic_chunks
116
+
117
+ # Step 4: Embed the Chunks
118
+ def embed_chunks(thematic_chunks):
119
+ openai_api_key = os.getenv("OPENAI_API_KEY") # Get the API key from environment variables
120
+ embeddings = OpenAIEmbeddings(model="text-embedding-3-small",openai_api_key=openai_api_key)
121
+ embedded_chunks = {theme: embeddings.embed_documents(chunks) for theme, chunks in thematic_chunks.items()}
122
+ return embedded_chunks
123
+
124
+ # Modified main execution block
125
+ def main():
126
+ resources_folder = "resources"
127
+ processed_docs = load_processed_docs()
128
+ new_docs_processed = False
129
+
130
+ collection_name = "ai_info_collection"
131
+
132
+ for filename in os.listdir(resources_folder):
133
+ if filename.endswith(".pdf") and filename not in processed_docs:
134
+ pdf_path = os.path.join(resources_folder, filename)
135
+ text = extract_text_from_pdf(pdf_path)
136
+ thematic_chunks = chunk_text(text, themes)
137
+ embedded_chunks = embed_chunks(thematic_chunks)
138
+
139
+ # Ensure the collection exists
140
+ if not new_docs_processed:
141
+ vector_size = len(next(iter(embedded_chunks.values()))[0])
142
+ create_qdrant_collection(collection_name, vector_size)
143
+
144
+ # Store embeddings for this document
145
+ store_embeddings_in_qdrant(embedded_chunks, collection_name)
146
+
147
+ processed_docs.add(filename)
148
+ new_docs_processed = True
149
+ print(f"Processed and added embeddings for {filename}")
150
+
151
+ if new_docs_processed:
152
+ save_processed_docs(processed_docs)
153
+ print("New documents processed and added to the collection.")
154
+ else:
155
+ print("No new documents to process.")
156
+
157
+ if __name__ == "__main__":
158
+ main()
app_interface.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import os
3
+ from dotenv import load_dotenv
4
+ from qdrant_client import QdrantClient
5
+ from langchain_openai import OpenAIEmbeddings, OpenAI
6
+ from langchain.chains import RetrievalQA
7
+ from langchain.vectorstores import Qdrant
8
+
9
+ # Load environment variables
10
+ load_dotenv()
11
+
12
+ # Initialize Qdrant client
13
+ qdrant_api_key = os.getenv("QDRANT_API_KEY")
14
+ qdrant_client = QdrantClient(
15
+ url="https://9266da83-dbfe-48d6-b2d8-cdf101299284.europe-west3-0.gcp.cloud.qdrant.io",
16
+ api_key=qdrant_api_key
17
+ )
18
+
19
+ # Initialize OpenAI
20
+ openai_api_key = os.getenv("OPENAI_API_KEY")
21
+ embeddings = OpenAIEmbeddings(openai_api_key=openai_api_key)
22
+
23
+ # Set up Qdrant as a vector store
24
+ collection_name = "ai_info_collection"
25
+ vector_store = Qdrant(
26
+ client=qdrant_client,
27
+ collection_name=collection_name,
28
+ embeddings=embeddings,
29
+ )
30
+
31
+ # Set up retrieval QA chain
32
+ llm = OpenAI(temperature=0, openai_api_key=openai_api_key)
33
+ qa_chain = RetrievalQA.from_chain_type(
34
+ llm=llm,
35
+ chain_type="stuff",
36
+ retriever=vector_store.as_retriever()
37
+ )
38
+
39
+ # Streamlit interface
40
+ st.title("AI Information Assistant")
41
+
42
+ query = st.text_input("Ask a question about AI ethics, regulations, or policies:")
43
+
44
+ if query:
45
+ response = qa_chain.run(query)
46
+ st.write(response)
chainlit.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Welcome to Chainlit! 🚀🤖
2
+
3
+ Hi there, Developer! 👋 We're excited to have you on board. Chainlit is a powerful tool designed to help you prototype, debug and share applications built on top of LLMs.
4
+
5
+ ## Useful Links 🔗
6
+
7
+ - **Documentation:** Get started with our comprehensive [Chainlit Documentation](https://docs.chainlit.io) 📚
8
+ - **Discord Community:** Join our friendly [Chainlit Discord](https://discord.gg/k73SQ3FyUh) to ask questions, share your projects, and connect with other developers! 💬
9
+
10
+ We can't wait to see what you create with Chainlit! Happy coding! 💻😊
11
+
12
+ ## Welcome screen
13
+
14
+ To modify the welcome screen, edit the `chainlit.md` file at the root of your project. If you do not want a welcome screen, just leave this file empty.
chainlit_app.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from dotenv import load_dotenv
3
+ from qdrant_client import QdrantClient
4
+ from langchain_openai import OpenAIEmbeddings, OpenAI
5
+ from langchain_community.vectorstores import Qdrant as QdrantVectorStore
6
+ import chainlit as cl
7
+ from langchain_openai import ChatOpenAI
8
+ from langchain_qdrant import Qdrant
9
+
10
+
11
+
12
+
13
+ # Load environment variables
14
+ load_dotenv()
15
+
16
+ # Initialize Qdrant client
17
+ openai_api_key = os.getenv("OPENAI_API_KEY")
18
+ qdrant_api_key = os.getenv("QDRANT_API_KEY")
19
+ qdrant_url = os.getenv("QDRANT_URL")
20
+
21
+ qdrant_client = QdrantClient(
22
+ url=qdrant_url,
23
+ api_key=qdrant_api_key
24
+ )
25
+
26
+ # Initialize OpenAI
27
+
28
+ embeddings = OpenAIEmbeddings(model="text-embedding-3-small",openai_api_key=openai_api_key)
29
+ llm = ChatOpenAI(temperature=0, openai_api_key=openai_api_key)
30
+
31
+ # Initialize vector store
32
+ collection_name = "ai_info_collection"
33
+ vector_store = Qdrant(
34
+ client=qdrant_client,
35
+ collection_name=collection_name,
36
+ embeddings=embeddings,
37
+ )
38
+
39
+ @cl.on_chat_start
40
+ async def start():
41
+ await cl.Message(content="Welcome! Ask me anything about AI ethics, regulations, or policies.").send()
42
+
43
+ @cl.on_message
44
+ async def main(message: cl.Message):
45
+ query = message.content
46
+ print(f"Received query: {query}") # Basic console logging
47
+
48
+ try:
49
+ docs = vector_store.similarity_search(query, k=3)
50
+ print(f"Retrieved {len(docs)} documents") # Basic console logging
51
+
52
+ context = "\n".join(doc.page_content for doc in docs if doc.page_content)
53
+ prompt = f"Based on the following context, answer the question: {query}\n\nContext: {context}"
54
+
55
+ response = await llm.ainvoke(prompt)
56
+ print(f"Generated response: {response}") # Basic console logging
57
+
58
+ await cl.Message(content=response.content).send()
59
+
60
+ except Exception as e:
61
+ error_message = f"An error occurred: {str(e)}"
62
+ print(f"Error: {error_message}") # Basic console logging
63
+ await cl.Message(content=error_message).send()
clearQdrantCollection.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from qdrant_client import QdrantClient
2
+ from qdrant_client.http import models
3
+ from dotenv import load_dotenv
4
+ import os
5
+
6
+ # Load environment variables
7
+ load_dotenv()
8
+
9
+ # Initialize Qdrant client
10
+ qdrant_api_key = os.getenv("QDRANT_API_KEY")
11
+ qdrant_client = QdrantClient(
12
+ url="https://9266da83-dbfe-48d6-b2d8-cdf101299284.europe-west3-0.gcp.cloud.qdrant.io",
13
+ api_key=qdrant_api_key
14
+ )
15
+
16
+ # Define your collection name
17
+ COLLECTION_NAME = "ai_info_collection"
18
+
19
+ try:
20
+ # Delete all points in the collection
21
+ qdrant_client.delete(
22
+ collection_name=COLLECTION_NAME,
23
+ points_selector=models.FilterSelector(filter=models.Filter())
24
+ )
25
+ print(f"All points in collection '{COLLECTION_NAME}' have been deleted.")
26
+
27
+ # Delete processed_docs.json file
28
+ processed_docs_path = os.path.join(os.path.dirname(__file__), 'processed_docs.json')
29
+ if os.path.exists(processed_docs_path):
30
+ os.remove(processed_docs_path)
31
+ print("processed_docs.json has been deleted.")
32
+ else:
33
+ print("processed_docs.json does not exist.")
34
+
35
+ except Exception as e:
36
+ print(f"An error occurred: {e}")
hf_README.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Sb Aiinfo
3
+ emoji: 🚀
4
+ colorFrom: pink
5
+ colorTo: green
6
+ sdk: docker
7
+ pinned: false
8
+ ---
9
+
10
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
processed_docs.json ADDED
@@ -0,0 +1 @@
 
 
1
+ ["NIST.AI.600-1.pdf", "Blueprint-for-an-AI-Bill-of-Rights.pdf"]
qa_evaluate.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import pandas as pd
3
+ from datasets import Dataset
4
+ from ragas import evaluate
5
+ from ragas.metrics import context_precision, faithfulness, answer_relevancy, context_recall
6
+ from dotenv import load_dotenv
7
+ import os
8
+ from langchain_openai import ChatOpenAI
9
+
10
+ # Load environment variables
11
+ load_dotenv()
12
+
13
+ # Get the OpenAI API key
14
+ OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
15
+
16
+ if not OPENAI_API_KEY:
17
+ raise ValueError("OpenAI API key not found in environment variables.")
18
+
19
+ # Load the local JSON file
20
+ with open("testset_with_answers.json", "r") as f:
21
+ data = json.load(f)
22
+
23
+ # Convert the JSON data to a pandas DataFrame
24
+ df = pd.DataFrame(data)
25
+
26
+ # Convert the pandas DataFrame to a Hugging Face Dataset
27
+ ai_ans = Dataset.from_pandas(df)
28
+
29
+ # Create a ChatOpenAI instance with the API key
30
+ llm = ChatOpenAI(openai_api_key=OPENAI_API_KEY)
31
+
32
+ # Now you can proceed with the evaluation
33
+ result = evaluate(
34
+ ai_ans,
35
+ metrics=[
36
+ context_precision,
37
+ faithfulness,
38
+ answer_relevancy,
39
+ context_recall,
40
+ ],
41
+ llm=llm # Pass the LLM instance here
42
+ )
43
+
44
+ print(result)
qa_generate_ans.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import asyncio
4
+ from dotenv import load_dotenv
5
+ import pandas as pd
6
+ from langchain_community.document_loaders import DirectoryLoader, PyPDFLoader
7
+ from ragas.testset.generator import TestsetGenerator
8
+ from ragas.testset.evolutions import simple, reasoning, multi_context
9
+ from langchain_openai import ChatOpenAI, OpenAIEmbeddings
10
+ import openai
11
+ from tenacity import retry, stop_after_attempt, wait_random_exponential
12
+ from qa_system import generate_answer # Import the QA system
13
+
14
+ @retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(5))
15
+ def generate_testset(generator, documents, test_size, distributions):
16
+ return generator.generate_with_langchain_docs(
17
+ documents,
18
+ test_size=test_size,
19
+ distributions=distributions
20
+ )
21
+
22
+ async def main():
23
+ # Load environment variables from .env file
24
+ load_dotenv()
25
+
26
+ OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
27
+
28
+ if not OPENAI_API_KEY:
29
+ raise ValueError("OpenAI API key not found in environment variables.")
30
+
31
+ # Initialize OpenAI API key
32
+ os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
33
+ openai.api_key = OPENAI_API_KEY # Explicitly set the API key
34
+
35
+ # Check if testset.json exists
36
+ if os.path.exists("testset.json"):
37
+ print("Loading existing testset from testset.json")
38
+ with open("testset.json", "r") as f:
39
+ testset_dict = json.load(f)
40
+ df = pd.DataFrame(testset_dict)
41
+ else:
42
+ print("Generating new testset")
43
+ # Load PDF documents
44
+ documents = []
45
+ pdf_dir = "resources"
46
+ for filename in os.listdir(pdf_dir):
47
+ if filename.lower().endswith(".pdf"):
48
+ loader = PyPDFLoader(os.path.join(pdf_dir, filename))
49
+ docs = loader.load()
50
+ for doc in docs:
51
+ doc.metadata['filename'] = filename
52
+ documents.extend(docs)
53
+
54
+ for document in documents:
55
+ document.metadata['filename'] = document.metadata['source']
56
+
57
+ # Initialize OpenAI models (using gpt-3.5-turbo for both to reduce costs)
58
+ generator_llm = ChatOpenAI(api_key=OPENAI_API_KEY, model="gpt-3.5-turbo")
59
+ critic_llm = ChatOpenAI(api_key=OPENAI_API_KEY, model="gpt-3.5-turbo")
60
+ embeddings = OpenAIEmbeddings(api_key=OPENAI_API_KEY)
61
+
62
+ # Initialize the Testset Generator
63
+ generator = TestsetGenerator.from_langchain(
64
+ generator_llm,
65
+ critic_llm,
66
+ embeddings
67
+ )
68
+
69
+ try:
70
+ # Generate testset with retry logic
71
+ testset = generate_testset(
72
+ generator,
73
+ documents,
74
+ test_size=3,
75
+ distributions={simple: 0.6, reasoning: 0.2, multi_context: 0.2}
76
+ )
77
+
78
+ # Convert testset to pandas DataFrame
79
+ df = testset.to_pandas()
80
+
81
+ # Save testset to JSON file
82
+ testset_dict = df.to_dict(orient='records')
83
+ with open("testset.json", "w") as f:
84
+ json.dump(testset_dict, f, indent=2)
85
+ print(f"New testset saved to testset.json")
86
+
87
+ except Exception as e:
88
+ print(f"An unexpected error occurred while generating testset: {e}")
89
+ return
90
+
91
+ try:
92
+ # Generate new answers for each question using the existing QA system
93
+ print("Generating new answers for all questions")
94
+ df['answer'] = df['question'].apply(generate_answer)
95
+
96
+ # Update JSON file with new answers
97
+ testset_dict = df.to_dict(orient='records')
98
+ with open("testset_with_answers.json", "w") as f:
99
+ json.dump(testset_dict, f, indent=2)
100
+ print(f"Testset with new answers saved to testset_with_answers.json")
101
+
102
+ # Save testset with new answers to CSV file
103
+ df.to_csv("testset_with_answers.csv", index=False)
104
+ print(f"Testset with new answers saved to testset_with_answers.csv")
105
+
106
+ except openai.APIConnectionError as e:
107
+ print(f"Failed to connect to OpenAI API after multiple attempts: {e}")
108
+ except RuntimeError as e:
109
+ print(f"Runtime error occurred: {e}")
110
+ except Exception as e:
111
+ print(f"An unexpected error occurred: {e}")
112
+
113
+ if __name__ == "__main__":
114
+ asyncio.run(main())
qa_system.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from dotenv import load_dotenv
3
+ from qdrant_client import QdrantClient
4
+ from langchain_openai import OpenAIEmbeddings, ChatOpenAI
5
+ from langchain_qdrant import Qdrant
6
+
7
+ # Load environment variables
8
+ load_dotenv()
9
+
10
+ # Initialize Qdrant client
11
+ qdrant_api_key = os.getenv("QDRANT_API_KEY")
12
+ qdrant_client = QdrantClient(
13
+ url="https://9266da83-dbfe-48d6-b2d8-cdf101299284.europe-west3-0.gcp.cloud.qdrant.io",
14
+ api_key=qdrant_api_key
15
+ )
16
+
17
+ # Initialize OpenAI
18
+ openai_api_key = os.getenv("OPENAI_API_KEY")
19
+ embeddings = OpenAIEmbeddings(model="text-embedding-3-small", openai_api_key=openai_api_key)
20
+ llm = ChatOpenAI(temperature=0, openai_api_key=openai_api_key)
21
+
22
+ # Initialize vector store
23
+ collection_name = "ai_info_collection"
24
+ vector_store = Qdrant(
25
+ client=qdrant_client,
26
+ collection_name=collection_name,
27
+ embeddings=embeddings,
28
+ )
29
+
30
+ def generate_answer(query):
31
+ docs = vector_store.similarity_search(query, k=3)
32
+ context = "\n".join(doc.page_content for doc in docs if doc.page_content)
33
+ prompt = f"Based on the following context, answer the question: {query}\n\nContext: {context}"
34
+ response = llm.invoke(prompt)
35
+ return response.content
requirements.txt ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles==23.2.1
2
+ aiohappyeyeballs==2.4.0
3
+ aiohttp==3.10.5
4
+ aiosignal==1.3.1
5
+ altair==5.4.1
6
+ annotated-types==0.7.0
7
+ anyio==4.6.0
8
+ asyncer==0.0.7
9
+ attrs==24.2.0
10
+ bidict==0.23.1
11
+ blinker==1.8.2
12
+ cachetools==5.5.0
13
+ certifi==2024.8.30
14
+ chainlit==1.2.0
15
+ charset-normalizer==3.3.2
16
+ chevron==0.14.0
17
+ click==8.1.7
18
+ colorama==0.4.6
19
+ dataclasses-json==0.6.7
20
+ Deprecated==1.2.14
21
+ distro==1.9.0
22
+ fastapi==0.112.4
23
+ filetype==1.2.0
24
+ frozenlist==1.4.1
25
+ gitdb==4.0.11
26
+ GitPython==3.1.43
27
+ googleapis-common-protos==1.65.0
28
+ greenlet==3.1.1
29
+ grpcio==1.66.1
30
+ grpcio-tools==1.66.1
31
+ h11==0.14.0
32
+ h2==4.1.0
33
+ hpack==4.0.0
34
+ httpcore==1.0.5
35
+ httpx==0.27.2
36
+ hyperframe==6.0.1
37
+ idna==3.10
38
+ importlib_metadata==8.4.0
39
+ Jinja2==3.1.4
40
+ jiter==0.5.0
41
+ jsonpatch==1.33
42
+ jsonpointer==3.0.0
43
+ jsonschema==4.23.0
44
+ jsonschema-specifications==2023.12.1
45
+ langchain==0.3.0
46
+ langchain-community==0.3.0
47
+ langchain-core==0.3.5
48
+ langchain-openai==0.2.0
49
+ langchain-qdrant==0.1.4
50
+ langchain-text-splitters==0.3.0
51
+ langsmith==0.1.125
52
+ Lazify==0.4.0
53
+ literalai==0.0.607
54
+ markdown-it-py==3.0.0
55
+ MarkupSafe==2.1.5
56
+ marshmallow==3.22.0
57
+ mdurl==0.1.2
58
+ multidict==6.1.0
59
+ mypy-extensions==1.0.0
60
+ narwhals==1.8.2
61
+ nest-asyncio==1.6.0
62
+ numpy==1.26.4
63
+ openai==1.47.0
64
+ opentelemetry-api==1.27.0
65
+ opentelemetry-exporter-otlp==1.27.0
66
+ opentelemetry-exporter-otlp-proto-common==1.27.0
67
+ opentelemetry-exporter-otlp-proto-grpc==1.27.0
68
+ opentelemetry-exporter-otlp-proto-http==1.27.0
69
+ opentelemetry-instrumentation==0.48b0
70
+ opentelemetry-proto==1.27.0
71
+ opentelemetry-sdk==1.27.0
72
+ opentelemetry-semantic-conventions==0.48b0
73
+ orjson==3.10.7
74
+ packaging==23.2
75
+ pandas==2.2.3
76
+ pillow==10.4.0
77
+ portalocker==2.10.1
78
+ protobuf==4.25.5
79
+ pyarrow==17.0.0
80
+ pydantic==2.9.2
81
+ pydantic-settings==2.5.2
82
+ pydantic_core==2.23.4
83
+ pydeck==0.9.1
84
+ Pygments==2.18.0
85
+ PyJWT==2.9.0
86
+ PyMuPDF==1.24.10
87
+ PyMuPDFb==1.24.10
88
+ python-dateutil==2.9.0.post0
89
+ python-dotenv==1.0.1
90
+ python-engineio==4.9.1
91
+ python-multipart==0.0.9
92
+ python-socketio==5.11.4
93
+ pytz==2024.2
94
+ pywin32==306
95
+ PyYAML==6.0.2
96
+ qdrant-client==1.11.2
97
+ referencing==0.35.1
98
+ regex==2024.9.11
99
+ requests==2.32.3
100
+ rich==13.8.1
101
+ rpds-py==0.20.0
102
+ simple-websocket==1.0.0
103
+ six==1.16.0
104
+ smmap==5.0.1
105
+ sniffio==1.3.1
106
+ SQLAlchemy==2.0.35
107
+ starlette==0.37.2
108
+ syncer==2.0.3
109
+ tenacity==8.5.0
110
+ tiktoken==0.7.0
111
+ toml==0.10.2
112
+ tomli==2.0.1
113
+ tornado==6.4.1
114
+ tqdm==4.66.5
115
+ typing-inspect==0.9.0
116
+ typing_extensions==4.12.2
117
+ tzdata==2024.1
118
+ uptrace==1.26.0
119
+ urllib3==2.2.3
120
+ uvicorn==0.25.0
121
+ watchdog==4.0.2
122
+ watchfiles==0.20.0
123
+ wrapt==1.16.0
124
+ wsproto==1.2.0
125
+ yarl==1.11.1
126
+ zipp==3.20.2
testset.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "question": "Which organizations from the private sector and civil society were involved in meetings with OSTP regarding the development of the Blueprint for an AI Bill of Rights?",
4
+ "contexts": [
5
+ "APPENDIX\n\u2022 OSTP conducted meetings with a variety of stakeholders in the private sector and civil society. Some of these\nmeetings were specifically focused on providing ideas related to the development of the Blueprint for an AI\nBill of Rights while others provided useful general context on the positive use cases, potential harms, and/or\noversight possibilities for these technologies. Participants in these conversations from the private sector and\ncivil society included:\nAdobe \nAmerican Civil Liberties Union (ACLU) The Aspen Commission on Information Disorder The Awood Center The Australian Human Rights Commission Biometrics Institute The Brookings Institute BSA | The Software Alliance Cantellus Group Center for American Progress Center for Democracy and Technology Center on Privacy and Technology at Georgetown Law Christiana Care Color of Change Coworker Data Robot Data Trust Alliance Data and Society Research Institute Deepmind EdSAFE AI Alliance Electronic Privacy Information Center (EPIC) Encode Justice Equal AI Google Hitachi's AI Policy Committee The Innocence Project Institute of Electrical and Electronics Engineers (IEEE) Intuit Lawyers Committee for Civil Rights Under Law Legal Aid Society The Leadership Conference on Civil and Human Rights Meta Microsoft The MIT AI Policy Forum Movement Alliance Project The National Association of Criminal Defense Lawyers O\u2019Neil Risk Consulting & Algorithmic Auditing The Partnership on AI Pinterest The Plaintext Group pymetrics SAP The Security Industry Association Software and Information Industry Association (SIIA) Special Competitive Studies Project Thorn United for Respect University of California at Berkeley Citris Policy Lab University of California at Berkeley Labor Center Unfinished/Project Liberty Upturn US Chamber of Commerce US Chamber of Commerce Technology Engagement Center \nA.I. Working Group\nVibrent HealthWarehouse Worker ResourceCenterWaymap\n62"
6
+ ],
7
+ "ground_truth": "OSTP conducted meetings with a variety of stakeholders in the private sector and civil society, including organizations such as Adobe, ACLU, The Aspen Commission on Information Disorder, The Australian Human Rights Commission, Biometrics Institute, The Brookings Institute, BSA | The Software Alliance, Cantellus Group, Center for American Progress, Center for Democracy and Technology, Center on Privacy and Technology at Georgetown Law, Christiana Care, Color of Change, Coworker, Data Robot, Data Trust Alliance, Data and Society Research Institute, Deepmind, EdSAFE AI Alliance, Electronic Privacy Information Center (EPIC), Encode Justice, Equal AI, Google, Hitachi's AI Policy Committee, The Innocence Project, Institute of Electrical and Electronics Engineers (IEEE), Intuit, Lawyers Committee for Civil Rights Under Law, Legal Aid Society, The Leadership Conference on Civil and Human Rights, Meta, Microsoft, The MIT AI Policy Forum, Movement Alliance Project, The National Association of Criminal Defense Lawyers, O'Neil Risk Consulting & Algorithmic Auditing, The Partnership on AI, Pinterest, The Plaintext Group, pymetrics, SAP, The Security Industry Association, Software and Information Industry Association (SIIA), Special Competitive Studies Project, Thorn, United for Respect, University of California at Berkeley Citris Policy Lab, University of California at Berkeley Labor Center, Unfinished/Project Liberty, Upturn, US Chamber of Commerce, US Chamber of Commerce Technology Engagement Center, A.I. Working Group, Vibrent Health, Warehouse Worker Resource Center, Waymap.",
8
+ "evolution_type": "simple",
9
+ "metadata": [
10
+ {
11
+ "source": "resources\\Blueprint-for-an-AI-Bill-of-Rights.pdf",
12
+ "page": 61,
13
+ "filename": "resources\\Blueprint-for-an-AI-Bill-of-Rights.pdf"
14
+ }
15
+ ],
16
+ "episode_done": true
17
+ },
18
+ {
19
+ "question": "How can statistical biases related to GAI content provenance be assessed and managed in evaluations involving human subjects?",
20
+ "contexts": [
21
+ " \n30 MEASURE 2.2: Evaluations involving human subjects meet applicable requirements (including human subject protection) and are \nrepresentative of the relevant population. \nAction ID Suggested Action GAI Risks \nMS-2.2-001 Assess and manage statistical biases related to GAI content provenance through \ntechniques such as re -sampling, re -weighting, or adversarial training. Information Integrity ; Information \nSecurity ; Harmful Bias and \nHomogenization \nMS-2.2-002 Document how content provenance data is tracked and how that data interact s \nwith privacy and security . Consider : Anonymiz ing data to protect the privacy of \nhuman subjects; Leverag ing privacy output \ufb01lters; Remov ing any personally \nidenti\ufb01able information (PII) to prevent potential harm or misuse. Data Privacy ; Human AI \nCon\ufb01guration; Information \nIntegrity ; Information Security ; \nDangerous , Violent, or Hateful \nContent \nMS-2.2-0 03 Provide human subjects with options to withdraw participation or revoke their \nconsent for present or future use of their data in GAI applications . Data Privacy ; Human -AI \nCon\ufb01guration; Information \nIntegrity \nMS-2.2-0 04 Use techniques such as anonymization , di\ufb00erential privacy or other privacy -\nenhancing technologies to minimize the risks associated with linking AI -generated \ncontent back to individual human subjects. Data Privacy ; Human -AI \nCon\ufb01guration \nAI Actor Tasks: AI Development, Human Factors, TEVV \n \nMEASURE 2.3: AI system performance or assurance criteria are measured qualitatively or quantitatively and demonstrated for \nconditions similar to deployment setting(s). Measures are documented. \nAction ID Suggested Action GAI Risks \nMS-2.3-001 Consider baseline model performance on suites of benchmarks when selecting a \nmodel for \ufb01ne tuning or enhancement with retrieval- augmented generation. Information Security ; \nConfabulation \nMS-2.3-002 Evaluate claims of model capabilities using empirically validated methods. Confabulation ; Information \nSecurity \nMS-2.3-003 Share results of pre -deployment testing with relevant GAI Actors , such as those \nwith system release approval authority. Human -AI Con\ufb01guration "
22
+ ],
23
+ "ground_truth": "Assess and manage statistical biases related to GAI content provenance in evaluations involving human subjects through techniques such as re-sampling, re-weighting, or adversarial training. It is important to ensure that the evaluations are representative of the relevant population and meet applicable requirements, including human subject protection.",
24
+ "evolution_type": "simple",
25
+ "metadata": [
26
+ {
27
+ "source": "resources\\NIST.AI.600-1.pdf",
28
+ "page": 33,
29
+ "filename": "resources\\NIST.AI.600-1.pdf"
30
+ }
31
+ ],
32
+ "episode_done": true
33
+ },
34
+ {
35
+ "question": "How can organizations use public feedback to enhance content provenance for GAI models?",
36
+ "contexts": [
37
+ " \n52 \u2022 Monitoring system capabilities and limitations in deployment through rigorous TEVV processes; \n\u2022 Evaluati ng how humans engage, interact with, or adapt to GAI content (especially in decision \nmaking tasks informed by GAI content), and how they react to applied provenance techniques \nsuch as overt disclosures. \nOrganizations can document and delineate GAI system objectives and limitations to identify gaps where provenance data may be most useful. For instance, GAI systems used for content creation may require \nrobust watermarking techniques and corresponding detectors to identify the source of content or \nmetadata recording techniques and metadata management tools and repositories to trace content \norigins and modi\ufb01cations. Further narrowing of GAI task de\ufb01nitions to include provenance data can enable organizations to maximize the utility of provenance data and risk management e\ufb00orts. \nA.1.7. \nEnhancing Content Provenance through Structured Public Feedback \nWhile indirect feedback methods such as automated error collection systems are useful, they often lack the context and depth\n that direct input from end users can provide. Organizations can leverage feedback \napproaches described in the Pre-Deployment Testing section to capture input from external sources such \nas through AI red- teaming. \nIntegrating pre - and post -deployment external feedback into the monitoring process for GAI models and \ncorresponding applications can help enhance awareness of performance changes and mitigate potential \nrisks and harms from outputs . There are many ways to capture and make use of user feedback \u2013 before \nand after GAI systems and digital content transparency approaches are deployed \u2013 to gain insights about \nauthentication e\ufb03cacy and vulnerabilities, impacts of adversarial threats on techniques , and unintended \nconsequences resulting from the utilization of content provenance approaches on users and \ncommunities . Furthermore, organizations can track and document the provenance of datasets to identify \ninstances in which AI -generated data is a potential root cause of performance issues with the GAI \nsystem. \nA.1.8. Incident Disclosure \nOverview \nAI incidents can be de\ufb01ned as an \u201c event, circumstance, or series of events where the development, use, \nor malfunction of one or more AI systems directly or indirectly contribute s to one of the following harms: \ninjury or harm to the health of a person or group s of people (including psychological harms and harms to \nmental health); disruption of the management and operation of critical infrastructure; violations of \nhuman rights or a breach of obligations under applicable law intended to protect fundamental, labor, \nand intellectual property rights ; or harm to property, communities, or the environment. \u201d AI incidents can \noccur in the aggregate (i.e., for systemic discrimination) or acutely (i.e., for one individual). \nState of AI Incident Tracking and Disclosure \nFormal channels do not currently exist to report and document AI incidents. However, a number of publicly available databases\n have been created to document their occurrence. These reporting channels \nmake decisions on an ad hoc basis about what kinds of incidents to track. Some, for example, track by \namount of media coverage . "
38
+ ],
39
+ "ground_truth": "Organizations can enhance content provenance for GAI models by leveraging structured public feedback. This feedback can provide valuable context and depth that automated error collection systems may lack. By integrating pre- and post-deployment external feedback into the monitoring process, organizations can improve awareness of performance changes and mitigate potential risks and harms from GAI model outputs. User feedback can also help in understanding authentication efficacy, vulnerabilities, impacts of adversarial threats, and unintended consequences of content provenance approaches on users and communities. Additionally, tracking and documenting the provenance of datasets can help identify instances where AI-generated data may be causing performance issues in the GAI system.",
40
+ "evolution_type": "reasoning",
41
+ "metadata": [
42
+ {
43
+ "source": "resources\\NIST.AI.600-1.pdf",
44
+ "page": 55,
45
+ "filename": "resources\\NIST.AI.600-1.pdf"
46
+ }
47
+ ],
48
+ "episode_done": true
49
+ },
50
+ {
51
+ "question": "How do feedback exercises and red-teaming help combat bias in GAI systems?",
52
+ "contexts": [
53
+ " \n29 MS-1.1-006 Implement continuous monitoring of GAI system impacts to identify whether GAI \noutputs are equitable across various sub- populations. Seek active and direct \nfeedback from a\ufb00ected communities via structured feedback mechanisms or red -\nteaming to monitor and improve outputs. Harmful Bias and Homogenization \nMS-1.1-007 Evaluate the quality and integrity of data used in training and the provenance of \nAI-generated content , for example by e mploying techniques like chaos \nengineering and seeking stakeholder feedback. Information Integrity \nMS-1.1-008 De\ufb01ne use cases, contexts of use, capabilities, and negative impacts where \nstructured human feedback exercises, e.g., GAI red- teaming, would be most \nbene\ufb01cial for GAI risk measurement and management based on the context of \nuse. Harmful Bias and \nHomogenization ; CBRN \nInformation or Capabilities \nMS-1.1-0 09 Track and document risks or opportunities related to all GAI risks that cannot be \nmeasured quantitatively, including explanations as to why some risks cannot be \nmeasured (e.g., due to technological limitations, resource constraints, or trustworthy considerations). Include unmeasured risks in marginal risks. Information Integrity \nAI Actor Tasks: AI Development, Domain Experts, TEVV \n \nMEASURE 1.3: Internal experts who did not serve as front -line developers for the system and/or independent assessors are \ninvolved in regular assessments and updates. Domain experts, users, AI Actors external to the team that developed or deployed the \nAI system, and a\ufb00ected communities are consulted in support of assessments as necessary per organizational risk tolerance . \nAction ID Suggested Action GAI Risks \nMS-1.3-001 De\ufb01ne relevant groups of interest (e.g., demographic groups, subject matter \nexperts, experience with GAI technology) within the context of use as part of \nplans for gathering structured public feedback. Human -AI Con\ufb01guration ; Harmful \nBias and Homogenization ; CBRN \nInformation or Capabilities \nMS-1.3-002 Engage in internal and external evaluations , GAI red -teaming, impact \nassessments, or other structured human feedback exercises in consultation \nwith representative AI Actors with expertise and familiarity in the context of \nuse, and/or who are representative of the populations associated with the context of use. Human -AI Con\ufb01guration ; Harmful \nBias and Homogenization ; CBRN \nInformation or Capabilities \nMS-1.3-0 03 Verify those conducting structured human feedback exercises are not directly \ninvolved in system development tasks for the same GAI model. Human -AI Con\ufb01guration ; Data \nPrivacy \nAI Actor Tasks: AI Deployment, AI Development, AI Impact Assessment, A\ufb00ected Individuals and Communities, Domain Experts, \nEnd-Users, Operation and Monitoring, TEVV \n "
54
+ ],
55
+ "ground_truth": "Feedback exercises and red-teaming help combat bias in GAI systems by implementing continuous monitoring to identify inequities in system outputs across different sub-populations. By seeking direct feedback from affected communities and using structured mechanisms, biases can be detected and addressed. Additionally, evaluating the quality and integrity of data used in training, employing techniques like chaos engineering, and seeking stakeholder feedback can help improve the fairness of AI-generated content. Defining use cases, contexts of use, capabilities, and negative impacts where structured human feedback exercises like red-teaming would be beneficial can also aid in measuring and managing GAI risks related to bias and homogenization. Tracking and documenting risks or opportunities that cannot be quantitatively measured, including explanations for why some risks cannot be measured, is essential for ensuring information integrity in GAI systems.",
56
+ "evolution_type": "multi_context",
57
+ "metadata": [
58
+ {
59
+ "source": "resources\\NIST.AI.600-1.pdf",
60
+ "page": 32,
61
+ "filename": "resources\\NIST.AI.600-1.pdf"
62
+ }
63
+ ],
64
+ "episode_done": true
65
+ }
66
+ ]
testset_with_answers copy.json ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "question": "Which organizations from the private sector and civil society were involved in meetings with OSTP regarding the development of the Blueprint for an AI Bill of Rights?",
4
+ "contexts": [
5
+ "APPENDIX\n\u2022 OSTP conducted meetings with a variety of stakeholders in the private sector and civil society. Some of these\nmeetings were specifically focused on providing ideas related to the development of the Blueprint for an AI\nBill of Rights while others provided useful general context on the positive use cases, potential harms, and/or\noversight possibilities for these technologies. Participants in these conversations from the private sector and\ncivil society included:\nAdobe \nAmerican Civil Liberties Union (ACLU) The Aspen Commission on Information Disorder The Awood Center The Australian Human Rights Commission Biometrics Institute The Brookings Institute BSA | The Software Alliance Cantellus Group Center for American Progress Center for Democracy and Technology Center on Privacy and Technology at Georgetown Law Christiana Care Color of Change Coworker Data Robot Data Trust Alliance Data and Society Research Institute Deepmind EdSAFE AI Alliance Electronic Privacy Information Center (EPIC) Encode Justice Equal AI Google Hitachi's AI Policy Committee The Innocence Project Institute of Electrical and Electronics Engineers (IEEE) Intuit Lawyers Committee for Civil Rights Under Law Legal Aid Society The Leadership Conference on Civil and Human Rights Meta Microsoft The MIT AI Policy Forum Movement Alliance Project The National Association of Criminal Defense Lawyers O\u2019Neil Risk Consulting & Algorithmic Auditing The Partnership on AI Pinterest The Plaintext Group pymetrics SAP The Security Industry Association Software and Information Industry Association (SIIA) Special Competitive Studies Project Thorn United for Respect University of California at Berkeley Citris Policy Lab University of California at Berkeley Labor Center Unfinished/Project Liberty Upturn US Chamber of Commerce US Chamber of Commerce Technology Engagement Center \nA.I. Working Group\nVibrent HealthWarehouse Worker ResourceCenterWaymap\n62"
6
+ ],
7
+ "ground_truth": "OSTP conducted meetings with a variety of stakeholders in the private sector and civil society, including organizations such as Adobe, ACLU, The Aspen Commission on Information Disorder, The Australian Human Rights Commission, Biometrics Institute, The Brookings Institute, BSA | The Software Alliance, Cantellus Group, Center for American Progress, Center for Democracy and Technology, Center on Privacy and Technology at Georgetown Law, Christiana Care, Color of Change, Coworker, Data Robot, Data Trust Alliance, Data and Society Research Institute, Deepmind, EdSAFE AI Alliance, Electronic Privacy Information Center (EPIC), Encode Justice, Equal AI, Google, Hitachi's AI Policy Committee, The Innocence Project, Institute of Electrical and Electronics Engineers (IEEE), Intuit, Lawyers Committee for Civil Rights Under Law, Legal Aid Society, The Leadership Conference on Civil and Human Rights, Meta, Microsoft, The MIT AI Policy Forum, Movement Alliance Project, The National Association of Criminal Defense Lawyers, O'Neil Risk Consulting & Algorithmic Auditing, The Partnership on AI, Pinterest, The Plaintext Group, pymetrics, SAP, The Security Industry Association, Software and Information Industry Association (SIIA), Special Competitive Studies Project, Thorn, United for Respect, University of California at Berkeley Citris Policy Lab, University of California at Berkeley Labor Center, Unfinished/Project Liberty, Upturn, US Chamber of Commerce, US Chamber of Commerce Technology Engagement Center, A.I. Working Group, Vibrent Health, Warehouse Worker Resource Center, Waymap.",
8
+ "evolution_type": "simple",
9
+ "metadata": [
10
+ {
11
+ "source": "resources\\Blueprint-for-an-AI-Bill-of-Rights.pdf",
12
+ "page": 61,
13
+ "filename": "resources\\Blueprint-for-an-AI-Bill-of-Rights.pdf"
14
+ }
15
+ ],
16
+ "episode_done": true,
17
+ "answer": "The organizations from the private sector and civil society that were involved in meetings with OSTP regarding the development of the Blueprint for an AI Bill of Rights included tech companies such as Google, Microsoft, and IBM, as well as non-profit organizations like the Electronic Frontier Foundation and the American Civil Liberties Union (ACLU)."
18
+ },
19
+ {
20
+ "question": "How can statistical biases related to GAI content provenance be assessed and managed in evaluations involving human subjects?",
21
+ "contexts": [
22
+ " \n30 MEASURE 2.2: Evaluations involving human subjects meet applicable requirements (including human subject protection) and are \nrepresentative of the relevant population. \nAction ID Suggested Action GAI Risks \nMS-2.2-001 Assess and manage statistical biases related to GAI content provenance through \ntechniques such as re -sampling, re -weighting, or adversarial training. Information Integrity ; Information \nSecurity ; Harmful Bias and \nHomogenization \nMS-2.2-002 Document how content provenance data is tracked and how that data interact s \nwith privacy and security . Consider : Anonymiz ing data to protect the privacy of \nhuman subjects; Leverag ing privacy output \ufb01lters; Remov ing any personally \nidenti\ufb01able information (PII) to prevent potential harm or misuse. Data Privacy ; Human AI \nCon\ufb01guration; Information \nIntegrity ; Information Security ; \nDangerous , Violent, or Hateful \nContent \nMS-2.2-0 03 Provide human subjects with options to withdraw participation or revoke their \nconsent for present or future use of their data in GAI applications . Data Privacy ; Human -AI \nCon\ufb01guration; Information \nIntegrity \nMS-2.2-0 04 Use techniques such as anonymization , di\ufb00erential privacy or other privacy -\nenhancing technologies to minimize the risks associated with linking AI -generated \ncontent back to individual human subjects. Data Privacy ; Human -AI \nCon\ufb01guration \nAI Actor Tasks: AI Development, Human Factors, TEVV \n \nMEASURE 2.3: AI system performance or assurance criteria are measured qualitatively or quantitatively and demonstrated for \nconditions similar to deployment setting(s). Measures are documented. \nAction ID Suggested Action GAI Risks \nMS-2.3-001 Consider baseline model performance on suites of benchmarks when selecting a \nmodel for \ufb01ne tuning or enhancement with retrieval- augmented generation. Information Security ; \nConfabulation \nMS-2.3-002 Evaluate claims of model capabilities using empirically validated methods. Confabulation ; Information \nSecurity \nMS-2.3-003 Share results of pre -deployment testing with relevant GAI Actors , such as those \nwith system release approval authority. Human -AI Con\ufb01guration "
23
+ ],
24
+ "ground_truth": "Assess and manage statistical biases related to GAI content provenance in evaluations involving human subjects through techniques such as re-sampling, re-weighting, or adversarial training. It is important to ensure that the evaluations are representative of the relevant population and meet applicable requirements, including human subject protection.",
25
+ "evolution_type": "simple",
26
+ "metadata": [
27
+ {
28
+ "source": "resources\\NIST.AI.600-1.pdf",
29
+ "page": 33,
30
+ "filename": "resources\\NIST.AI.600-1.pdf"
31
+ }
32
+ ],
33
+ "episode_done": true,
34
+ "answer": "Statistical biases related to GAI content provenance can be assessed and managed in evaluations involving human subjects by implementing several strategies. \n\nFirstly, researchers can conduct a thorough review of the data sources and methodologies used to develop the GAI content to identify any potential biases. This can involve examining the training data used to develop the GAI, the algorithms used in the content generation process, and the evaluation metrics used to assess the performance of the GAI.\n\nSecondly, researchers can implement measures to mitigate biases in the evaluation process. This can include using diverse datasets to train and test the GAI, ensuring that the evaluation metrics used are appropriate and unbiased, and conducting sensitivity analyses to assess the impact of potential biases on the results.\n\nAdditionally, researchers can involve human subjects in the evaluation process to provide feedback on the GAI content and identify any potential biases or inaccuracies. This can help to ensure that the GAI content is relevant, accurate, and unbiased for the intended audience.\n\nOverall, by taking a comprehensive and transparent approach to assessing and managing statistical biases related to GAI content provenance in evaluations involving human subjects, researchers can improve the reliability and validity of their findings."
35
+ },
36
+ {
37
+ "question": "How can organizations use public feedback to enhance content provenance for GAI models?",
38
+ "contexts": [
39
+ " \n52 \u2022 Monitoring system capabilities and limitations in deployment through rigorous TEVV processes; \n\u2022 Evaluati ng how humans engage, interact with, or adapt to GAI content (especially in decision \nmaking tasks informed by GAI content), and how they react to applied provenance techniques \nsuch as overt disclosures. \nOrganizations can document and delineate GAI system objectives and limitations to identify gaps where provenance data may be most useful. For instance, GAI systems used for content creation may require \nrobust watermarking techniques and corresponding detectors to identify the source of content or \nmetadata recording techniques and metadata management tools and repositories to trace content \norigins and modi\ufb01cations. Further narrowing of GAI task de\ufb01nitions to include provenance data can enable organizations to maximize the utility of provenance data and risk management e\ufb00orts. \nA.1.7. \nEnhancing Content Provenance through Structured Public Feedback \nWhile indirect feedback methods such as automated error collection systems are useful, they often lack the context and depth\n that direct input from end users can provide. Organizations can leverage feedback \napproaches described in the Pre-Deployment Testing section to capture input from external sources such \nas through AI red- teaming. \nIntegrating pre - and post -deployment external feedback into the monitoring process for GAI models and \ncorresponding applications can help enhance awareness of performance changes and mitigate potential \nrisks and harms from outputs . There are many ways to capture and make use of user feedback \u2013 before \nand after GAI systems and digital content transparency approaches are deployed \u2013 to gain insights about \nauthentication e\ufb03cacy and vulnerabilities, impacts of adversarial threats on techniques , and unintended \nconsequences resulting from the utilization of content provenance approaches on users and \ncommunities . Furthermore, organizations can track and document the provenance of datasets to identify \ninstances in which AI -generated data is a potential root cause of performance issues with the GAI \nsystem. \nA.1.8. Incident Disclosure \nOverview \nAI incidents can be de\ufb01ned as an \u201c event, circumstance, or series of events where the development, use, \nor malfunction of one or more AI systems directly or indirectly contribute s to one of the following harms: \ninjury or harm to the health of a person or group s of people (including psychological harms and harms to \nmental health); disruption of the management and operation of critical infrastructure; violations of \nhuman rights or a breach of obligations under applicable law intended to protect fundamental, labor, \nand intellectual property rights ; or harm to property, communities, or the environment. \u201d AI incidents can \noccur in the aggregate (i.e., for systemic discrimination) or acutely (i.e., for one individual). \nState of AI Incident Tracking and Disclosure \nFormal channels do not currently exist to report and document AI incidents. However, a number of publicly available databases\n have been created to document their occurrence. These reporting channels \nmake decisions on an ad hoc basis about what kinds of incidents to track. Some, for example, track by \namount of media coverage . "
40
+ ],
41
+ "ground_truth": "Organizations can enhance content provenance for GAI models by leveraging structured public feedback. This feedback can provide valuable context and depth that automated error collection systems may lack. By integrating pre- and post-deployment external feedback into the monitoring process, organizations can improve awareness of performance changes and mitigate potential risks and harms from GAI model outputs. User feedback can also help in understanding authentication efficacy, vulnerabilities, impacts of adversarial threats, and unintended consequences of content provenance approaches on users and communities. Additionally, tracking and documenting the provenance of datasets can help identify instances where AI-generated data may be causing performance issues in the GAI system.",
42
+ "evolution_type": "reasoning",
43
+ "metadata": [
44
+ {
45
+ "source": "resources\\NIST.AI.600-1.pdf",
46
+ "page": 55,
47
+ "filename": "resources\\NIST.AI.600-1.pdf"
48
+ }
49
+ ],
50
+ "episode_done": true,
51
+ "answer": "Organizations can use public feedback to enhance content provenance for GAI models by incorporating mechanisms for users to provide input on the sources of data used in the models. This can include allowing users to flag potentially unreliable sources or providing a platform for users to submit additional information or context about the data being used. By actively engaging with public feedback, organizations can improve the transparency and credibility of their GAI models, ultimately enhancing the overall trustworthiness of the technology."
52
+ },
53
+ {
54
+ "question": "How do feedback exercises and red-teaming help combat bias in GAI systems?",
55
+ "contexts": [
56
+ " \n29 MS-1.1-006 Implement continuous monitoring of GAI system impacts to identify whether GAI \noutputs are equitable across various sub- populations. Seek active and direct \nfeedback from a\ufb00ected communities via structured feedback mechanisms or red -\nteaming to monitor and improve outputs. Harmful Bias and Homogenization \nMS-1.1-007 Evaluate the quality and integrity of data used in training and the provenance of \nAI-generated content , for example by e mploying techniques like chaos \nengineering and seeking stakeholder feedback. Information Integrity \nMS-1.1-008 De\ufb01ne use cases, contexts of use, capabilities, and negative impacts where \nstructured human feedback exercises, e.g., GAI red- teaming, would be most \nbene\ufb01cial for GAI risk measurement and management based on the context of \nuse. Harmful Bias and \nHomogenization ; CBRN \nInformation or Capabilities \nMS-1.1-0 09 Track and document risks or opportunities related to all GAI risks that cannot be \nmeasured quantitatively, including explanations as to why some risks cannot be \nmeasured (e.g., due to technological limitations, resource constraints, or trustworthy considerations). Include unmeasured risks in marginal risks. Information Integrity \nAI Actor Tasks: AI Development, Domain Experts, TEVV \n \nMEASURE 1.3: Internal experts who did not serve as front -line developers for the system and/or independent assessors are \ninvolved in regular assessments and updates. Domain experts, users, AI Actors external to the team that developed or deployed the \nAI system, and a\ufb00ected communities are consulted in support of assessments as necessary per organizational risk tolerance . \nAction ID Suggested Action GAI Risks \nMS-1.3-001 De\ufb01ne relevant groups of interest (e.g., demographic groups, subject matter \nexperts, experience with GAI technology) within the context of use as part of \nplans for gathering structured public feedback. Human -AI Con\ufb01guration ; Harmful \nBias and Homogenization ; CBRN \nInformation or Capabilities \nMS-1.3-002 Engage in internal and external evaluations , GAI red -teaming, impact \nassessments, or other structured human feedback exercises in consultation \nwith representative AI Actors with expertise and familiarity in the context of \nuse, and/or who are representative of the populations associated with the context of use. Human -AI Con\ufb01guration ; Harmful \nBias and Homogenization ; CBRN \nInformation or Capabilities \nMS-1.3-0 03 Verify those conducting structured human feedback exercises are not directly \ninvolved in system development tasks for the same GAI model. Human -AI Con\ufb01guration ; Data \nPrivacy \nAI Actor Tasks: AI Deployment, AI Development, AI Impact Assessment, A\ufb00ected Individuals and Communities, Domain Experts, \nEnd-Users, Operation and Monitoring, TEVV \n "
57
+ ],
58
+ "ground_truth": "Feedback exercises and red-teaming help combat bias in GAI systems by implementing continuous monitoring to identify inequities in system outputs across different sub-populations. By seeking direct feedback from affected communities and using structured mechanisms, biases can be detected and addressed. Additionally, evaluating the quality and integrity of data used in training, employing techniques like chaos engineering, and seeking stakeholder feedback can help improve the fairness of AI-generated content. Defining use cases, contexts of use, capabilities, and negative impacts where structured human feedback exercises like red-teaming would be beneficial can also aid in measuring and managing GAI risks related to bias and homogenization. Tracking and documenting risks or opportunities that cannot be quantitatively measured, including explanations for why some risks cannot be measured, is essential for ensuring information integrity in GAI systems.",
59
+ "evolution_type": "multi_context",
60
+ "metadata": [
61
+ {
62
+ "source": "resources\\NIST.AI.600-1.pdf",
63
+ "page": 32,
64
+ "filename": "resources\\NIST.AI.600-1.pdf"
65
+ }
66
+ ],
67
+ "episode_done": true,
68
+ "answer": "Feedback exercises and red-teaming can help combat bias in GAI systems by providing opportunities for diverse perspectives to be considered and for potential biases to be identified and addressed. Feedback exercises involve gathering input from a variety of stakeholders, including individuals from different backgrounds and experiences, to ensure that the system is being evaluated from multiple viewpoints. Red-teaming involves intentionally challenging the system with adversarial thinking to uncover potential weaknesses or biases that may not have been initially apparent. By incorporating these practices into the development and testing of GAI systems, developers can work to mitigate bias and ensure that the technology is fair and equitable for all users."
69
+ }
70
+ ]
testset_with_answers.csv ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ question,contexts,ground_truth,evolution_type,metadata,episode_done,answer
2
+ Which organizations from the private sector and civil society were involved in meetings with OSTP regarding the development of the Blueprint for an AI Bill of Rights?,"[""APPENDIX\n• OSTP conducted meetings with a variety of stakeholders in the private sector and civil society. Some of these\nmeetings were specifically focused on providing ideas related to the development of the Blueprint for an AI\nBill of Rights while others provided useful general context on the positive use cases, potential harms, and/or\noversight possibilities for these technologies. Participants in these conversations from the private sector and\ncivil society included:\nAdobe \nAmerican Civil Liberties Union (ACLU) The Aspen Commission on Information Disorder The Awood Center The Australian Human Rights Commission Biometrics Institute The Brookings Institute BSA | The Software Alliance Cantellus Group Center for American Progress Center for Democracy and Technology Center on Privacy and Technology at Georgetown Law Christiana Care Color of Change Coworker Data Robot Data Trust Alliance Data and Society Research Institute Deepmind EdSAFE AI Alliance Electronic Privacy Information Center (EPIC) Encode Justice Equal AI Google Hitachi's AI Policy Committee The Innocence Project Institute of Electrical and Electronics Engineers (IEEE) Intuit Lawyers Committee for Civil Rights Under Law Legal Aid Society The Leadership Conference on Civil and Human Rights Meta Microsoft The MIT AI Policy Forum Movement Alliance Project The National Association of Criminal Defense Lawyers O’Neil Risk Consulting & Algorithmic Auditing The Partnership on AI Pinterest The Plaintext Group pymetrics SAP The Security Industry Association Software and Information Industry Association (SIIA) Special Competitive Studies Project Thorn United for Respect University of California at Berkeley Citris Policy Lab University of California at Berkeley Labor Center Unfinished/Project Liberty Upturn US Chamber of Commerce US Chamber of Commerce Technology Engagement Center \nA.I. Working Group\nVibrent HealthWarehouse Worker ResourceCenterWaymap\n62""]","OSTP conducted meetings with a variety of stakeholders in the private sector and civil society, including organizations such as Adobe, ACLU, The Aspen Commission on Information Disorder, The Australian Human Rights Commission, Biometrics Institute, The Brookings Institute, BSA | The Software Alliance, Cantellus Group, Center for American Progress, Center for Democracy and Technology, Center on Privacy and Technology at Georgetown Law, Christiana Care, Color of Change, Coworker, Data Robot, Data Trust Alliance, Data and Society Research Institute, Deepmind, EdSAFE AI Alliance, Electronic Privacy Information Center (EPIC), Encode Justice, Equal AI, Google, Hitachi's AI Policy Committee, The Innocence Project, Institute of Electrical and Electronics Engineers (IEEE), Intuit, Lawyers Committee for Civil Rights Under Law, Legal Aid Society, The Leadership Conference on Civil and Human Rights, Meta, Microsoft, The MIT AI Policy Forum, Movement Alliance Project, The National Association of Criminal Defense Lawyers, O'Neil Risk Consulting & Algorithmic Auditing, The Partnership on AI, Pinterest, The Plaintext Group, pymetrics, SAP, The Security Industry Association, Software and Information Industry Association (SIIA), Special Competitive Studies Project, Thorn, United for Respect, University of California at Berkeley Citris Policy Lab, University of California at Berkeley Labor Center, Unfinished/Project Liberty, Upturn, US Chamber of Commerce, US Chamber of Commerce Technology Engagement Center, A.I. Working Group, Vibrent Health, Warehouse Worker Resource Center, Waymap.",simple,"[{'source': 'resources\\Blueprint-for-an-AI-Bill-of-Rights.pdf', 'page': 61, 'filename': 'resources\\Blueprint-for-an-AI-Bill-of-Rights.pdf'}]",True,"The organizations from the private sector and civil society that were involved in meetings with OSTP regarding the development of the Blueprint for an AI Bill of Rights included tech companies such as Google, Microsoft, and IBM, as well as non-profit organizations like the Electronic Frontier Foundation and the American Civil Liberties Union (ACLU)."
3
+ How can statistical biases related to GAI content provenance be assessed and managed in evaluations involving human subjects?,"[' \n30 MEASURE 2.2: Evaluations involving human subjects meet applicable requirements (including human subject protection) and are \nrepresentative of the relevant population. \nAction ID Suggested Action GAI Risks \nMS-2.2-001 Assess and manage statistical biases related to GAI content provenance through \ntechniques such as re -sampling, re -weighting, or adversarial training. Information Integrity ; Information \nSecurity ; Harmful Bias and \nHomogenization \nMS-2.2-002 Document how content provenance data is tracked and how that data interact s \nwith privacy and security . Consider : Anonymiz ing data to protect the privacy of \nhuman subjects; Leverag ing privacy output filters; Remov ing any personally \nidentifiable information (PII) to prevent potential harm or misuse. Data Privacy ; Human AI \nConfiguration; Information \nIntegrity ; Information Security ; \nDangerous , Violent, or Hateful \nContent \nMS-2.2-0 03 Provide human subjects with options to withdraw participation or revoke their \nconsent for present or future use of their data in GAI applications . Data Privacy ; Human -AI \nConfiguration; Information \nIntegrity \nMS-2.2-0 04 Use techniques such as anonymization , differential privacy or other privacy -\nenhancing technologies to minimize the risks associated with linking AI -generated \ncontent back to individual human subjects. Data Privacy ; Human -AI \nConfiguration \nAI Actor Tasks: AI Development, Human Factors, TEVV \n \nMEASURE 2.3: AI system performance or assurance criteria are measured qualitatively or quantitatively and demonstrated for \nconditions similar to deployment setting(s). Measures are documented. \nAction ID Suggested Action GAI Risks \nMS-2.3-001 Consider baseline model performance on suites of benchmarks when selecting a \nmodel for fine tuning or enhancement with retrieval- augmented generation. Information Security ; \nConfabulation \nMS-2.3-002 Evaluate claims of model capabilities using empirically validated methods. Confabulation ; Information \nSecurity \nMS-2.3-003 Share results of pre -deployment testing with relevant GAI Actors , such as those \nwith system release approval authority. Human -AI Configuration ']","Assess and manage statistical biases related to GAI content provenance in evaluations involving human subjects through techniques such as re-sampling, re-weighting, or adversarial training. It is important to ensure that the evaluations are representative of the relevant population and meet applicable requirements, including human subject protection.",simple,"[{'source': 'resources\\NIST.AI.600-1.pdf', 'page': 33, 'filename': 'resources\\NIST.AI.600-1.pdf'}]",True,"Statistical biases related to GAI content provenance can be assessed and managed in evaluations involving human subjects by implementing several strategies.
4
+
5
+ Firstly, researchers can conduct a thorough review of the data sources and methodologies used to develop the GAI content to identify any potential biases. This can involve examining the training data used to develop the GAI, the algorithms used in the content generation process, and the evaluation metrics used to assess the performance of the GAI.
6
+
7
+ Secondly, researchers can implement measures to mitigate biases in the evaluation process. This can include using diverse datasets to train and test the GAI, ensuring that the evaluation metrics used are appropriate and unbiased, and conducting sensitivity analyses to assess the impact of potential biases on the results.
8
+
9
+ Additionally, researchers can involve human subjects in the evaluation process to provide feedback on the GAI content and identify any potential biases or inaccuracies. This can help to ensure that the GAI content is relevant, accurate, and unbiased for the intended audience.
10
+
11
+ Overall, by taking a comprehensive and transparent approach to assessing and managing statistical biases related to GAI content provenance in evaluations involving human subjects, researchers can improve the reliability and validity of their findings."
12
+ How can organizations use public feedback to enhance content provenance for GAI models?,"[' \n52 • Monitoring system capabilities and limitations in deployment through rigorous TEVV processes; \n• Evaluati ng how humans engage, interact with, or adapt to GAI content (especially in decision \nmaking tasks informed by GAI content), and how they react to applied provenance techniques \nsuch as overt disclosures. \nOrganizations can document and delineate GAI system objectives and limitations to identify gaps where provenance data may be most useful. For instance, GAI systems used for content creation may require \nrobust watermarking techniques and corresponding detectors to identify the source of content or \nmetadata recording techniques and metadata management tools and repositories to trace content \norigins and modifications. Further narrowing of GAI task definitions to include provenance data can enable organizations to maximize the utility of provenance data and risk management efforts. \nA.1.7. \nEnhancing Content Provenance through Structured Public Feedback \nWhile indirect feedback methods such as automated error collection systems are useful, they often lack the context and depth\n that direct input from end users can provide. Organizations can leverage feedback \napproaches described in the Pre-Deployment Testing section to capture input from external sources such \nas through AI red- teaming. \nIntegrating pre - and post -deployment external feedback into the monitoring process for GAI models and \ncorresponding applications can help enhance awareness of performance changes and mitigate potential \nrisks and harms from outputs . There are many ways to capture and make use of user feedback – before \nand after GAI systems and digital content transparency approaches are deployed – to gain insights about \nauthentication efficacy and vulnerabilities, impacts of adversarial threats on techniques , and unintended \nconsequences resulting from the utilization of content provenance approaches on users and \ncommunities . Furthermore, organizations can track and document the provenance of datasets to identify \ninstances in which AI -generated data is a potential root cause of performance issues with the GAI \nsystem. \nA.1.8. Incident Disclosure \nOverview \nAI incidents can be defined as an “ event, circumstance, or series of events where the development, use, \nor malfunction of one or more AI systems directly or indirectly contribute s to one of the following harms: \ninjury or harm to the health of a person or group s of people (including psychological harms and harms to \nmental health); disruption of the management and operation of critical infrastructure; violations of \nhuman rights or a breach of obligations under applicable law intended to protect fundamental, labor, \nand intellectual property rights ; or harm to property, communities, or the environment. ” AI incidents can \noccur in the aggregate (i.e., for systemic discrimination) or acutely (i.e., for one individual). \nState of AI Incident Tracking and Disclosure \nFormal channels do not currently exist to report and document AI incidents. However, a number of publicly available databases\n have been created to document their occurrence. These reporting channels \nmake decisions on an ad hoc basis about what kinds of incidents to track. Some, for example, track by \namount of media coverage . ']","Organizations can enhance content provenance for GAI models by leveraging structured public feedback. This feedback can provide valuable context and depth that automated error collection systems may lack. By integrating pre- and post-deployment external feedback into the monitoring process, organizations can improve awareness of performance changes and mitigate potential risks and harms from GAI model outputs. User feedback can also help in understanding authentication efficacy, vulnerabilities, impacts of adversarial threats, and unintended consequences of content provenance approaches on users and communities. Additionally, tracking and documenting the provenance of datasets can help identify instances where AI-generated data may be causing performance issues in the GAI system.",reasoning,"[{'source': 'resources\\NIST.AI.600-1.pdf', 'page': 55, 'filename': 'resources\\NIST.AI.600-1.pdf'}]",True,"Organizations can use public feedback to enhance content provenance for GAI models by incorporating mechanisms for users to provide input on the sources of data used in the models. This can include allowing users to flag potentially unreliable sources or providing a platform for users to submit additional information or context about the data being used. By actively engaging with public feedback, organizations can improve the transparency and credibility of their GAI models, ultimately enhancing the overall trustworthiness of the technology."
13
+ How do feedback exercises and red-teaming help combat bias in GAI systems?,"[' \n29 MS-1.1-006 Implement continuous monitoring of GAI system impacts to identify whether GAI \noutputs are equitable across various sub- populations. Seek active and direct \nfeedback from affected communities via structured feedback mechanisms or red -\nteaming to monitor and improve outputs. Harmful Bias and Homogenization \nMS-1.1-007 Evaluate the quality and integrity of data used in training and the provenance of \nAI-generated content , for example by e mploying techniques like chaos \nengineering and seeking stakeholder feedback. Information Integrity \nMS-1.1-008 Define use cases, contexts of use, capabilities, and negative impacts where \nstructured human feedback exercises, e.g., GAI red- teaming, would be most \nbeneficial for GAI risk measurement and management based on the context of \nuse. Harmful Bias and \nHomogenization ; CBRN \nInformation or Capabilities \nMS-1.1-0 09 Track and document risks or opportunities related to all GAI risks that cannot be \nmeasured quantitatively, including explanations as to why some risks cannot be \nmeasured (e.g., due to technological limitations, resource constraints, or trustworthy considerations). Include unmeasured risks in marginal risks. Information Integrity \nAI Actor Tasks: AI Development, Domain Experts, TEVV \n \nMEASURE 1.3: Internal experts who did not serve as front -line developers for the system and/or independent assessors are \ninvolved in regular assessments and updates. Domain experts, users, AI Actors external to the team that developed or deployed the \nAI system, and affected communities are consulted in support of assessments as necessary per organizational risk tolerance . \nAction ID Suggested Action GAI Risks \nMS-1.3-001 Define relevant groups of interest (e.g., demographic groups, subject matter \nexperts, experience with GAI technology) within the context of use as part of \nplans for gathering structured public feedback. Human -AI Configuration ; Harmful \nBias and Homogenization ; CBRN \nInformation or Capabilities \nMS-1.3-002 Engage in internal and external evaluations , GAI red -teaming, impact \nassessments, or other structured human feedback exercises in consultation \nwith representative AI Actors with expertise and familiarity in the context of \nuse, and/or who are representative of the populations associated with the context of use. Human -AI Configuration ; Harmful \nBias and Homogenization ; CBRN \nInformation or Capabilities \nMS-1.3-0 03 Verify those conducting structured human feedback exercises are not directly \ninvolved in system development tasks for the same GAI model. Human -AI Configuration ; Data \nPrivacy \nAI Actor Tasks: AI Deployment, AI Development, AI Impact Assessment, Affected Individuals and Communities, Domain Experts, \nEnd-Users, Operation and Monitoring, TEVV \n ']","Feedback exercises and red-teaming help combat bias in GAI systems by implementing continuous monitoring to identify inequities in system outputs across different sub-populations. By seeking direct feedback from affected communities and using structured mechanisms, biases can be detected and addressed. Additionally, evaluating the quality and integrity of data used in training, employing techniques like chaos engineering, and seeking stakeholder feedback can help improve the fairness of AI-generated content. Defining use cases, contexts of use, capabilities, and negative impacts where structured human feedback exercises like red-teaming would be beneficial can also aid in measuring and managing GAI risks related to bias and homogenization. Tracking and documenting risks or opportunities that cannot be quantitatively measured, including explanations for why some risks cannot be measured, is essential for ensuring information integrity in GAI systems.",multi_context,"[{'source': 'resources\\NIST.AI.600-1.pdf', 'page': 32, 'filename': 'resources\\NIST.AI.600-1.pdf'}]",True,"Feedback exercises and red-teaming can help combat bias in GAI systems by providing opportunities for diverse perspectives to be considered and for potential biases to be identified and addressed. Feedback exercises involve gathering input from a variety of stakeholders, including individuals from different backgrounds and experiences, to ensure that the system is being evaluated from multiple viewpoints. Red-teaming involves intentionally challenging the system with adversarial thinking to uncover potential weaknesses or biases that may not have been initially apparent. By incorporating these practices into the development and testing of GAI systems, developers can work to mitigate bias and ensure that the technology is fair and equitable for all users."
testset_with_answers.json ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "question": "Which organizations from the private sector and civil society were involved in meetings with OSTP regarding the development of the Blueprint for an AI Bill of Rights?",
4
+ "contexts": [
5
+ "APPENDIX\n\u2022 OSTP conducted meetings with a variety of stakeholders in the private sector and civil society. Some of these\nmeetings were specifically focused on providing ideas related to the development of the Blueprint for an AI\nBill of Rights while others provided useful general context on the positive use cases, potential harms, and/or\noversight possibilities for these technologies. Participants in these conversations from the private sector and\ncivil society included:\nAdobe \nAmerican Civil Liberties Union (ACLU) The Aspen Commission on Information Disorder The Awood Center The Australian Human Rights Commission Biometrics Institute The Brookings Institute BSA | The Software Alliance Cantellus Group Center for American Progress Center for Democracy and Technology Center on Privacy and Technology at Georgetown Law Christiana Care Color of Change Coworker Data Robot Data Trust Alliance Data and Society Research Institute Deepmind EdSAFE AI Alliance Electronic Privacy Information Center (EPIC) Encode Justice Equal AI Google Hitachi's AI Policy Committee The Innocence Project Institute of Electrical and Electronics Engineers (IEEE) Intuit Lawyers Committee for Civil Rights Under Law Legal Aid Society The Leadership Conference on Civil and Human Rights Meta Microsoft The MIT AI Policy Forum Movement Alliance Project The National Association of Criminal Defense Lawyers O\u2019Neil Risk Consulting & Algorithmic Auditing The Partnership on AI Pinterest The Plaintext Group pymetrics SAP The Security Industry Association Software and Information Industry Association (SIIA) Special Competitive Studies Project Thorn United for Respect University of California at Berkeley Citris Policy Lab University of California at Berkeley Labor Center Unfinished/Project Liberty Upturn US Chamber of Commerce US Chamber of Commerce Technology Engagement Center \nA.I. Working Group\nVibrent HealthWarehouse Worker ResourceCenterWaymap\n62"
6
+ ],
7
+ "ground_truth": "OSTP conducted meetings with a variety of stakeholders in the private sector and civil society, including organizations such as Adobe, ACLU, The Aspen Commission on Information Disorder, The Australian Human Rights Commission, Biometrics Institute, The Brookings Institute, BSA | The Software Alliance, Cantellus Group, Center for American Progress, Center for Democracy and Technology, Center on Privacy and Technology at Georgetown Law, Christiana Care, Color of Change, Coworker, Data Robot, Data Trust Alliance, Data and Society Research Institute, Deepmind, EdSAFE AI Alliance, Electronic Privacy Information Center (EPIC), Encode Justice, Equal AI, Google, Hitachi's AI Policy Committee, The Innocence Project, Institute of Electrical and Electronics Engineers (IEEE), Intuit, Lawyers Committee for Civil Rights Under Law, Legal Aid Society, The Leadership Conference on Civil and Human Rights, Meta, Microsoft, The MIT AI Policy Forum, Movement Alliance Project, The National Association of Criminal Defense Lawyers, O'Neil Risk Consulting & Algorithmic Auditing, The Partnership on AI, Pinterest, The Plaintext Group, pymetrics, SAP, The Security Industry Association, Software and Information Industry Association (SIIA), Special Competitive Studies Project, Thorn, United for Respect, University of California at Berkeley Citris Policy Lab, University of California at Berkeley Labor Center, Unfinished/Project Liberty, Upturn, US Chamber of Commerce, US Chamber of Commerce Technology Engagement Center, A.I. Working Group, Vibrent Health, Warehouse Worker Resource Center, Waymap.",
8
+ "evolution_type": "simple",
9
+ "metadata": [
10
+ {
11
+ "source": "resources\\Blueprint-for-an-AI-Bill-of-Rights.pdf",
12
+ "page": 61,
13
+ "filename": "resources\\Blueprint-for-an-AI-Bill-of-Rights.pdf"
14
+ }
15
+ ],
16
+ "episode_done": true,
17
+ "answer": "The organizations from the private sector and civil society that were involved in meetings with OSTP regarding the development of the Blueprint for an AI Bill of Rights included tech companies such as Google, Microsoft, and IBM, as well as non-profit organizations like the Electronic Frontier Foundation and the American Civil Liberties Union (ACLU)."
18
+ },
19
+ {
20
+ "question": "How can statistical biases related to GAI content provenance be assessed and managed in evaluations involving human subjects?",
21
+ "contexts": [
22
+ " \n30 MEASURE 2.2: Evaluations involving human subjects meet applicable requirements (including human subject protection) and are \nrepresentative of the relevant population. \nAction ID Suggested Action GAI Risks \nMS-2.2-001 Assess and manage statistical biases related to GAI content provenance through \ntechniques such as re -sampling, re -weighting, or adversarial training. Information Integrity ; Information \nSecurity ; Harmful Bias and \nHomogenization \nMS-2.2-002 Document how content provenance data is tracked and how that data interact s \nwith privacy and security . Consider : Anonymiz ing data to protect the privacy of \nhuman subjects; Leverag ing privacy output \ufb01lters; Remov ing any personally \nidenti\ufb01able information (PII) to prevent potential harm or misuse. Data Privacy ; Human AI \nCon\ufb01guration; Information \nIntegrity ; Information Security ; \nDangerous , Violent, or Hateful \nContent \nMS-2.2-0 03 Provide human subjects with options to withdraw participation or revoke their \nconsent for present or future use of their data in GAI applications . Data Privacy ; Human -AI \nCon\ufb01guration; Information \nIntegrity \nMS-2.2-0 04 Use techniques such as anonymization , di\ufb00erential privacy or other privacy -\nenhancing technologies to minimize the risks associated with linking AI -generated \ncontent back to individual human subjects. Data Privacy ; Human -AI \nCon\ufb01guration \nAI Actor Tasks: AI Development, Human Factors, TEVV \n \nMEASURE 2.3: AI system performance or assurance criteria are measured qualitatively or quantitatively and demonstrated for \nconditions similar to deployment setting(s). Measures are documented. \nAction ID Suggested Action GAI Risks \nMS-2.3-001 Consider baseline model performance on suites of benchmarks when selecting a \nmodel for \ufb01ne tuning or enhancement with retrieval- augmented generation. Information Security ; \nConfabulation \nMS-2.3-002 Evaluate claims of model capabilities using empirically validated methods. Confabulation ; Information \nSecurity \nMS-2.3-003 Share results of pre -deployment testing with relevant GAI Actors , such as those \nwith system release approval authority. Human -AI Con\ufb01guration "
23
+ ],
24
+ "ground_truth": "Assess and manage statistical biases related to GAI content provenance in evaluations involving human subjects through techniques such as re-sampling, re-weighting, or adversarial training. It is important to ensure that the evaluations are representative of the relevant population and meet applicable requirements, including human subject protection.",
25
+ "evolution_type": "simple",
26
+ "metadata": [
27
+ {
28
+ "source": "resources\\NIST.AI.600-1.pdf",
29
+ "page": 33,
30
+ "filename": "resources\\NIST.AI.600-1.pdf"
31
+ }
32
+ ],
33
+ "episode_done": true,
34
+ "answer": "Statistical biases related to GAI content provenance can be assessed and managed in evaluations involving human subjects by implementing several strategies. \n\nFirstly, researchers can conduct a thorough review of the data sources and methodologies used to develop the GAI content to identify any potential biases. This can involve examining the training data used to develop the GAI, the algorithms used in the content generation process, and the evaluation metrics used to assess the performance of the GAI.\n\nSecondly, researchers can implement measures to mitigate biases in the evaluation process. This can include using diverse datasets to train and test the GAI, ensuring that the evaluation metrics used are appropriate and unbiased, and conducting sensitivity analyses to assess the impact of potential biases on the results.\n\nAdditionally, researchers can involve human subjects in the evaluation process to provide feedback on the GAI content and identify any potential biases or inaccuracies. This can help to ensure that the GAI content is relevant, accurate, and unbiased for the intended audience.\n\nOverall, by taking a comprehensive and transparent approach to assessing and managing statistical biases related to GAI content provenance in evaluations involving human subjects, researchers can improve the reliability and validity of their findings."
35
+ },
36
+ {
37
+ "question": "How can organizations use public feedback to enhance content provenance for GAI models?",
38
+ "contexts": [
39
+ " \n52 \u2022 Monitoring system capabilities and limitations in deployment through rigorous TEVV processes; \n\u2022 Evaluati ng how humans engage, interact with, or adapt to GAI content (especially in decision \nmaking tasks informed by GAI content), and how they react to applied provenance techniques \nsuch as overt disclosures. \nOrganizations can document and delineate GAI system objectives and limitations to identify gaps where provenance data may be most useful. For instance, GAI systems used for content creation may require \nrobust watermarking techniques and corresponding detectors to identify the source of content or \nmetadata recording techniques and metadata management tools and repositories to trace content \norigins and modi\ufb01cations. Further narrowing of GAI task de\ufb01nitions to include provenance data can enable organizations to maximize the utility of provenance data and risk management e\ufb00orts. \nA.1.7. \nEnhancing Content Provenance through Structured Public Feedback \nWhile indirect feedback methods such as automated error collection systems are useful, they often lack the context and depth\n that direct input from end users can provide. Organizations can leverage feedback \napproaches described in the Pre-Deployment Testing section to capture input from external sources such \nas through AI red- teaming. \nIntegrating pre - and post -deployment external feedback into the monitoring process for GAI models and \ncorresponding applications can help enhance awareness of performance changes and mitigate potential \nrisks and harms from outputs . There are many ways to capture and make use of user feedback \u2013 before \nand after GAI systems and digital content transparency approaches are deployed \u2013 to gain insights about \nauthentication e\ufb03cacy and vulnerabilities, impacts of adversarial threats on techniques , and unintended \nconsequences resulting from the utilization of content provenance approaches on users and \ncommunities . Furthermore, organizations can track and document the provenance of datasets to identify \ninstances in which AI -generated data is a potential root cause of performance issues with the GAI \nsystem. \nA.1.8. Incident Disclosure \nOverview \nAI incidents can be de\ufb01ned as an \u201c event, circumstance, or series of events where the development, use, \nor malfunction of one or more AI systems directly or indirectly contribute s to one of the following harms: \ninjury or harm to the health of a person or group s of people (including psychological harms and harms to \nmental health); disruption of the management and operation of critical infrastructure; violations of \nhuman rights or a breach of obligations under applicable law intended to protect fundamental, labor, \nand intellectual property rights ; or harm to property, communities, or the environment. \u201d AI incidents can \noccur in the aggregate (i.e., for systemic discrimination) or acutely (i.e., for one individual). \nState of AI Incident Tracking and Disclosure \nFormal channels do not currently exist to report and document AI incidents. However, a number of publicly available databases\n have been created to document their occurrence. These reporting channels \nmake decisions on an ad hoc basis about what kinds of incidents to track. Some, for example, track by \namount of media coverage . "
40
+ ],
41
+ "ground_truth": "Organizations can enhance content provenance for GAI models by leveraging structured public feedback. This feedback can provide valuable context and depth that automated error collection systems may lack. By integrating pre- and post-deployment external feedback into the monitoring process, organizations can improve awareness of performance changes and mitigate potential risks and harms from GAI model outputs. User feedback can also help in understanding authentication efficacy, vulnerabilities, impacts of adversarial threats, and unintended consequences of content provenance approaches on users and communities. Additionally, tracking and documenting the provenance of datasets can help identify instances where AI-generated data may be causing performance issues in the GAI system.",
42
+ "evolution_type": "reasoning",
43
+ "metadata": [
44
+ {
45
+ "source": "resources\\NIST.AI.600-1.pdf",
46
+ "page": 55,
47
+ "filename": "resources\\NIST.AI.600-1.pdf"
48
+ }
49
+ ],
50
+ "episode_done": true,
51
+ "answer": "Organizations can use public feedback to enhance content provenance for GAI models by incorporating mechanisms for users to provide input on the sources of data used in the models. This can include allowing users to flag potentially unreliable sources or providing a platform for users to submit additional information or context about the data being used. By actively engaging with public feedback, organizations can improve the transparency and credibility of their GAI models, ultimately enhancing the overall trustworthiness of the technology."
52
+ },
53
+ {
54
+ "question": "How do feedback exercises and red-teaming help combat bias in GAI systems?",
55
+ "contexts": [
56
+ " \n29 MS-1.1-006 Implement continuous monitoring of GAI system impacts to identify whether GAI \noutputs are equitable across various sub- populations. Seek active and direct \nfeedback from a\ufb00ected communities via structured feedback mechanisms or red -\nteaming to monitor and improve outputs. Harmful Bias and Homogenization \nMS-1.1-007 Evaluate the quality and integrity of data used in training and the provenance of \nAI-generated content , for example by e mploying techniques like chaos \nengineering and seeking stakeholder feedback. Information Integrity \nMS-1.1-008 De\ufb01ne use cases, contexts of use, capabilities, and negative impacts where \nstructured human feedback exercises, e.g., GAI red- teaming, would be most \nbene\ufb01cial for GAI risk measurement and management based on the context of \nuse. Harmful Bias and \nHomogenization ; CBRN \nInformation or Capabilities \nMS-1.1-0 09 Track and document risks or opportunities related to all GAI risks that cannot be \nmeasured quantitatively, including explanations as to why some risks cannot be \nmeasured (e.g., due to technological limitations, resource constraints, or trustworthy considerations). Include unmeasured risks in marginal risks. Information Integrity \nAI Actor Tasks: AI Development, Domain Experts, TEVV \n \nMEASURE 1.3: Internal experts who did not serve as front -line developers for the system and/or independent assessors are \ninvolved in regular assessments and updates. Domain experts, users, AI Actors external to the team that developed or deployed the \nAI system, and a\ufb00ected communities are consulted in support of assessments as necessary per organizational risk tolerance . \nAction ID Suggested Action GAI Risks \nMS-1.3-001 De\ufb01ne relevant groups of interest (e.g., demographic groups, subject matter \nexperts, experience with GAI technology) within the context of use as part of \nplans for gathering structured public feedback. Human -AI Con\ufb01guration ; Harmful \nBias and Homogenization ; CBRN \nInformation or Capabilities \nMS-1.3-002 Engage in internal and external evaluations , GAI red -teaming, impact \nassessments, or other structured human feedback exercises in consultation \nwith representative AI Actors with expertise and familiarity in the context of \nuse, and/or who are representative of the populations associated with the context of use. Human -AI Con\ufb01guration ; Harmful \nBias and Homogenization ; CBRN \nInformation or Capabilities \nMS-1.3-0 03 Verify those conducting structured human feedback exercises are not directly \ninvolved in system development tasks for the same GAI model. Human -AI Con\ufb01guration ; Data \nPrivacy \nAI Actor Tasks: AI Deployment, AI Development, AI Impact Assessment, A\ufb00ected Individuals and Communities, Domain Experts, \nEnd-Users, Operation and Monitoring, TEVV \n "
57
+ ],
58
+ "ground_truth": "Feedback exercises and red-teaming help combat bias in GAI systems by implementing continuous monitoring to identify inequities in system outputs across different sub-populations. By seeking direct feedback from affected communities and using structured mechanisms, biases can be detected and addressed. Additionally, evaluating the quality and integrity of data used in training, employing techniques like chaos engineering, and seeking stakeholder feedback can help improve the fairness of AI-generated content. Defining use cases, contexts of use, capabilities, and negative impacts where structured human feedback exercises like red-teaming would be beneficial can also aid in measuring and managing GAI risks related to bias and homogenization. Tracking and documenting risks or opportunities that cannot be quantitatively measured, including explanations for why some risks cannot be measured, is essential for ensuring information integrity in GAI systems.",
59
+ "evolution_type": "multi_context",
60
+ "metadata": [
61
+ {
62
+ "source": "resources\\NIST.AI.600-1.pdf",
63
+ "page": 32,
64
+ "filename": "resources\\NIST.AI.600-1.pdf"
65
+ }
66
+ ],
67
+ "episode_done": true,
68
+ "answer": "Feedback exercises and red-teaming can help combat bias in GAI systems by providing opportunities for diverse perspectives to be considered and for potential biases to be identified and addressed. Feedback exercises involve gathering input from a variety of stakeholders, including individuals from different backgrounds and experiences, to ensure that the system is being evaluated from multiple viewpoints. Red-teaming involves intentionally challenging the system with adversarial thinking to uncover potential weaknesses or biases that may not have been initially apparent. By incorporating these practices into the development and testing of GAI systems, developers can work to mitigate bias and ensure that the technology is fair and equitable for all users."
69
+ }
70
+ ]