blog / src /index.html
osanseviero's picture
Update src/index.html
863f8f5 verified
raw
history blame
36 kB
<!DOCTYPE html>
<html>
<head>
<script src="distill.bundle.js" type="module" fetchpriority="high" blocking></script>
<script src="main.bundle.js" type="module" fetchpriority="low" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf8">
<base target="_blank">
<title>Performances are plateauing, let's make the leaderboard steep again </title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<d-front-matter>
<script id='distill-front-matter' type="text/json">{
"title": "Performances are plateauing, let's make the leaderboard steep again ",
"description": "In this blog, we introduce the version 2 of the Open LLM Leaderboard, from the reasons for the change to the new evaluations and rankings.",
"published": "Jun 26, 2024",
"affiliation": {"name": "HuggingFace"},
"authors": [
{
"author":"Clementine Fourrier",
"authorURL":"https://huggingface.co/clefourrier"
},
{
"author":"Nathan Habib",
"authorURL":"https://huggingface.co/saylortwift"
},
{
"author":"Alina Lozovskaya",
"authorURL":"https://huggingface.co/alozowski"
},
{
"author":"Konrad Szafer",
"authorURL":"https://huggingface.co/KonradSzafer"
},
{
"author":"Thomas Wolf",
"authorURL":"https://huggingface.co/thomwolf"
}
],
"katex": {
"delimiters": [
{"left": "$$", "right": "$$", "display": false}
]
}
}
</script>
</d-front-matter>
<d-title>
<h1 class="l-page" style="text-align: center;">Performances are plateauing, let's make the leaderboard steep again </h1>
</d-title>
<d-byline></d-byline>
<d-article>
<d-contents>
</d-contents>
<p>Evaluating and comparing LLMs is hard. Our RLHF team realized this a year ago when they wanted to reproduce and compare results from several published models.
It was a nearly impossible task: scores in papers or marketing releases were given without any reproducible code, sometimes doubtful, but in most cases,
just using optimized prompts or evaluation setup to give the best chances to the models. They therefore decided to create a place where reference models would be
evaluated in the exact same setup (same questions, asked in the same order, etc.) to gather completely reproducible and comparable results; and that’s how the
Open LLM Leaderboard was born!</p>
<p> Following a series of highly visible model releases, it became a widely used resource in the ML community and beyond, visited by more than 2 million unique people over the last 10 months.</p>
<p> Around 300,000 community members use and collaborate on it monthly through submissions and discussions, usually to: </p>
<ul>
<li> Find state-of-the-art open-source releases as the leaderboard provides reproducible scores separating marketing fluff from actual progress in the field.</li>
<li> Evaluate their work, be it pretraining or finetuning, comparing methods in the open and to the best existing models, and earning public recognition.</li>
</ul>
<p> However, with success, both in the leaderboard and the increasing performances of the models came challenges. After one intense year and a lot of community feedback, we thought it was time for an upgrade! Therefore, we’re introducing the Open LLM Leaderboard v2!</p>
<p>Here is why we think a new leaderboard is needed 👇</p>
<h2>Harder, better, faster, stronger: Introducing the LLM Leaderboard v2</h2>
<h3>The need for a more challenging leaderboard</h3>
<p>
Over the past year, the benchmarks we were using got overused/saturated:
</p>
<div class="main-plot-container">
<div id="saturation">
<iframe src="assets/scripts/plot.html" title="description", height="500" width="90%", style="border:none;"></iframe></p>
</div>
</div>
<ol>
<li>They became too easy for models. For instance, models are now reaching baseline human performance on HellaSwag, MMLU, and ARC, a phenomenon called saturation.</li>
<li>Some newer models also showed signs of contamination. By this, we mean that models were possibly trained on benchmark data or on data very similar to benchmark data. As such, some scores stopped reflecting the general performance of the model and started to overfit on some evaluation datasets instead of reflecting the more general performance of the task being tested. This was, in particular, the case for GSM8K and TruthfulQA, which were included in some instruction fine-tuning sets.</li>
<li>Some benchmarks contained errors. MMLU was recently investigated in depth by several groups, which surfaced mistakes in its responses and proposed new versions. Another example was that GSM8K used a specific end-of-generation token (:), which unfairly pushed down the performance of many verbose models.</li>
</ol>
<p>We thus chose to completely change the evaluations we are running for the Open LLM Leaderboard v2!</p>
<h3>Rebooting our evaluation selection</h3>
<p>We started looking for new benchmarks with uncontaminated, high-quality datasets, using reliable metrics and measuring model capabilities of interest.</p> <p>We decided to cover the following general tasks: knowledge testing (📚), reasoning on short and long contexts (💭), complex mathematical abilities, and tasks well correlated with human preference (🤝), like instruction following.</p>
<p>We cover these tasks with six benchmarks. Let us present them briefly:</p>
<p>📚 <strong>MMLU-Pro</strong> (Massive Multitask Language Understanding - Pro version, <a href="https://arxiv.org/abs/2406.01574">paper</a>). MMLU-Pro is a refined version of the MMLU dataset. MMLU has been the reference multichoice knowledge dataset. However, recent research showed that it is both noisy (some questions are unanswerable) and now too easy (through the evolution of model capabilities and increased contamination). MMLU-Pro presents the models with ten choices instead of 4, requires reasoning on more questions, and has been expertly reviewed to reduce the amount of noise. It is of higher quality than the original and harder.</p>
<p>📚 <strong>GPQA</strong> (Google-Proof Q&amp;A Benchmark, <a href="https://arxiv.org/abs/2311.12022">paper</a>). GPQA is an extremely hard knowledge dataset, where questions were designed by domain experts in their field (PhD-level in biology, physics, chemistry, etc.) to be hard to answer by laypersons but (relatively) easy for experts. Questions have gone through several rounds of validation to ensure both difficulty and factuality. The dataset is also only accessible through gating mechanisms, which should reduce contamination risks. (This is also why we don’t provide a plain text example from this dataset, as requested by the authors in the paper).</p>
<p><strong>MuSR</strong> (Multistep Soft Reasoning, <a href="https://arxiv.org/abs/2310.16049">paper</a>). MuSR is a very fun new dataset made of algorithmically generated complex problems of around 1K words in length. The problems are either murder mysteries, object placement questions, or team allocation optimizations. To solve these, the models must combine reasoning and very long-range context parsing. Few models score better than random performance.</p>
<p>🧮 <strong>MATH</strong> (Mathematics Aptitude Test of Heuristics, Level 5 subset, <a href="https://arxiv.org/abs/2103.03874">paper</a>). MATH is a compilation of high-school-level competition problems gathered from several sources, formatted consistently using Latex for equations and Asymptote for figures. Generations must fit a very specific output format. We keep only the hardest questions.</p>
<p>🤝 <strong>IFEval</strong> (Instruction Following Evaluation, <a href="https://arxiv.org/abs/2311.07911">paper</a>). IFEval is a fairly interesting dataset that tests the capability of models to clearly follow explicit instructions, such as “include keyword x” or “use format y”. The models are tested on their ability to strictly follow formatting instructions rather than the actual contents generated, allowing strict and rigorous metrics to be used.</p>
<p>🧮 🤝 <strong>BBH</strong> (Big Bench Hard, <a href="https://arxiv.org/abs/2210.09261">paper</a>). BBH is a subset of 23 challenging tasks from the BigBench dataset, which 1) use objective metrics, 2) are hard, measured as language models not originally outperforming human baselines, and 3) contain enough samples to be statistically significant. They contain multistep arithmetic and algorithmic reasoning (understanding boolean expressions, SVG for geometric shapes, etc), language understanding (sarcasm detection, name disambiguation, etc), and some world knowledge. Performance on BBH has been, on average, well correlated with human preference. We expect this dataset to provide exciting insights into specific capabilities which could interest people.</p>
<gradio-app src="https://open-llm-leaderboard-sample_viewer.hf.space"></gradio-app>
<h3>Why did we choose these subsets?</h3>
<p>In summary, our criteria were: </p>
<ol>
<li>Evaluation quality:</li>
<ul>
<li>Human review of dataset: MMLU-Pro and GPQA</li>
<li>Widespread use in the academic and/or open source community: BBH, IFeval, MATH</li>
</ul>
<li>Reliability and fairness of metrics:</li>
<ul>
<li>Multichoice evaluations are, in general, fair across models.</li>
<li>Generative evaluations should either constrain the format very much (like MATH) or use very unambiguous metrics (like IFEval) or post-processing (like BBH) to extract the correct answers.</li>
</ul>
<li>General absence of contamination in models as of today:</li>
<ul>
<li>Gating: GPQA </li>
<li>“Youth”: MuSR, MMLU-Pro</li>
</ul>
<li>Measuring model skills that are interesting for the community: </li>
<ul>
<li>Correlation with human preferences: BBH, IFEval</li>
<li>Evaluation of a specific capability we are interested in: MATH, MuSR</li>
</ul>
</ol>
<aside>
<p><em>Should we have included more evaluations?</em></p>
<p>We chose to focus on a limited number of evaluations to keep the computation time realistic. We wanted to include many other evaluations (MTBench, AGIEval, DROP, etc.), but we are, in the end, still compute-constrained. So, to keep the evaluation budgets under control, we ranked evals according to our above criterion and kept the top-ranking benchmarks. This is also why we didn’t select any benchmark requiring using another model as a judge.</p>
</aside>
<p>Selecting new benchmarks is not the whole story. We also made several other interesting improvements to the leaderboard, which we’ll now briefly cover.</p>
<h3>Reporting a fairer average for ranking: using normalized scores</h3>
<p>We decided to change the final grade for the model. Instead of summing each benchmark output score, we normalized these scores between the random baseline (0 points) and the maximal possible score (100 points). We then average all normalized scores to get the final average score and compute final rankings. For example, in a benchmark containing two choices for each question, a random baseline will get 50 points (out of 100 points). If you use a random number generator, you will thus likely get around 50 on this evaluation. This means that scores are always between 50 (the lowest score you reasonably get if the benchmark is not adversarial) and 100. We, therefore, change the range so that a 50 on the raw score is a 0 on the normalized score. This does not change anything for generative evaluations like IFEval or MATH.</p>
<div class="main-plot-container">
<!--todo: if you use an interactive visualisation instead of a plot,
replace the class `l-body` by `main-plot-container` and import your interactive plot in the
below div id, while leaving the image as such. -->
<div id="normalisation">
<iframe src="assets/scripts/normalized_vs_raw.html" title="description", height="500" width="90%", style="border:none;"></iframe>
</div>
</div>
<p>This change is more significant than it may seem, as it can be seen as changing the weight assigned to each benchmark in the final average score.</p>
<p>In the figure above, we plot the mean scores for our evaluations, with normalized scores on the left and raw scores on the right. If you look at the right side, you would conclude that the hardest benchmarks are MATH Level 5 and MMLU-Pro (lowest raw averages). However, our two hardest evaluations are actually MATH Level 5 and GPQA, which is considerably harder (PhD level questions!) - most models of today get close to random performance on it, and there is thus a huge difference between unnormalized score and normalized score where the random number baseline is assigned zero points!</p>
<p>This change thus also affects model ranking in general. Say we have two very hard evaluations, one generative and one multichoice, with two option samples. Model A gets 0 on the generative evaluation and 52 on the multichoice, and model B gets 10 on the generative and 40 on the multichoice. Looking at the raw averages, you could conclude that model A is better, with an average score of 26, while model B’s average is 25. However, for the multichoice benchmark, they are, in fact, both similarly bad (!): 52 is almost a random score on the multichoice evaluation, and 40 is an unlucky random score. This becomes obvious when taking the normalized scores, where A gets 0, and B gets around 1. However, on the generative evaluation, model B is 10 points better! If we take the normalized averages, we would get 5 for model B and almost 0 for model A, hence a very different ranking.</p>
<h3>Easier reproducibility: updating the evaluation suite</h3>
<p>A year ago, we chose to use the Harness (lm-eval) from EleutherAI to power our evaluations. It provides a standard and stable implementation for several tasks. To ensure fairness and reproducibility, we pinned the version we were using. This allowed us to compare all models in an apples-to-apples setup, as all evaluations were run in exactly the same way, on the same hardware, using the same evaluation suite commit and parameters.</p>
<p>However, <code>lm-eval</code> evolved, and the implementation of some tasks or metrics changed, which led to discrepancies between 1) the evaluation results people would get on more recent versions of the harness and 2) our results using our pinned version.</p>
<p>For the new version of the Open LLM Leaderboard, we have therefore worked together with the amazing EleutherAI team (notably Hailey Schoelkopf, so many, huge kudos!) to update the harness.</p>
<p>On the features side, we added the harness support for delta weights (LoRA finetuning/adaptation of models), a logging system compatible with the leaderboard, and the highly requested use of chat templates for evaluation.</p>
<p>On the task side, we took a couple of weeks to manually check all implementations and generations thoroughly and fix the problems we observed with inconsistent few shot samples, too restrictive end-of-sentence tokens, etc. We created specific configuration files for the leaderboard task implementations, and are now working on adding a test suite to make sure that evaluation results stay unchanging through time for the leaderboard tasks.</p>
<gradio-app src="https://open-llm-leaderboard-GenerationVisualizer.hf.space"></gradio-app>
<p>You can explore the visualizer we used here!</p>
<p>This should allow us to keep our version up to date with new features added in the future!</p>
<p>Enough was said on the leaderboard backend and metrics. Now, let’s turn to the models and model selection/submission.</p>
<h2>Focusing on the models most relevant to the community</h2>
<h3>Introducing the <em>maintainer’s highlight</em></h3>
<p>Throughout the year, we’ve evaluated more than 7500 models and observed that many of them were not used as much by the community.</p>
<p>The most used ones are usually new base pretrained models, often built using a lot of compute and which the community can later fine-tune for their use cases (such as Meta’s Llama3 or Alibaba’s Qwen2). Some high-quality chat or instruction models find a large user community, such as Cohere’s Command + R, and become strong starting points for community experiments. ♥️</p>
<p>However, the story can be different for other models, even when ranking on top of the leaderboard. Several models are experimental, fascinating, and impressive concatenations that consist of more than 20 steps of fine-tuning or merging.</p>
<p>However, these models present some challenges:</p>
<ul>
<li>When stacking so many steps, it can be easy to lose the precise model recipe and history, as some parent models can get deleted, fine-tuning information of a prior step can disappear, etc. </li>
<li>Models can then become accidentally contaminated 😓
</br>This happened several times last year, with models derived from parent models fine-tuned on instruction datasets containing information from TruthfulQA or GSM8K.
</li>
<li>Models can also performance on benchmarks which become unrelated to their real-life performance 🙃
</br> This can happen if you select models to merge based on their high performance on the same benchmarks - it seems to improve performance selectively on said benchmarks, without actually correlating with quality in real life situations. (More research is likely needed on this).
</li>
</ul>
<p>To highlight high-quality models in the leaderboard and prioritize the most useful models for evaluation, we’ve therefore decided to introduce a category called “maintainer’s choice” ⭐.</p>
<p>In this list, you’ll find LLMs from model creators with access to a lot of computing power, such as Meta,Google, Cohere, or Mistral, as well as well-known collectives, like EleutherAI or NousResearch, and power users of the Hugging Face Hub, among others.</p>
<p>We plan to make this list evolutive based on community suggestions and our observations. We will aim to include SOTA LLMs as they come out and keep evaluating these models as a priority.</p>
<p>We hope it will also make it easier for non-ML users to orient themselves among the many, many models we’ll rank on the leaderboard.</p>
<h3>Voting on model relevance</h3>
<p>For the previous version of the Open LLM Leaderboard, evaluations were usually run in a queue (“first submitted, first evaluated”) manner. With users sometimes submitting many LLM variants at once and the Open LLM Leaderboard running on the limited compute of the spare cycles on the Hugging Face science cluster, we’ve decided to introduce a voting system for submitted models. The community will be able to vote for models, and we will prioritize running models with the most votes first, surfacing the most awaited models at the top of the priority queue. If a model gets an extremely high number of votes when the cluster is full, we could even consider running it manually instead of other internal jobs at Hugging Face.</p>
<p>To avoid spamming the voting system, users must be connected to their Hugging Face account to vote, and we will save the votes. This system will help us prioritize models that the community is enthusiastic about.</p>
<p>Finally, we’ve been hard at work on improving and simplifying the leaderboard interface itself.</p>
<h3>Better and simpler interface</h3>
<p>If you’re one of our regular users, you may have noticed that our front end has become much faster in the last month.</p>
<p>This is thanks to the work of the Gradio team, notably [Freddy Boulton](https://huggingface.co/freddyaboulton), who developed a Leaderboard gradio component! It notably loads data on the client side, which makes any column selection or search virtually instantaneous! It’s also a [component](https://huggingface.co/spaces/freddyaboulton/gradio_leaderboard) that you can reuse yourself in your own leaderboard!</p>
<p>We’ve also decided to move the FAQ and About tabs to their own dedicated documentation page!</p>
<h2>New leaderboard, new results!</h2>
<p>We’ve started with adding and evaluating the models in the “maintainer’s highlights” section (cf. above) and are looking forward to the community submitting their new models to this new version of the leaderboard!!</p>
<aside>As the cluster has been extremely full, you can expect models to keep on appearing in the next days! </aside>
<h3>What do the rankings look like?</h3>
<p>Taking a look at the top 10 models on the previous version of the Open LLM Leaderboard, and comparing with this updated version, some models appear to have a relatively stable ranking (in bold below): Qwen-2-72B instruct, Meta’s Llama3-70B instruct, 01-ai’s Yi-1.5-34B chat, Cohere’s Command R + model, and lastly Smaug-72B, from AbacusAI.</p>
<p>We’ve been particularly impressed by Qwen2-72B-Instruct, one step above other models (notably thanks to its performance in math, long range reasoning, and knowledge)</p>
<p>The current second best model, Llama-3-70B-Instruct, interestingly loses 15 points to its pretrained version counterpart on GPQA, which begs the question whether the particularly extensive instruction fine-tuning done by the Meta team on this model affected some expert/graduate level knowledge.</p>
<p>Also very interesting is the fact that a new challenger climbed the ranks to reach 3rd place despite its smaller size. With only 13B parameters, Microsoft’s Phi-3-medium-4K-instruct model shows a performance equivalent to models 2 to 4 times its size. It would be very interesting to have more information on the training procedure for Phi or an independant reproduction from an external team with open training recipes/datasets.</p>
<table>
<tr>
<th>Rank</th>
<th>New Leaderboard Ranking</th>
</tr>
<tr>
<td></td>
<td><b>Qwen/Qwen2-72B-Instruct</b></td>
</tr>
<tr>
<td>2</td>
<td><b>meta-llama/Meta-Llama-3-70B-Instruct</b></td>
</tr>
<tr>
<td>3</td>
<td><em>microsoft/Phi-3-medium-4k-instruct</em></td>
</tr>
<tr>
<td>4</td>
<td><b>01-ai/Yi-1.5-34B-Chat</b></td>
</tr>
<tr>
<td>5</td>
<td><b>CohereForAI/c4ai-command-r-plus</b></td>
<tr>
<td>6</td>
<td><b>abacusai/Smaug-72B-v0.1</b></td>
</tr>
<tr>
<td>7</td>
<td>Qwen/Qwen1.5-110B</td>
</tr>
<tr>
<td>8</td>
<td>Qwen/Qwen1.5-110B-Chat</td>
</tr>
<tr>
<td>9</td>
<td>microsoft/Phi-3-small-128k-instruct</td>
</tr>
<tr>
<td>10</td>
<td> 01-ai/Yi-1.5-9B-Chat</td>
</tr>
</table>
<p>Here is a detail of the changes in rankings:</p>
<div class="main-plot-container">
<figure><img src="assets/images/ranking_top10_bottom10.png"/></figure>
<div id="ranking">
<iframe src="assets/scripts/rankings_change.html" title="description", height="500" width="100%", style="border:none;"></iframe>
</div>
</div>
<p>Let’s finish with some food for thoughts and advices from the maintainer’s team.</p>
<h3>Which evaluations should you pay most attention to?</h3>
<p>Depending on your practical use case, you should probably focus on various aspects of the leaderboard. The overall ranking will tell you which model is better on average, but you might be more interested in specific capabilities.</p>
<p>In particular, we observed that our different evaluations results are not always correlated with one another as illustrated on this correlation matrice:</p>
<div class="main-plot-container">
<figure><img src="assets/images/v2_correlation_heatmap.png"/></figure>
<div id="heatmap">
<iframe src="assets/scripts/correlation_heatmap.html" title="description", height="550" width="100%", style="border:none;"></iframe>
</div>
</div>
<p>As you can see, MMLU-Pro and BBH are rather well correlated. As it’s been also noted by other teams, these benchmarks are also quite correlated with human preference (for instance they tend to align with human judgment on LMSys’s chatbot arena).</p>
<p>Another of our benchmarks, IFEval, is targeting chat capabilities. It investigates whether models can follow precise instructions or not. However, the format used in this benchmark tends to favor chat and instruction tuned models, with pretrained models having a harder time reaching high performances.</p>
<div class="main-plot-container">
<figure><img src="assets/images/ifeval_score_per_model_type.png"/></figure>
<div id="ifeval">
<iframe src="assets/scripts/avg_ifeval_vs_all.html" title="description", height="500" width="100%", style="border:none;"></iframe>
</div>
</div>
<p>If you are especially interested in model knowledge rather than alignment or chat capabilities, the most relevant evaluations for you will likely be MMLU-Pro and GPQA.</p>
<p>Let’s see how performances on these updated benchmarks compare to our evaluation on the previous version of the leaderboard.</p>
<div class="main-plot-container">
<figure><img src="assets/images/v2_fn_of_mmlu.png"/></figure>
<div id="mmlu">
<iframe src="assets/scripts/new_scores_vs_old.html" title="description", height="500" width="100%", style="border:none;"></iframe>
</div>
</div>
<p>As we can see, both MMLU-PRO scores (in orange) and GPQA scores (in yellow) are reasonably correlated with MMLU scores from the Open LLM Leaderboard v1. However, we note that the scores are overall much lower since GPQA is much harder. There is thus quite some room for model to improve – which is great news :)</p>
<p>MATH-Lvl5 is, obviously, interesting for people focusing on math capabilities. The results on this benchmark are generally correlated with performance on GSM8K, except for some outliers as we can see on the following figure.</p>
<div class="main-plot-container">
<figure><img src="assets/images/math_fn_gsm8k.png"/></figure>
<div id="math">
<iframe src="assets/scripts/math_vs_gsm8k.html" title="description", height="400" width="100%", style="border:none;"></iframe>
</div>
</div>
<p>The green dots highlight models which previously scored 0 on GSM8K due to evaluation limitations mentioned above, but now have very decent scores on the new benchmark MATH-Level5. These models (mostly from 01-ai) were quite strongly penalized by the previous format. The red dots show models which scored high on GSM8K but are now almost at 0 on MATH-Lvl5.</p>
<p>From our current dive in the outputs and behaviors of models, chat versions of base models sometimes have a considerably lower score than the original models on MATH! This observation seems to imply that some chat finetuning procedures can impair math capabilities (from our observations, by making models exceedingly verbose).</p>
<p>MuSR, our last evaluation, is particularly interesting for long context models. We’ve observed that the best performers are models with 10K and plus of context size, and it seems discriminative enough to target long context reasoning specifically.</p>
<p>Let’s conclude with a look at the future of Open LLM leaderboard!</p>
<h2>What’s next?</h2>
<p>Much like the first version of the Open LLM Leaderboard pushed a community approach to model development during the past year, we hope that the new version 2 will be a milestone of open and reproducible model evaluations.</p>
<p>Because backward compatibility and open knowledge is important, you’ll still be able to find all the previous results archived in the <a href="https://huggingface.co/open-llm-leaderboard-old">Open LLM Leaderboard Archive</a>!</p>
<p>Taking a step back to look at the evolution of all the 7400 evaluated models on the Open LLM Leaderboard through time, we can note some much wider trends in the field! For instance we see a strong trend going from larger (red dots) models to smaller (yellow dots) models, while at the same time improving performance.</p>
<div class="main-plot-container">
<figure><img src="assets/images/timewise_analysis_full.png"/></figure>
<div id="timewise">
<iframe src="assets/scripts/model_size_vs_perf.html" title="description", height="450" width="100%", style="border:none;"></iframe>
</div>
</div>
<p>This is great news for the field as smaller models are much easier to embedded as well as much more energy/memory/compute efficient and we hope to observe a similar pattern of progress in the new version of the leaderboard. Given our harder benchmarks, our starting point is for now much lower (black dots) so let’s see where the field take us in a few months from now :)</p>
<p>If you’ve read to this point, thanks a lot, we hope you’ll enjoy this new version of the Open LLM Leaderboard. May the open-source winds push our LLMs boats to sail far away on the sea of deep learning.</p>
</d-article>
<d-appendix>
<d-bibliography src="bibliography.bib"></d-bibliography>
</d-appendix>
<script>
const article = document.querySelector('d-article');
const toc = document.querySelector('d-contents');
if (toc) {
const headings = article.querySelectorAll('h2, h3, h4');
let ToC = `<nav role="navigation" class="l-text figcaption"><h3>Table of contents</h3>`;
let prevLevel = 0;
for (const el of headings) {
// should element be included in TOC?
const isInTitle = el.parentElement.tagName == 'D-TITLE';
const isException = el.getAttribute('no-toc');
if (isInTitle || isException) continue;
el.setAttribute('id', el.textContent.toLowerCase().replaceAll(" ", "_"))
const link = '<a target="_self" href="' + '#' + el.getAttribute('id') + '">' + el.textContent + '</a>';
const level = el.tagName === 'H2' ? 0 : (el.tagName === 'H3' ? 1 : 2);
while (prevLevel < level) {
ToC += '<ul>'
prevLevel++;
}
while (prevLevel > level) {
ToC += '</ul>'
prevLevel--;
}
if (level === 0)
ToC += '<div>' + link + '</div>';
else
ToC += '<li>' + link + '</li>';
}
while (prevLevel > 0) {
ToC += '</ul>'
prevLevel--;
}
ToC += '</nav>';
toc.innerHTML = ToC;
toc.setAttribute('prerendered', 'true');
const toc_links = document.querySelectorAll('d-contents > nav a');
window.addEventListener('scroll', (_event) => {
if (typeof (headings) != 'undefined' && headings != null && typeof (toc_links) != 'undefined' && toc_links != null) {
// Then iterate forwards, on the first match highlight it and break
find_active: {
for (let i = headings.length - 1; i >= 0; i--) {
if (headings[i].getBoundingClientRect().top - 50 <= 0) {
if (!toc_links[i].classList.contains("active")) {
toc_links.forEach((link, _index) => {
link.classList.remove("active");
});
toc_links[i].classList.add('active');
}
break find_active;
}
}
toc_links.forEach((link, _index) => {
link.classList.remove("active");
});
}
}
});
}
function includeHTML() {
var z, i, elmnt, file, xhttp;
/* Loop through a collection of all HTML elements: */
z = document.getElementsByTagName("*");
for (i = 0; i < z.length; i++) {
elmnt = z[i];
/*search for elements with a certain atrribute:*/
file = elmnt.getAttribute("w3-include-html");
/* print the file on the console */
console.log("HELP");
console.log(file);
if (file) {
/* Make an HTTP request using the attribute value as the file name: */
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {elmnt.innerHTML = this.responseText;}
if (this.status == 404) {elmnt.innerHTML = "Page not found.";}
/* Remove the attribute, and call this function once more: */
elmnt.removeAttribute("w3-include-html");
includeHTML();
}
}
xhttp.open("GET", file, true);
xhttp.send();
/* Exit the function: */
return;
}
}
}
</script>
<script>
includeHTML();
</script>
<script
type="module"
src="https://gradio.s3-us-west-2.amazonaws.com/4.36.0/gradio.js"
></script>
</body>
</html>