dlouapre HF Staff commited on
Commit
e0722b8
·
1 Parent(s): ce4b302

Improving charts

Browse files
app/src/content/article.mdx CHANGED
@@ -516,6 +516,12 @@ This investigation opens several avenues for future work, that could only help f
516
 
517
  ---
518
 
 
 
 
 
 
 
519
  ## Appendix
520
 
521
  ### nnsight code
 
516
 
517
  ---
518
 
519
+ **Code** is available [here](https://github.com/scienceetonnante/eiffel-tower-llama)
520
+
521
+ **Thanks** to the NDIF team and especially Jaden Fiotto-Kaufman for help using `nnsight`, to Thom Wolf and Leandro von Werra for useful discussions, and to Thibaud Frere for help using his fabulous [Bringing Paper To Life](https://huggingface.co/spaces/tfrere/research-article-template) blog post template.
522
+
523
+ ---
524
+
525
  ## Appendix
526
 
527
  ### nnsight code
app/src/content/embeds/d3-correlation-matrix.html CHANGED
@@ -121,18 +121,18 @@
121
  'LLM score\ninstruction',
122
  'LLM score\nfluency',
123
  'Explicit\nconcept\ninclusion',
124
- 'Log Prob',
125
  '3-gram\nrepetition'
126
  ];
127
 
128
  // Correlation matrix (exact values from the image)
129
  const correlationMatrix = [
130
- [1.00, -0.28, -0.37, 0.45, -0.57, 0.00],
131
- [-0.28, 1.00, 0.80, 0.068, 0.45, -0.90],
132
- [-0.37, 0.80, 1.00, 0.015, 0.67, -0.90],
133
- [0.45, 0.068, 0.015, 1.00, -0.10, -0.093],
134
- [-0.57, 0.45, 0.67, -0.10, 1.00, -0.53],
135
- [0.00, -0.90, -0.90, -0.093, -0.53, 1.00]
136
  ];
137
 
138
  // Colors: diverging palette via window.ColorPalettes
 
121
  'LLM score\ninstruction',
122
  'LLM score\nfluency',
123
  'Explicit\nconcept\ninclusion',
124
+ 'Surprise',
125
  '3-gram\nrepetition'
126
  ];
127
 
128
  // Correlation matrix (exact values from the image)
129
  const correlationMatrix = [
130
+ [1.00, -0.28, -0.37, 0.45, 0.57, 0.00],
131
+ [-0.28, 1.00, 0.80, 0.068, -0.45, -0.90],
132
+ [-0.37, 0.80, 1.00, 0.015, -0.67, -0.90],
133
+ [0.45, 0.068, 0.015, 1.00, 0.10, -0.093],
134
+ [0.57, -0.45, -0.67, 0.10, 1.00, 0.53],
135
+ [0.00, -0.90, -0.90, -0.093, 0.53, 1.00]
136
  ];
137
 
138
  // Colors: diverging palette via window.ColorPalettes
app/src/content/embeds/d3-harmonic-mean.html CHANGED
@@ -461,7 +461,7 @@
461
  .x(d => newXScale(d.x))
462
  .y0(d => newYScale(d.yLower))
463
  .y1(d => newYScale(d.yUpper))
464
- .curve(d3.curveMonotoneX);
465
 
466
  gPlot.selectAll('path.uncertainty-band')
467
  .attr('d', area(dataPoints));
@@ -471,11 +471,23 @@
471
  const line = d3.line()
472
  .x(d => newXScale(d.x))
473
  .y(d => newYScale(d.y))
474
- .curve(d3.curveMonotoneX);
475
 
476
  gPlot.selectAll('path.main-line')
477
  .attr('d', line(dataPoints));
478
 
 
 
 
 
 
 
 
 
 
 
 
 
479
  // Update axes
480
  gAxes.select('.x-axis').call(d3.axisBottom(newXScale).ticks(5).tickSizeOuter(0).tickFormat(formatX));
481
  gAxes.select('.y-axis').call(d3.axisLeft(newYScale).ticks(5).tickSizeOuter(0).tickFormat(formatY));
@@ -599,7 +611,7 @@
599
  .x(d => xScale(d.x))
600
  .y0(d => yScale(d.yLower))
601
  .y1(d => yScale(d.yUpper))
