File size: 7,606 Bytes
9f06351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9e087cb
98e4e69
 
dab4357
9f06351
 
dab4357
9f06351
 
 
37c945c
 
dab4357
9f06351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f9d1fbe
 
9f06351
f9d1fbe
9f06351
f9d1fbe
 
9f06351
f9d1fbe
 
9f06351
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
pretty_name: APOC offline knowledge index
language:
- en
license: other
license_name: mixed-source-licenses
license_link: https://huggingface.co/datasets/MannyMorningstar/APOC-embedding/blob/main/README.md#licensing-and-attribution
tags:
- retrieval
- embeddings
- offline
- survival
- bge-small
- faiss
- sqlite-fts5
size_categories:
- 10M<n<100M
---

# APOC offline knowledge index

Text chunks, embeddings and search indexes for **APOC**, an offline survival and
rebuilding knowledge appliance (medicine, practical skills, engineering, science).
The appliance searches this library locally and answers questions with a local
model that cites numbered sources. No network is used at runtime.

This dataset is **public**. It is a working build area, not a single finished
release: read the status table before using a package.

## What is here

| Path | Contents | Status |
| --- | --- | --- |
| **`app/`** | **Android app** (`apoc-20261113-debug.apk`, debug-signed test build). On first launch it downloads the library below from a pinned revision and checks every file; see `app/README.md` | Not yet run on a phone |
| **`combined/apoc-combined-v2/`** | **Re-embedded vectors for the complete library (24,825,562 chunks):** BGE-small on title + section + text, up to 512 tokens, **384-d int8, no projection**; binary IVF ANN (16,384 lists) with exact int8 rerank store; Tantivy keyword index (`keyword/tantivy-index.tar`); **phone passages database `passages/passages.sqlite.gz`** (all 24,825,562 chunks with sources; 6.7 GB, 27.0 GB unpacked; checksums in `passages/manifest.json`); `evaluation.json`. Source text shards stay in v1 (same chunk ids) | **Current. Use this package.** Built 2026-11-11; vector gold@10 72 / 64 / 52% (original / paraphrase / typo questions) vs 50 / 50 / 34% for v1 |
| **`combined/apoc-combined-v1/`** | **Text of the complete library: 24,825,562 chunks** (58 non-Wikipedia sources + practical Wikipedia subset): `chunks-*.jsonl.gz`, `metadata.jsonl.gz`, `recall.json`, `manifest.json`. Library chunk IDs unchanged; Wikipedia IDs offset by 1,000,000,000 | Text and metadata for v2. Its 256-d vectors, ids and ANN (2026-11-11) and FTS5 index (2026-11-12) were removed as superseded by v2; checksums are kept under `removed` in its manifest. Built 2026-11-09 |
| `wikipedia-subsets/practical-20261026T161444Z-expanded-final/` | Practical Wikipedia subset: 2,899 articles, 58,317 chunks, 626 checklist topics, 0 unresolved | Source of the Wikipedia part of the combined library; complete and verified |
| `evaluations/combined-qwen3-4b-20261026/` | Exploratory answer test over 24,825,562 chunks (58 non-Wikipedia sources + practical subset) with Qwen3-4B | Six exploratory questions, not a benchmark; manual review found grounding problems |

Removed on 2026-11-11 as superseded (all content is in the combined packages): the root 940,838-chunk sample package, `full-runs/` (the incomplete 59-source run and its recovery checkpoints), two earlier Wikipedia subset versions, `test4-results/`, and v1's vectors. They remain in this repository's git history.

## Data contract

**v2 (current):** same model and revision, same query prefix, max length **512**, passage text = title, section (if different) and text, CLS pooling, L2-normalized **384-d**, **no projection**, int8 = `rint(clip(x, -1, 1) * 127)`. ANN codes are `int8 >= 0` bits (384). Recommended search nprobe 1024, 10,000 candidates. Never mix v1 and v2 vectors.

**v1 (historical; its vectors were removed on 2026-11-11):** query vectors for v1 were produced this way:

