lorapop / code /tools /make_bib.py
bryan7264's picture
Add files using upload-large-folder tool
a4054b7 verified
Raw History Blame Contribute Delete
5.94 kB
# MIT License, Bryan Cheng, 2026.
"""Build paper/refs.bib from the verified reference records only (novelty/refs_verified.md for [1]-[30] and the methods
references; novelty/refs_31_65_meta.json for [31]-[66]). No field is typed by hand except the three web-only items and
the named method references, whose text is copied from refs_verified.md / novelty/landscape.md.
python tools/make_bib.py -> paper/refs.bib
"""
import json
import re
ESC = {"&": r"\&", "%": r"\%", "#": r"\#", "_": r"\_"}
def esc(s):
return "".join(ESC.get(c, c) for c in s.strip())
def year_of(*xs):
for x in xs:
m = re.search(r"(19|20)\d\d", str(x) if x is not None else "")
if m:
return m.group(0)
return ""
def pubmed_name(x):
"""PubMed "Howe LJ" -> "Howe, L. J." so that BibTeX reads the surname correctly; other forms are kept."""
m = re.fullmatch(r"(.+?) ([A-Z]{1,4})", x.strip())
return f"{m.group(1)}, {' '.join(c + '.' for c in m.group(2))}" if m else x.strip()
def entry(key, title, authors, note, url, year):
a = " and ".join(esc(pubmed_name(x)) for x in authors if x.strip())
f = [f" title = {{{{{esc(title)}}}}}", f" author = {{{a}}}"]
if year:
f.append(f" year = {{{year}}}")
if note:
f.append(f" note = {{{esc(note)}}}")
if url:
f.append(f" howpublished = {{\\url{{{url}}}}}")
return "@misc{" + key + ",\n" + ",\n".join(f) + "\n}\n"
def main():
md = open("novelty/refs_verified.md").read()
out = []
for m in re.finditer(r"^## \[(\d+)\] VERIFIED\n(.*?)(?=^## |\Z)", md, re.S | re.M):
n, body = int(m.group(1)), m.group(2)
g = {k: (re.search(rf"^- {k}(?: \([^)]*\))?: (.*)$", body, re.M) or [None, ""])[1] for k in ("Title", "Authors", "Venue/year", "URL opened")}
url = (re.search(r"https?://\S+", g["URL opened"]) or [None])[0]
if url:
url = url.rstrip(";,)")
ax = re.search(r"id_list=([0-9.]+)", url)
if ax:
url = f"https://arxiv.org/abs/{ax.group(1)}"
venue = g["Venue/year"].split(";")[0].split("(")[0].strip().rstrip(",")
out.append(entry(f"r{n}", g["Title"], g["Authors"].split(";"), venue, url, year_of(g["Venue/year"])))
meta = json.load(open("novelty/refs_31_65_meta.json"))
for k in sorted(meta, key=int):
v = meta[k]
note = f"arXiv:{v['id']}" if v.get("source") == "arXiv" else (v.get("venue") or v.get("container") or "")
url = v.get("url") or (f"https://doi.org/{v['doi']}" if v.get("doi") else None)
out.append(entry(f"r{k}", v["title"], v.get("authors", []), note, url, year_of(v.get("published"), v.get("year"), str(v.get("issued", "")))))
web = {
"r35": ("Shared Initialisation Confounds the LoRA Evidence for Universal Weight Subspaces", ["Persaud"],
"Holdout Labs, GitHub repository", "https://github.com/holdoutlabs-ai/Adaptation-Geometry", "2026"),
"r36": ("A Million Checkpoints Are Not a Million Samples: Effective Sample Size for Learning from Neural Artifacts",
["Di Vita"], "NeurIPS 2026", "https://neurips.cc/virtual/2026/162988", "2026"),
"r39": ("Towards LoRA science", ["nesiacel", "actualvoid"], "LessWrong, 2026-11-02",
"https://www.lesswrong.com/posts/cfyLnszP8suYmwatn/towards-lora-science", "2026"),
"qwen25": ("Qwen2.5 Technical Report", ["{Qwen Team}"], "arXiv:2412.15115", "https://arxiv.org/abs/2412.15115", "2024"),
"sciq": ("Crowdsourcing Multiple Choice Science Questions", ["Johannes Welbl", "Nelson F. Liu", "Matt Gardner"],
"arXiv:1707.06209", "https://arxiv.org/abs/1707.06209", "2017"),
"wikitext": ("Pointer Sentinel Mixture Models", ["Stephen Merity", "Caiming Xiong", "James Bradbury", "Richard Socher"],
"arXiv:1609.07843", "https://arxiv.org/abs/1609.07843", "2016"),
"alpacaeval": ("AlpacaEval: An Automatic Evaluator of Instruction-following Models",
["Xuechen Li", "Tianyi Zhang", "Yann Dubois", "Rohan Taori", "Ishaan Gulrajani", "Carlos Guestrin",
"Percy Liang", "Tatsunori B. Hashimoto"], "GitHub repository", "https://github.com/tatsu-lab/alpaca_eval", "2023"),
"norobots": ("No Robots", ["Nazneen Rajani", "Lewis Tunstall", "Edward Beeching", "Nathan Lambert", "Alexander M. Rush",
"Thomas Wolf"], "Hugging Face dataset HuggingFaceH4/no\\_robots",
"https://huggingface.co/datasets/HuggingFaceH4/no_robots", "2023"),
"bh": ("Controlling the False Discovery Rate: A Practical and Powerful Approach to Multiple Testing",
["Yoav Benjamini", "Yosef Hochberg"], "Journal of the Royal Statistical Society Series B 57:289-300",
"https://doi.org/10.1111/j.2517-6161.1995.tb02031.x", "1995"),
"liji": ("Adjusting multiple testing in multilocus analyses using the eigenvalues of a correlation matrix",
["J. Li", "L. Ji"], "Heredity 95:221-227", "https://doi.org/10.1038/sj.hdy.6800717", "2005"),
"dl": ("Meta-analysis in clinical trials", ["Rebecca DerSimonian", "Nan Laird"], "Controlled Clinical Trials 7:177-188",
"https://doi.org/10.1016/0197-2456(86)90046-2", "1986"),
"deming": ("Statistical Adjustment of Data", ["W. Edwards Deming"], "Wiley", None, "1943"),
}
for k, (t, au, note, url, y) in web.items():
out.append(entry(k, t, au, note.replace("\\_", "_"), url, y))
open("paper/refs.bib", "w").write("% MIT License, Bryan Cheng, 2026. Generated by tools/make_bib.py from verified records.\n\n"
+ "\n".join(out))
keys = re.findall(r"@misc\{(\w+),", "".join(out))
print(len(keys), "entries;", "missing numbered:", [n for n in range(1, 67) if f"r{n}" not in keys])
if __name__ == "__main__":
main()