602
- .curve(d3.curveMonotoneX);
603
 
604
  gPlot.selectAll('path.uncertainty-band').data([dataPoints]).join('path')
605
  .attr('class', 'uncertainty-band')
@@ -610,7 +622,7 @@
610
  const mainLine = d3.line()
611
  .x(d => xScale(d.x))
612
  .y(d => yScale(d.y))
613
- .curve(d3.curveMonotoneX);
614
 
615
  gPlot.selectAll('path.main-line').data([dataPoints]).join('path')
616
  .attr('class', 'main-line')
@@ -620,6 +632,18 @@
620
  .attr('opacity', 0.85)
621
  .attr('d', mainLine);
622
 
 
 
 
 
 
 
 
 
 
 
 
 
623
  // Hover
624
  setupHover(innerWidth, innerHeight);
625
  }
 
461
  .x(d => newXScale(d.x))
462
  .y0(d => newYScale(d.yLower))
463
  .y1(d => newYScale(d.yUpper))
464
+ .curve(d3.curveLinear);
465
 
466
  gPlot.selectAll('path.uncertainty-band')
467
  .attr('d', area(dataPoints));
 
471
  const line = d3.line()
472
  .x(d => newXScale(d.x))
473
  .y(d => newYScale(d.y))
474
+ .curve(d3.curveLinear);
475
 
476
  gPlot.selectAll('path.main-line')
477
  .attr('d', line(dataPoints));
478
 
479
+ // Update markers
480
+ gPlot.selectAll('circle.data-marker')
481
+ .data(dataPoints)
482
+ .join('circle')
483
+ .attr('class', 'data-marker')
484
+ .attr('cx', d => newXScale(d.x))
485
+ .attr('cy', d => newYScale(d.y))
486
+ .attr('r', 3)
487
+ .attr('fill', CONFIG.lineColor)
488
+ .attr('stroke', 'var(--page-bg)')
489
+ .attr('stroke-width', 1.5);
490
+
491
  // Update axes
492
  gAxes.select('.x-axis').call(d3.axisBottom(newXScale).ticks(5).tickSizeOuter(0).tickFormat(formatX));
493
  gAxes.select('.y-axis').call(d3.axisLeft(newYScale).ticks(5).tickSizeOuter(0).tickFormat(formatY));
 
611
  .x(d => xScale(d.x))
612
  .y0(d => yScale(d.yLower))
613
  .y1(d => yScale(d.yUpper))
614
+ .curve(d3.curveLinear);
615
 
616
  gPlot.selectAll('path.uncertainty-band').data([dataPoints]).join('path')
617
  .attr('class', 'uncertainty-band')
 
622
  const mainLine = d3.line()
623
  .x(d => xScale(d.x))
624
  .y(d => yScale(d.y))
625
+ .curve(d3.curveLinear);
626
 
627
  gPlot.selectAll('path.main-line').data([dataPoints]).join('path')
628
  .attr('class', 'main-line')
 
632
  .attr('opacity', 0.85)
633
  .attr('d', mainLine);
634
 
635
+ // Markers
636
+ gPlot.selectAll('circle.data-marker')
637
+ .data(dataPoints)
638
+ .join('circle')
639
+ .attr('class', 'data-marker')
640
+ .attr('cx', d => xScale(d.x))
641
+ .attr('cy', d => yScale(d.y))
642
+ .attr('r', 3)
643
+ .attr('fill', CONFIG.lineColor)
644
+ .attr('stroke', 'var(--page-bg)')
645
+ .attr('stroke-width', 1.5);
646
+
647
  // Hover
648
  setupHover(innerWidth, innerHeight);
649
  }
app/src/content/embeds/d3-sweep-1d-metrics.html CHANGED
@@ -477,7 +477,7 @@
477
  .x(d => newXScale(d.x))
478
  .y0(d => newYScale(d.yLower))
479
  .y1(d => newYScale(d.yUpper))
480
- .curve(d3.curveMonotoneX);
481
 
482
  gPlot.selectAll('path.uncertainty-band')
483
  .attr('d', area(dataPoints));
@@ -487,11 +487,23 @@
487
  const line = d3.line()
488
  .x(d => newXScale(d.x))
489
  .y(d => newYScale(d.y))
490
- .curve(d3.curveMonotoneX);
491
 