- Encoder: [`BAAI/bge-small-en-v1.5`](https://huggingface.co/BAAI/bge-small-en-v1.5),
  revision `5c38ec7c405ec4b44b94cc5a9bb96e735b38267a`, **max length 256**, CLS pooling,
  L2-normalized 384-dimensional output.
- Queries are prefixed with exactly `Represent this sentence for searching relevant passages: `.
  Passages have no prefix.
- Projection 384 → 256 with a Gaussian matrix seeded `20261017 + 384`, divided by
  sqrt(256), then L2-normalized again. This is a projection, not truncation.
- `vectors-*.npy`: projected normalized float16. `ids-*.npy`: int64 chunk IDs.
- `ann/`: int8 vectors (`rint(clip(x, -1, 1) * 127)`) and a FAISS
  `IndexBinaryIVF_HNSW16` over sign bits (`int8 >= 0`), for candidate generation
  followed by exact int8 squared-L2 reranking. Binary codes are not the original vectors.
  Recommended: nprobe 64, 5,000 candidates.
- Chunking: target 320 tokens, overlap 48, tokenizer SHA-256
  `d241a60d5e8f04cc1b2b3e9ef7a4921b27bf526d9f6050ab90f9267a1f9e5c66`.
- `chunks-*.jsonl.gz`: chunk text and source metadata. `metadata.jsonl.gz`: source,
  unit and settings records.

A configuration with max length 512 (used in some local development samples) is a
different contract and must not be mixed with these vectors.

## Models used by APOC

Both models are mirrored in this dataset under [`models/`](https://huggingface.co/datasets/MannyMorningstar/APOC-embedding/tree/main/models)
(`models/manifest.json` has every file's SHA-256), pinned to these upstream revisions:

| Role | Upstream | Revision | Mirror |
| --- | --- | --- | --- |
| Query encoder | [`BAAI/bge-small-en-v1.5`](https://huggingface.co/BAAI/bge-small-en-v1.5) (MIT) | `5c38ec7c405ec4b44b94cc5a9bb96e735b38267a` | `models/encoder/bge-small-en-v1.5/` (graph and tokenizer byte-identical to the corpus build) |
| Answer model | [`unsloth/Qwen3.5-4B-GGUF`](https://huggingface.co/unsloth/Qwen3.5-4B-GGUF), base [`Qwen/Qwen3.5-4B`](https://huggingface.co/Qwen/Qwen3.5-4B) (Apache-2.0) | `e87f176479d0855a907a41277aca2f8ee7a09523` | `models/answer/Qwen3.5-4B-UD-Q4_K_XL.gguf`, 2,912,109,728 bytes, SHA-256 `b252c5610a42ca82d20fe2a12813e9d069eed89292907e26c783eeb0bc961bc7` |

The answer model runs on llama.cpp b11711. Disable its thinking by pre-filling an empty
`<think></think>` block (or `enable_thinking=false`); the `/no_think` soft switch is unreliable.

## Licensing and attribution

This dataset contains text derived from third-party sources. **Each source keeps its
own license; there is no single license for the whole dataset.** Most sources were
obtained as [Kiwix](https://kiwix.org) ZIM archives; the original archive name and
SHA-256 are recorded per source in `metadata.jsonl.gz` and the run reports.

Source families include, among others:

- Wikimedia projects (Wikipedia, Wikibooks, Wikivoyage, Wikiversity, Wikisource,
  Wiktionary): generally CC BY-SA, with attribution via the original article.
- Stack Exchange sites: user contributions under CC BY-SA (version depends on post date).
- LibreTexts and iFixit: content is often under **non-commercial** licenses
  (e.g. CC BY-NC-SA), which restricts commercial reuse of those portions.
- Appropedia, Energypedia, WikEM, MDWiki and similar wikis: their own open licenses.
- US government publications (e.g. CDC, Ready.gov, USDA, Army publications) are
  generally public domain; NHS content is under the Open Government Licence;
  MSF medical guidelines are under MSF's own terms.

A per-source license review has **not** been completed. If you reuse this data,
check the license of each source you use, keep attribution to the original pages,
and honor share-alike and non-commercial terms. Nothing here is medical or
engineering advice.

## Provenance

Built by the APOC preparation pipeline (SQLite FTS5, BGE-small int8 vectors, FAISS
binary IVF). Run reports, coverage audits and recovery checkpoints are kept beside
each package. Operational run-control files were removed from the current revision
on 2026-11-09; earlier revisions remain in this repository's history.