| --- |
| tags: |
| - vector-database |
| - embeddings |
| - parquet |
| - qdrant |
| - stackoverflow |
| - question-answering |
| pretty_name: StackOverflow Vector Dataset - Python |
| license: cc-by-sa-4.0 |
| size_categories: |
| - 1M<n<10M |
| --- |
| |
| # Python StackOverflow Vector Dataset |
|
|
| ## Summary |
|
|
| This repository contains the Python shard of the Stack2Graph vector retrieval dataset. |
| Each Hugging Face dataset repository contains one programming-language shard and is intended to restore or rebuild the Qdrant collection `stackoverflow_python_vector`. |
|
|
| The dataset is the vector counterpart to the Stack2Graph RDF knowledge graph. It is designed for hybrid retrieval, graph entry-point finding, and retrieval-augmented generation experiments over Stack Overflow content. |
|
|
| Stack2Graph source: |
| [https://github.com/tha-atlas/Stack2Graph](https://github.com/tha-atlas/Stack2Graph) |
|
|
| ## Repository Layout |
|
|
| ```text |
| README.md |
| dataset_manifest.json |
| qdrant_snapshots/ |
| collections_manifest.json |
| stackoverflow_python_vector.tar.zst |
| stackoverflow_python_vector.snapshot.zst.part_000 |
| ... |
| question_metadata/ |
| r0_00000.parquet |
| chunk_records/ |
| r0_00000.parquet |
| question_records/ |
| r0_00000.parquet |
| ``` |
|
|
| - `dataset_manifest.json`: language-scoped manifest listing the files in this shard. |
| - `qdrant_snapshots/collections_manifest.json`: language-scoped Qdrant snapshot manifest. |
| - `qdrant_snapshots/stackoverflow_python_vector.*`: optional Qdrant restore artifact files for `stackoverflow_python_vector`. |
| - `question_metadata/*.parquet`: question-level metadata used by parent-child chunk retrieval. |
| - `chunk_records/*.parquet`: chunk-level vector rows when parent-child indexing is enabled. |
| - `question_records/*.parquet`: question-level vector rows when non-chunked export is used. |
|
|
| The Hugging Face upload is one repository per language. During upload, the local leading language directory is removed, so local files such as `python/chunk_records/r0_00000.parquet` appear in this repository as `chunk_records/r0_00000.parquet`. |
|
|
| ## Data Model |
|
|
| Rows are derived from Stack Overflow questions tagged for Python. |
|
|
| The current Stack2Graph vector pipeline uses: |
|
|
| - dense vectors from `Qwen/Qwen3-Embedding-8B` |
| - 4096-dimensional dense embeddings with last-token pooling |
| - instruction-aware query embedding for retrieval |
| - sparse lexical vectors from `BAAI/bge-m3` |
| - unified question text containing title, tags, cleaned problem text, and code |
| - optional parent-child indexing where chunk hits collapse back to parent question IDs |
|
|
| When Qdrant snapshots are included, they are the fastest restore path. The Parquet files remain the portable fallback for rebuilding the collection. |
|
|
| ## Coverage |
|
|
| This repository contains only the Python shard. A Stack Overflow question can appear in more than one language shard when it has multiple programming-language tags. |
|
|
| The dataset is not a complete Stack Overflow mirror. Full question and answer graph context lives in the corresponding Stack2Graph knowledge graph artifacts; the vector dataset stores retrieval rows, vectors, sparse weights, and routing metadata. |
|
|
| ## Recommended Use |
|
|
| Use this dataset for: |
|
|
| - semantic and hybrid retrieval |
| - Qdrant restore or ingestion tests |
| - Stack2Graph RAG experiments |
| - graph entry-point retrieval before QLever graph expansion |
| - vector database benchmarking and diagnostics |
|
|
| This dataset is not intended as a standalone supervised training dataset. |
|
|
| ## Restore With Stack2Graph |
|
|
| You do not need to regenerate embeddings to use this dataset. |
|
|
| Typical workflow: |
|
|
| 1. Clone Stack2Graph and configure `.env` with service paths and HF token. |
| 2. Start local services: |
|
|
| ```bash |
| docker compose up -d |
| ``` |
|
|
| 3. Download and restore vector artifacts: |
|
|
| ```bash |
| python -m experiment.sources.hf --skip-kg |
| ``` |
|
|
| The loader restores Qdrant snapshots when present and falls back to Parquet ingestion when snapshots are unavailable. |
|
|
| ## Manual Use |
|
|
| For manual use, inspect `dataset_manifest.json`, then either: |
|
|
| - restore the Qdrant snapshot artifacts under `qdrant_snapshots/`, or |
| - ingest the listed Parquet shards into a compatible vector database. |
|
|
| The target Qdrant collection name is: |
|
|
| ```text |
| stackoverflow_python_vector |
| ``` |
|
|
| ## Quality Notes |
|
|
| - Embedding quality depends on the configured Stack2Graph export pipeline and model versions. |
| - Sparse text can be generated from the same unified text as dense embeddings or from a lexical variant, depending on export configuration. |
| - Community-generated Stack Overflow content may contain errors, outdated information, bias, or incomplete answers. |
| - Rebuilding from Parquet may produce operational differences if Qdrant collection settings differ from the original export. |
|
|
| ## License And Attribution |
|
|
| This dataset is derived from Stack Overflow content and is distributed under `CC-BY-SA-4.0`. |
| Preserve required attribution and license notices when redistributing derived artifacts. |
|
|
| ## Citation |
|
|
| If you use this dataset, cite the Stack2Graph project and preserve Stack Overflow attribution requirements: |
|
|
| - Stack2Graph: A Structured Knowledge Representation of Stack Overflow Data for Retrieval-based Question Answering |
|
|