Hyperlink maximalism (2022)
How to add hyperlinks is something I&#x27;ve thought a bit about for Gwern.net: there&#x27;s no point having all these fancy popups if there are no hyperlinks exploiting them, right?<p>The way I currently do it is that first, I make hyperlinks stable by automatically snapshotting &amp; making local archives of pages (<a href="https:&#x2F;&#x2F;gwern.net&#x2F;archiving#preemptive-local-archiving" rel="nofollow noreferrer">https:&#x2F;&#x2F;gwern.net&#x2F;archiving#preemptive-local-archiving</a>). There is no point in adding links if linkrot discourages anyone from using them, of course, and I found that manual linkrot fixing did not scale to the amount of writing &amp; hyperlinking I want to do.<p>The next step is adding links automatically. Particularly in the STEM topics I write most about these days, AI, there are many acronyms &amp; named systems which mean specific things but it&#x27;s easy to get lost in. Fortunately, that makes them easy to write automatic link rules for: <a href="https:&#x2F;&#x2F;github.com&#x2F;gwern&#x2F;gwern.net&#x2F;blob&#x2F;master&#x2F;build&#x2F;Config&#x2F;LinkAuto.hs">https:&#x2F;&#x2F;github.com&#x2F;gwern&#x2F;gwern.net&#x2F;blob&#x2F;master&#x2F;build&#x2F;Config&#x2F;...</a> These run automatically on essay bodies when compiling the site, and on annotations when created. If a URL is already present, its rule doesn&#x27;t run; and if it&#x27;s not, only the first instance gets linked and the rest are skipped. (This is important: there are some approaches which take the lazy approach of hyperlinking every instance. This is bad and discredits linking.) This code is very slow but fast enough for static site building, anyway.<p>Sometimes terms are too ambiguous or too rare or too much work to write an explicit rewrite rule for. But it will still exist on-site. In fact, you can say that the site corpus <i>defines</i> a set of rewrite rules: everytime I write by hand `[foo](<a href="http:&#x2F;&#x2F;bar" rel="nofollow noreferrer">http:&#x2F;&#x2F;bar</a>)`, am I not <i>implicitly</i> saying that there ought to be a rewrite rule for the string `foo` which ought to hyperlink `<a href="http:&#x2F;&#x2F;bar" rel="nofollow noreferrer">http:&#x2F;&#x2F;bar</a>`? So there is a script (<a href="https:&#x2F;&#x2F;github.com&#x2F;gwern&#x2F;gwern.net&#x2F;blob&#x2F;master&#x2F;build&#x2F;link-suggester.hs">https:&#x2F;&#x2F;github.com&#x2F;gwern&#x2F;gwern.net&#x2F;blob&#x2F;master&#x2F;build&#x2F;link-su...</a>) which will parse the site corpus, compile all the text&#x2F;link pairs, create&#x2F;remove a bunch of them per whitelist&#x2F;blacklists and a frequency&#x2F;length threshold, and then generate a bunch of Emacs Lisp pairs. This master list of rewrites then gets read by an Elisp snippet in my Emacs and turned into several thousand interactive search-and-replace commands when I run my generic formatting command on a buffer.<p>The effect of this second script is that after I have linked `Foo et al 2023` to `&#x2F;doc&#x2F;2023-foo.pdf` a few times (perhaps I went back and hyperlinked all instances of it after realizing it&#x27;s an important paper), any future instances of &#x27;Foo et al 2023&#x27; will pop up a search-and-replace asking to hyperlink it to `&#x2F;doc&#x2F;2023-foo.pdf`, and so on.<p>Third, I exploit my link-recommendations for manually-curated &#x27;see also&#x27; sections appended to annotations. I have a fairly standard link-recommender approach where each annotation is embedded by a neural network (OA API for now), and one does nearest-neighbor lookups to find _n_ &#x27;similar&#x27; annotations, and shows the reader them in case any are relevant. So far so good. But I <i>also</i> do that after editing each annotation: embed-recommend-list, and spits out a HTML list of the top 20 or so similar-links appended to the annotation. I can look at that and delete the irrelevant entries, or the entire list. This means that they&#x27;ll be included in the final embedded version of the annotation, will show up in any fulltext searche I run, are more visible to the reader, can be edited into the main body if I want to, etc.<p>Fourth and most lately, I&#x27;ve been experimenting with GPT-4 for auto-formatting &amp; auto-linking (<a href="https:&#x2F;&#x2F;github.com&#x2F;gwern&#x2F;gwern.net&#x2F;blob&#x2F;master&#x2F;build&#x2F;paragraphizer.py">https:&#x2F;&#x2F;github.com&#x2F;gwern&#x2F;gwern.net&#x2F;blob&#x2F;master&#x2F;build&#x2F;paragra...</a>). GPT-4 has memorized many URLs, and where it hasn&#x27;t, it still makes pretty good guesses. So, as part of the standard formatting passes, I pass annotations through GPT-4, with a bit added to its prompt, &#x27;try to add useful hyperlinks to Wikipedia and other sources&#x27;. It often does, and it&#x27;s quite convenient when that works. GPT-4 still confabulates URLs more often than I link, and sometimes hyperlinks too-obvious WP links and I have to delete them. So, still some adjustments required there.<p>And these work well with the other site features like recursive popups, or bidirectional backlinks (<a href="https:&#x2F;&#x2F;gwern.net&#x2F;design#backlink" rel="nofollow noreferrer">https:&#x2F;&#x2F;gwern.net&#x2F;design#backlink</a>).