492
  gPlot.selectAll('path.main-line')
493
  .attr('d', line(dataPoints));
494
 
 
 
 
 
 
 
 
 
 
 
 
 
495
  // Update axes
496
  gAxes.select('.x-axis').call(d3.axisBottom(newXScale).ticks(5).tickSizeOuter(0).tickFormat(formatX));
497
  gAxes.select('.y-axis').call(d3.axisLeft(newYScale).ticks(5).tickSizeOuter(0).tickFormat(formatY));
@@ -615,7 +627,7 @@
615
  .x(d => xScale(d.x))
616
  .y0(d => yScale(d.yLower))
617
  .y1(d => yScale(d.yUpper))
618
- .curve(d3.curveMonotoneX);
619
 
620
  gPlot.selectAll('path.uncertainty-band').data([dataPoints]).join('path')
621
  .attr('class', 'uncertainty-band')
@@ -626,7 +638,7 @@
626
  const mainLine = d3.line()
627
  .x(d => xScale(d.x))
628
  .y(d => yScale(d.y))
629
- .curve(d3.curveMonotoneX);
630
 
631
  gPlot.selectAll('path.main-line').data([dataPoints]).join('path')
632
  .attr('class', 'main-line')
@@ -636,6 +648,18 @@
636
  .attr('opacity', 0.85)
637
  .attr('d', mainLine);
638
 
 
 
 
 
 
 
 
 
 
 
 
 
639
  // Hover
640
  setupHover(innerWidth, innerHeight);
641
  }
 
477
  .x(d => newXScale(d.x))
478
  .y0(d => newYScale(d.yLower))
479
  .y1(d => newYScale(d.yUpper))
480
+ .curve(d3.curveLinear);
481
 
482
  gPlot.selectAll('path.uncertainty-band')
483
  .attr('d', area(dataPoints));
 
487
  const line = d3.line()
488
  .x(d => newXScale(d.x))
489
  .y(d => newYScale(d.y))
490
+ .curve(d3.curveLinear);
491
 
492
  gPlot.selectAll('path.main-line')
493
  .attr('d', line(dataPoints));
494
 
495
+ // Update markers
496
+ gPlot.selectAll('circle.data-marker')
497
+ .data(dataPoints)
498
+ .join('circle')
499
+ .attr('class', 'data-marker')
500
+ .attr('cx', d => newXScale(d.x))
501
+ .attr('cy', d => newYScale(d.y))
502
+ .attr('r', 3)
503
+ .attr('fill', CONFIG.lineColor)
504
+ .attr('stroke', 'var(--page-bg)')
505
+ .attr('stroke-width', 1.5);
506
+
507
  // Update axes
508
  gAxes.select('.x-axis').call(d3.axisBottom(newXScale).ticks(5).tickSizeOuter(0).tickFormat(formatX));
509
  gAxes.select('.y-axis').call(d3.axisLeft(newYScale).ticks(5).tickSizeOuter(0).tickFormat(formatY));
 
627
  .x(d => xScale(d.x))
628
  .y0(d => yScale(d.yLower))
629
  .y1(d => yScale(d.yUpper))
630
+ .curve(d3.curveLinear);
631
 
632
  gPlot.selectAll('path.uncertainty-band').data([dataPoints]).join('path')
633
  .attr('class', 'uncertainty-band')
 
638
  const mainLine = d3.line()
639
  .x(d => xScale(d.x))
640
  .y(d => yScale(d.y))
641
+ .curve(d3.curveLinear);
642
 
643
  gPlot.selectAll('path.main-line').data([dataPoints]).join('path')
644
  .attr('class', 'main-line')
 
648
  .attr('opacity', 0.85)
649
  .attr('d', mainLine);
650
 
651
+ // Markers
652
+ gPlot.selectAll('circle.data-marker')
653
+ .data(dataPoints)
654
+ .join('circle')
655
+ .attr('class', 'data-marker')
656
+ .attr('cx', d => xScale(d.x))
657
+ .attr('cy', d => yScale(d.y))
658
+ .attr('r', 3)
659
+ .attr('fill', CONFIG.lineColor)
660
+ .attr('stroke', 'var(--page-bg)')
661
+ .attr('stroke-width', 1.5);
662
+
663
  // Hover
664
  setupHover(innerWidth, innerHeight);
665
  }