BrowseComp-V3 / decryption_guide.md
Halcyon-Zhang's picture
Upload folder using huggingface_hub
691fc0b verified
# BCV3 Decryption Guide
## Overview
The BCV3 dataset includes encrypted question-answer pairs to protect intellectual property while allowing community review. This guide explains how to decrypt them.
## Encryption Details
- **Algorithm**: AES-256-GCM (Galois/Counter Mode)
- **Key Derivation**: SHA-256 hash of the passphrase
- **IV Format**: 16-byte random initialization vector (base64-encoded)
- **Authentication**: 16-byte GCM tag for integrity verification
## Key
Use the following passphrase to derive the AES-256-GCM key:
```
A_Visual_Vertical_Verifiable_Benchmark_for_Multimodal_Browsing_Agents
```
## Data Format
The dataset uses **one canonical format: `train.jsonl`** (optimized and deduplicated):
```json
{
"id": "...",
"category": "...",
"sub_category": "...",
"image": "...",
"image_paths": "[...JSON string...]",
"encrypted_question": "{...JSON string...}",
"encrypted_answer": "{...JSON string...}",
"metadata": "{...JSON string (includes trajectory)...}",
"sub_goals": "[...JSON string...]"
}
```
**Key optimizations:**
-**No redundant trajectory**: trajectory is inside `metadata`, not duplicated at top level
-**JSON strings**: All fields are serialized as JSON for HuggingFace Dataset Viewer compatibility
-**Space savings**: 28.1% reduction from original (2.0 MB → 1.44 MB)
**Legacy format:** The original `bcv3_encrypted.jsonl` (with redundant top-level trajectory) is archived in `/archive/` for reference only.
## Requirements
```bash
pip install cryptography
```
## Usage
### 1. Decrypt the whole dataset to a single JSON file
```bash
python scripts/decryption_script.py \
--input data/train.jsonl \
--key "A_Visual_Vertical_Verifiable_Benchmark_for_Multimodal_Browsing_Agents" \
--output decrypted_bcv3.json
```
**Options:**
- `--keep-encrypted`: Keep encrypted fields in output (default: remove them)
**Example output:**
```json
[
{
"id": "001_Culture_Art_L3_p2_t2_m0_r2_w0_c0_g5",
"question": "The content in Figure 1 is a classic of a certain religion...",
"answer": "2",
"metadata": {...},
...
}
]
```
### 2. Batch decrypt to per-sample JSON files
```bash
# Create a key file
echo "A_Visual_Vertical_Verifiable_Benchmark_for_Multimodal_Browsing_Agents" > key.txt
# Run batch decryption
python scripts/decrypt_batch.py \
--input data/train.jsonl \
--key-file key.txt \
--output-dir decrypted_samples/
```
**Options:**
- `--keep-encrypted`: Keep encrypted fields in output (default: remove them)
**Output structure:**
```
decrypted_samples/
├── 001_Culture_Art_L3_p2_t2_m0_r2_w0_c0_g5.json
├── 002_Culture_Art_...json
└── ...
```
### 3. Using archived legacy format (optional)
If you need to work with the archived original format:
```bash
# Scripts support legacy bcv3_encrypted.jsonl (archived in /archive/)
python scripts/decryption_script.py \
--input ../archive/bcv3_encrypted.jsonl \
--key "A_Visual_Vertical_Verifiable_Benchmark_for_Multimodal_Browsing_Agents" \
--output decrypted_legacy.json
```
The scripts automatically detect and handle both formats.
## Python API
```python
from encryption_utils import derive_key, decrypt_text
key_str = "A_Visual_Vertical_Verifiable_Benchmark_for_Multimodal_Browsing_Agents"
key = derive_key(key_str)
# Decrypt a single encrypted field (dict with iv/ciphertext/tag)
encrypted_dict = {
"iv": "...",
"ciphertext": "...",
"tag": "..."
}
plaintext = decrypt_text(encrypted_dict, key)
```
## Verification
Test decryption with a small sample:
```bash
head -1 data/train.jsonl | python3 << 'EOF'
import sys
import json
sys.path.insert(0, 'scripts')
from encryption_utils import derive_key, decrypt_text
key = derive_key("A_Visual_Vertical_Verifiable_Benchmark_for_Multimodal_Browsing_Agents")
obj = json.loads(sys.stdin.read())
enc_q = json.loads(obj['encrypted_question'])
enc_a = json.loads(obj['encrypted_answer'])
print("Question:", decrypt_text(enc_q, key)[:80])
print("Answer:", decrypt_text(enc_a, key))
EOF
```
## Troubleshooting
### "Decryption failed" or integrity error
- Verify you're using the exact passphrase (case-sensitive)
- Ensure the encrypted data has valid iv/ciphertext/tag fields
### "Unrecognized format" warning
- The script will skip records that don't have encrypted fields
- Check that your input file is in the expected format
### File not found
- Ensure paths are relative to the script directory or use absolute paths
- For batch mode, the key file must exist and be readable
## Questions?
For issues or questions about decryption, please refer to the main README or file an issue on the repository.