magilogi commited on
Commit
6964a16
β€’
1 Parent(s): 3d49442

score explanations

Browse files
Files changed (3) hide show
  1. app.py +54 -13
  2. workflow-1-2.svg +0 -0
  3. workflow-3-4.svg +0 -0
app.py CHANGED
@@ -3,8 +3,31 @@ import gradio as gr
3
  import plotly.express as px
4
  import plotly.graph_objects as go
5
 
6
- df = pd.read_csv("data/csv/models_data.csv")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
 
8
 
9
  filter_mapping = {
10
  "all": "all",
@@ -14,14 +37,12 @@ filter_mapping = {
14
  "πŸ’¬ Chat-models (RLHF, DPO, IFT, ...)": "πŸ’¬"
15
  }
16
 
17
-
18
  def filter_items(df, query):
19
  if query == "all":
20
  return df
21
  filter_value = filter_mapping[query]
22
  return df[df["T"].str.contains(filter_value, na=False)]
23
 
24
-
25
  def create_scatter_plot(df, x_col, y_col, title, x_title, y_title):
26
  fig = px.scatter(df, x=x_col, y=y_col, color='Model', title=title)
27
  fig.add_trace(
@@ -44,20 +65,40 @@ def create_scatter_plot(df, x_col, y_col, title, x_title, y_title):
44
  fig.update_traces(marker=dict(size=10), selector=dict(mode='markers'))
45
  return fig
46
 
47
-
48
  with gr.Blocks(css="custom.css") as demo:
49
  with gr.Column():
50
  gr.Markdown(
51
- """<div style="text-align: center;"><h1>🐰 RABBITS:</h1>
52
- <h2 style='color: #6aa84f;'>R</span>obust <span style='color: #6aa84f;'>A</span>ssessment of <span style='color: #6aa84f;'>B</span>iomedical <span style='color: #6aa84f;'>B</span>enchmarks <span style='color: #6aa84f;'>I</span>nvolving drug <span style='color: #6aa84f;'>T</span>erm <span style='color: #6aa84f;'>S</span>ubstitutions for Language Models</h2></div>"""
53
  )
54
- with gr.Row():
55
- with gr.Column(scale=1):
56
- gr.Markdown(
57
- """<p class='markdown-text'>Robust language models are crucial in the medical domain and the RABBITS project tests the robustness of LLMs by evaluating their handling of synonyms, specifically brand and generic drug names. We assessed 16 open-source language models from Hugging Face using systematic synonym substitution on MedQA and MedMCQA tasks. Our results show a consistent decline in performance across all model sizes, highlighting challenges in synonym comprehension. Additionally, we discovered significant dataset contamination by identifying overlaps between MedQA, MedMCQA test sets, and the Dolma 1.6 dataset using an 8-gram analysis. This highlights the need to improve model robustness and address contamination in open-source datasets.</p>"""
58
- )
59
- with gr.Column(scale=1):
60
- gr.Image(value="workflow.svg", height=300, width=300)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  with gr.Tabs(elem_classes="tab-buttons"):
63
  with gr.TabItem("πŸ” Evaluation table"):
 
3
  import plotly.express as px
4
  import plotly.graph_objects as go
5
 
6
+ explanation_data = {
7
+ "Accuracy Scores (rename for clarity)": [
8
+ "b4bqa",
9
+ "b4b",
10
+ "medmcqa_g2b",
11
+ "medmcqa_orig_filtered",
12
+ "medmcqa_diff",
13
+ "medqa_4options_g2b",
14
+ "medqa_4options_orig_filtered",
15
+ "medqa_diff"
16
+ ],
17
+ "Description": [
18
+ "Model accuracy on the B4BQA task.",
19
+ "Average model accuracy on tasks where generic drug names are substituted with brand names.",
20
+ "Model accuracy on MedMCQA task where generic drug names are substituted with brand names.",
21
+ "Model accuracy on MedMCQA task with original data. (Only includes questions that overlap with the g2b dataset)",
22
+ "Difference in MedMCQA accuracy for swapped and non-swapped datasets, highlighting the impact of G2B drug name substitution on performance.",
23
+ "Model accuracy on MedQA (4 options) task where generic drug names are substituted with brand names.",
24
+ "Model accuracy on MedQA (4 options) task with original data. (Only includes questions that overlap with the g2b dataset)",
25
+ "Difference in MedMCQA accuracy for swapped and non-swapped datasets, highlighting the impact of G2B drug name substitution on performance."
26
+ ]
27
+ }
28
+ explanation_df = pd.DataFrame(explanation_data)
29
 
30
+ df = pd.read_csv("data/csv/models_data.csv")
31
 
32
  filter_mapping = {
33
  "all": "all",
 
37
  "πŸ’¬ Chat-models (RLHF, DPO, IFT, ...)": "πŸ’¬"
38
  }
39
 
 
40
  def filter_items(df, query):
41
  if query == "all":
42
  return df
43
  filter_value = filter_mapping[query]
44
  return df[df["T"].str.contains(filter_value, na=False)]
45
 
 
46
  def create_scatter_plot(df, x_col, y_col, title, x_title, y_title):
47
  fig = px.scatter(df, x=x_col, y=y_col, color='Model', title=title)
48
  fig.add_trace(
 
65
  fig.update_traces(marker=dict(size=10), selector=dict(mode='markers'))
66
  return fig
67
 
 
68
  with gr.Blocks(css="custom.css") as demo:
69
  with gr.Column():
70
  gr.Markdown(
71
+ """<div style="text-align: center;"><h1> <span style='color: #FFC43A;'>🐰 RABBITS:</span> <span style='color: #FFC43A;'>R</span>obust <span style='color: #FFC43A;'>A</span>ssessment of <span style='color: #FFC43A;'>B</span>iomedical <span style='color: #FFC43A;'>B</span>enchmarks <span style='color: #FFC43A;'>I</span>nvolving drug
72
+ <span style='color: #FFC43A;'>T</span>erm <span style='color: #FFC43A;'>S</span>ubstitutions for Language Models <span style='color: #FFC43A;'></span></h1></div>"""
73
  )
74
+ with gr.Row():
75
+ gr.Markdown(""" """)
76
+ with gr.Row():
77
+ gr.Markdown(
78
+ """<div style="text-align: center;">
79
+ <p class='markdown-text'>Robust language models are crucial in the medical domain and the RABBITS project tests the robustness of LLMs by evaluating their handling of synonyms, specifically brand and generic drug names. We assessed 16 open-source language models from Hugging Face using systematic synonym substitution on MedQA and MedMCQA tasks. Our results show a consistent decline in performance across all model sizes, highlighting challenges in synonym comprehension. Additionally, we discovered significant dataset contamination by identifying overlaps between MedQA, MedMCQA test sets, and the Dolma 1.6 dataset using an 8-gram analysis. This highlights the need to improve model robustness and address contamination in open-source datasets.</p>
80
+ </div>"""
81
+ )
82
+ with gr.Row():
83
+ gr.Markdown(""" """)
84
+ with gr.Row():
85
+ gr.Image(value="workflow-1-2.svg", width=200, height=450)
86
+ gr.Image(value="workflow-3-4.svg", width=200, height=450)
87
+
88
+ with gr.Row():
89
+ gr.Markdown(""" """)
90
+
91
+ with gr.Row():
92
+ gr.Dataframe(
93
+ value=explanation_df,
94
+ headers="keys",
95
+ datatype=["str", "str"],
96
+ interactive=False,
97
+ label="Explanation of Scores"
98
+ )
99
+
100
+ with gr.Row():
101
+ gr.Markdown(""" """)
102
 
103
  with gr.Tabs(elem_classes="tab-buttons"):
104
  with gr.TabItem("πŸ” Evaluation table"):
workflow-1-2.svg ADDED
workflow-3-4.svg ADDED