The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
Danbooru Tag Wiki Vector DB
A single-file SQLite database of Danbooru
general-category tag wiki pages, with a sqlite-vec virtual table holding
640-dim embeddings of each cleaned wiki body. Built to enable natural-language
search over Danbooru's tag vocabulary — give it a phrase like
"a girl wearing a sailor uniform" and get back the tags whose wiki
descriptions match.
Source code (fetcher, embedder, query CLI) lives at github.com/JackBinary/danbooru-db.
At a glance
| File | danbooru.db (single SQLite file, ~36 MB) |
| Tags | 9,322 general-category tags with post_count >= 1000 and a valid wiki page |
| Embedded | 9,287 tags (a few wiki bodies are empty/stub) |
| Embedding dim | 640 |
| Embedding model | mykor/harrier-oss-v1-270m-GGUF (BF16 at index time) — a GGUF of microsoft/harrier-oss-v1-270m, a 270M-param Gemma-embedding model with last-token pooling |
| Vector storage | sqlite-vec vec0 virtual table |
| Pooling | last-token, L2-normalized |
| Max input | 248 tokens per wiki body (≈1000 chars) — see Caveats |
Schema
Two tables in one SQLite file:
tags
One row per general-category tag.
| column | type | notes |
|---|---|---|
rowid |
INTEGER PK | joins to vec_tags.rowid |
name |
TEXT UNIQUE | e.g. cat_ears, long_hair |
post_count |
INTEGER | Danbooru post count at fetch time |
tag_id |
INTEGER | Danbooru tag id |
wiki_id |
INTEGER | Danbooru wiki page id |
body_raw |
TEXT | Original dtext source from the wiki |
body_clean |
TEXT | dtext stripped; See Also section extracted; everything from the first Posts header onward dropped. This is what was embedded. |
see_also |
TEXT | JSON array of tag names from the wiki's See Also section |
other_names |
TEXT | JSON array of alternate names |
wiki_updated_at |
TEXT | ISO 8601 |
fetched_at |
TEXT | ISO 8601 |
embedded_at |
TEXT | ISO 8601, NULL if not embedded |
vec_tags
A sqlite-vec virtual table:
CREATE VIRTUAL TABLE vec_tags USING vec0(embedding float[640]);
Keyed by rowid matching tags.rowid. Vectors are stored as L2-normalized
float32, so cosine similarity equals 1 - distance/2 for the L2 distance
that sqlite-vec returns by default.
Usage
You need the sqlite-vec extension loaded into your SQLite connection
(plain SQLite will error on vec_tags). In Python:
import sqlite3, sqlite_vec
conn = sqlite3.connect("danbooru.db")
conn.enable_load_extension(True)
sqlite_vec.load(conn)
conn.enable_load_extension(False)
# Plain metadata query — no extension needed for this one:
for name, pc in conn.execute(
"SELECT name, post_count FROM tags ORDER BY post_count DESC LIMIT 5"
):
print(name, pc)
Top 5 tags by post count (sanity check):
1girl 7884730
solo 6603611
long_hair 5804917
breasts 4638498
looking_at_viewer 4565846
Semantic search
To do retrieval you need to embed a query with the same model family as the index. Harrier expects an instruction prefix for queries (not docs):
Instruct: <task>
Query: <text>
The companion CLI uses Q8_0 at query time against the BF16 index (cosine ≈ 0.9997 between BF16 and Q8_0 query vectors, so target ranks against the BF16 corpus are unchanged but Q8_0 is ~5× faster to load and run):
uv run danbooru-db-query --db danbooru.db "a girl wearing a sailor uniform"
The query is L2-normalized and matched with:
SELECT t.name, t.post_count, v.distance, t.body_clean
FROM vec_tags v
JOIN tags t ON t.rowid = v.rowid
WHERE v.embedding MATCH :query_blob AND k = 10
ORDER BY v.distance;
How it was built
- Fetch tags (
danbooru-db-fetch --phase tags) — paginated tag list from Danbooru's API filtered to general category withpost_count >= 1000. - Fetch wikis (
danbooru-db-fetch --phase wikis) — wiki page for each tag, rate-limited to 1 request/second to be polite. dtext is parsed to producebody_clean(markup stripped,See Alsoextracted to its own column, content from the firstPostsheader onward dropped). - Embed (
danbooru-db-embed) —body_cleantruncated to 248 tokens and embedded with the BF16 Harrier-OSS GGUF, L2-normalized, written tovec_tags.
Caveats
- 248-token truncation.
llama-cpp-pythonhard-caps per-sequence context at 256 tokens. Wiki bodies are truncated to 248 tokens (≈1000 chars) before embedding. Tag definitions at the top of each wiki survive; trailing related-tag lists do not. If you want full-document embeddings, re-embedbody_cleanwith a different runtime. - General-category only. Character/copyright/artist/meta tags are excluded — this is a vocabulary of visual content tags.
post_count >= 1000floor. The long tail of rare tags isn't here.- Wiki content is a snapshot. Fetched May 2026.
post_countand wiki bodies drift over time; rebuild from the source repo to refresh. - Some bodies are empty. 35 of 9,322 tags have a wiki page but an empty
body_cleanafter cleanup and are not embedded.
License
The embeddings, schema, and cleaned bodies in this database are derived from Danbooru's tag wikis, which are user-contributed content on danbooru.donmai.us. Original wiki text remains the property of its contributors and is subject to Danbooru's terms of use. The build pipeline (the GitHub repo) is published under its repository license; this dataset card and the SQLite container are released for research and personal use. If you redistribute, credit Danbooru and the wiki authors.
Citation
If this dataset is useful in published work, please cite the embedding model and the source:
@misc{harrier-oss-v1-270m,
title = {Harrier-OSS-v1-270M},
author = {Microsoft},
url = {https://huggingface.co/microsoft/harrier-oss-v1-270m},
}
@misc{danbooru-tag-wiki-vector-db,
title = {Danbooru Tag Wiki Vector DB},
author = {JackBinary},
url = {https://github.com/JackBinary/danbooru-db},
year = {2026},
}
- Downloads last month
- 36