|
Download code/README.md from bryan7264/lorapop: direct link, hf CLI and curl.
- Browser
- Download file 4.88 kB
-
https://huggingface.co/datasets/bryan7264/lorapop/resolve/main/code/README.md
- Command line
-
hf download hf://datasets/bryan7264/lorapop/code/README.md
-
curl -L -o README.md https://huggingface.co/datasets/bryan7264/lorapop/resolve/main/code/README.md
4.88 kB
| # Population genetics of public fine-tunes | |
| MIT License, Bryan Cheng, 2026. | |
| The public LoRA adapters of one base model (Qwen2.5-0.5B-Instruct) are treated as a genetic population: | |
| - **Genotypes** are expressed weight updates: the update weighted by the base model's input covariance, E = Delta V | |
| Lambda^{1/2}. Per-module principal axes of the expressed updates are the loci. | |
| - **Phenotypes** are a fixed behavioural battery of 53 reliable traits. | |
| - **Relatedness** has two layers: descent (shared initialization) and function. | |
| Seven association estimators are scanned: naive, PC, MM-f, MM-fd, WF-d, WF-r and DUP-AFE. Each is calibrated against | |
| interventions (transplants, knockouts and dosing), randomized crosses and spike-ins. | |
| Status, decisions and results: | |
| - `STATUS.md`: what is running and what comes next. | |
| - `RESEARCH_PLAN.md`: the pre-registered plan. | |
| - `DECISIONS.md`: every deviation, with date and reason. | |
| - `TRAINING_LOG.md`: every compute job. | |
| - `RESULTS.md`: every reported number, with its source file. | |
| ## Data, models and code | |
| - Code, documents, paper and job logs: this repository. | |
| - Data and results: the Hugging Face dataset | |
| [bryan7264/lorapop](https://huggingface.co/datasets/bryan7264/lorapop). It holds processed genotypes and kinship | |
| matrices for every population, phenotype tables, scans, interventions, crosses, E1/E6/E7 outputs, the Hugging Face | |
| index and the reference corpus, plus a copy of this code under `code/`. | |
| - Adapters we trained (seed siblings, opposite and trait-targeted fine-tunes on Qwen2.5-0.5B-Instruct and TinyLlama): the | |
| Hugging Face model repository [bryan7264/lorapop-adapters](https://huggingface.co/bryan7264/lorapop-adapters). | |
| - Not redistributed: the third-party public adapters and reduced full fine-tunes (re-download with `src/data/`; repo | |
| ids are in the index), the HarmBench behaviour list (download it from its source) and intermediate gradient files. | |
| ## Layout | |
| | path | content | | |
| |---|---| | |
| | `src/lorapop/` | core library: adapter loading (`adapters.py`), base covariances (`basecov.py`), genotypes and alleles (`genotype.py`), kinship (`kinship.py`), bank-mode low-rank updates (`deltas.py`), behavioural battery (`battery.py`) | | |
| | `src/data/` | Hugging Face enumeration and adapter download | | |
| | `src/train/` | controlled training: seed siblings, opposite and trait-targeted fine-tunes | | |
| | `src/run/` | GPU and CPU stages: `phenotype.py`, `genotypes.py`, `scan_run.py`, `intervene.py`, `cross.py`, `spikein.py`, `repair.py` | | |
| | `src/analysis/` | population build, scans and diagnostics, intervention planning, calibration, crosses, spike-ins, architecture, forecasts, prediction, audit, meta-analysis | | |
| | `tests/` | unit tests (`pytest -q tests`) | | |
| | `slurm/` | job scripts and the two lane runners (`lane.sh` for devel GPU, `lane_cpu.sh` for devel CPU) with their queues | | |
| | `results/` | outputs of every stage, one JSON or NPZ per unit | | |
| | `paper/` | LaTeX sections and the verified bibliography (`tools/make_bib.py`) | | |
| | `novelty/` | literature search, the verified reference list and the novelty report | | |
| ## Pipeline (Qwen2.5-0.5B-Instruct) | |
| 1. Enumerate and download adapters: | |
| - `src/data/hf_enumerate.py` | |
| - `src/data/fetch_adapters.py --index data/raw/hf_index/<base>.adapter.jsonl --out data/raw/adapters/<base>` | |
| 2. Genotypes and relatedness: `src/run/genotypes.py --base <base> --adapters <dir> --out data/processed/qwen05`. | |
| 3. Phenotypes: `src/run/phenotype.py` (slurm/pheno_array.sh, slurm/pheno_devel.sh). Cross-hardware concordance: | |
| `src/analysis/concordance.py`. | |
| 4. Seed siblings and law (E1): `src/train/train_lora.py` (slurm/dv_train.sh), then `src/analysis/e1_siblings.py`. Wild | |
| population: `src/analysis/e1_wild.py`. | |
| 5. Scans (E2): `src/run/scan_run.py --recipe_threshold <E1 value>` (slurm/scan_devel.sh), `src/analysis/scan_extras.py` | |
| and `src/analysis/obs_boot.py`. | |
| 6. Interventions (E3): | |
| - `src/analysis/plan_interventions.py` | |
| - `src/run/intervene.py --claim --shared_zero --gen_half 0` (slurm/iv_devel.sh, slurm/iv_array.sh) | |
| - `src/analysis/calibrate.py` | |
| 7. Crosses (E4): `src/analysis/crosses.py parents`, `src/run/cross.py make|run` (slurm/cx_devel.sh), then | |
| `src/analysis/crosses.py layers|analyze`. | |
| 8. Spike-ins (E5): `src/run/spikein.py`, `src/analysis/spikein.py`. | |
| 9. Architecture, forecasts, prediction, audit and repair (E6-E8): `src/analysis/architecture.py`, `forecast.py`, | |
| `predict.py`, `audit.py`, `src/run/repair.py`. | |
| Work is shared between jobs through lock files (`--claim`), and every stage resumes from its per-unit outputs. GPU | |
| batch sizes are capped by GPU memory (`battery.batch_cap`). Each hardware configuration measures its own c = 0 | |
| references. | |
| ## Environment | |
| The Python dependencies are listed in `requirements.txt` (torch 2.7.1 + CUDA 12.8, transformers 4.56.2). The frozen | |
| environment is in `logs/env_freeze.txt`. | |