File size: 20,905 Bytes
a0ae180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Interactive dataset curation assistant with tailored recommendations for training, post-training, RAG, evaluation and agent data.">
<title>Dataset Curation</title>
<style>
:root{
  --bg:#07111e;--panel:#0d1a2f;--line:#27415e;
  --text:#f4f8ff;--muted:#9fb3c7;--cyan:#50ddff;--violet:#a58aff;
}
*{box-sizing:border-box}
body{
  margin:0;
  background:
    radial-gradient(circle at 14% -8%,rgba(80,221,255,.14),transparent 30%),
    radial-gradient(circle at 90% 0,rgba(165,138,255,.12),transparent 28%),
    var(--bg);
  color:var(--text);
  font:15px/1.55 Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
.wrap{max-width:1180px;margin:auto;padding:0 22px}
.hero{text-align:center;padding:64px 0 28px}
.kicker{display:inline-block;border:1px solid var(--line);border-radius:999px;padding:7px 12px;background:#0a1830;color:var(--cyan);font-size:11px;font-weight:850;text-transform:uppercase;letter-spacing:.1em}
h1{font-size:clamp(44px,8vw,76px);line-height:1;margin:20px 0 14px;letter-spacing:-.055em}
.grad{background:linear-gradient(90deg,var(--cyan),#dce8ff,var(--violet));background-clip:text;-webkit-background-clip:text;color:transparent}
.hero p{max-width:820px;margin:auto;color:var(--muted);font-size:18px}
.layout{display:grid;grid-template-columns:370px 1fr;gap:16px;padding:18px 0 52px}
.panel{border:1px solid var(--line);border-radius:19px;padding:18px;background:linear-gradient(150deg,#10213b,#09172b);box-shadow:0 18px 44px rgba(0,0,0,.22)}
h2{font-size:20px;margin:0 0 5px}.sub{color:var(--muted);font-size:12px;margin-bottom:14px}
label{display:block;font-size:12px;font-weight:800;margin:11px 0 5px}
select{width:100%;background:#08172b;color:var(--text);border:1px solid var(--line);border-radius:11px;padding:10px 11px}
.group{border:1px solid #223b58;background:#09182d;border-radius:12px;padding:10px;margin:9px 0}
.groupTitle{display:flex;justify-content:space-between;gap:12px;font-size:11px;font-weight:800}
.val{color:var(--cyan)}
input[type=range]{width:100%;accent-color:#6e7dff}
.check{display:flex;gap:8px;align-items:center;border:1px solid #223b58;background:#09182d;border-radius:11px;padding:10px;margin-top:9px;font-size:12px;color:#ccd9e7}
button{width:100%;border:0;border-radius:11px;padding:12px;color:white;font-weight:850;background:linear-gradient(90deg,#3188ff,#775df0);cursor:pointer;margin-top:13px}
.head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.eyebrow{font-size:10px;color:var(--cyan);font-weight:850;text-transform:uppercase;letter-spacing:.08em}
.route{font-size:28px;font-weight:900;letter-spacing:-.035em}
.badge{font-size:10px;border:1px solid #31506f;background:#0e2039;color:#c9dae9;border-radius:999px;padding:5px 8px;white-space:nowrap}
.summary{color:var(--muted);font-size:13px;margin-top:6px}
.health{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:16px 0}
.stat{border:1px solid #223b58;background:#08172c;border-radius:11px;padding:10px}
.stat strong{display:block;font-size:20px}.stat span{font-size:9px;color:var(--muted)}
.flowbox{border:1px solid #203854;border-radius:15px;background:#07152a;padding:16px;margin:16px 0}
.flow{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.node{border:1px solid #35577b;background:#102542;border-radius:9px;padding:8px 9px;font-size:10px;font-weight:850}
.node.high{border-color:#8c79ff;background:#251f4d}
.arrow{color:var(--cyan);font-weight:900}
.planTitle{font-size:18px;font-weight:900;margin:17px 0 5px}
.action{display:grid;grid-template-columns:50px 1fr auto;gap:10px;align-items:start;padding:11px 0;border-top:1px solid var(--line)}
.stepno{width:40px;height:40px;border-radius:11px;border:1px solid #31516f;background:#0a1d35;display:flex;align-items:center;justify-content:center;font-weight:900}
.action b{display:block;font-size:12px}.action p{margin:3px 0 0;color:var(--muted);font-size:11px}
.priority{font-size:9px;border-radius:999px;padding:4px 7px;border:1px solid #38536f;color:#cedbea}
.priority.high{border-color:#7d6de7;color:#ddd5ff}
.priority.critical{border-color:#9f5f65;color:#ffd0d0}
.validation{margin-top:14px;border-top:1px solid var(--line);padding-top:13px}
.validation ul{padding-left:18px;color:var(--muted);font-size:12px;margin-bottom:0}
.note{margin-top:14px;color:var(--muted);font-size:11px}
footer{border-top:1px solid var(--line);padding:28px 0 45px;color:var(--muted);font-size:13px}
footer strong{color:var(--text)}
@media(max-width:900px){.layout{grid-template-columns:1fr}.health{grid-template-columns:repeat(2,1fr)}}
</style>
</head>
<body>
<header class="hero">
  <div class="wrap">
    <span class="kicker">Interactive AI Data Assistant</span>
    <h1>Dataset <span class="grad">Curation</span></h1>
    <p>Describe your dataset and objective. The assistant builds an ordered curation plan with concrete recommendations.</p>
  </div>
</header>

<main class="wrap">
<section class="layout">
  <aside class="panel">
    <h2>Describe your dataset</h2>
    <div class="sub">The recommendations adapt to your objective and data condition.</div>

    <label for="objective">AI objective</label>
    <select id="objective">
      <option value="pretraining">Pretraining</option>
      <option value="posttraining">Post-Training / Fine-Tuning</option>
      <option value="evaluation">Evaluation / Benchmark</option>
      <option value="rag">RAG / Retrieval</option>
      <option value="agents">Agent / Tool-Use Data</option>
    </select>

    <label for="modality">Primary data type</label>
    <select id="modality">
      <option value="text">Text</option>
      <option value="code">Code</option>
      <option value="synthetic">Synthetic Data</option>
      <option value="multimodal">Multimodal</option>
      <option value="trajectories">Agent / Robot Trajectories</option>
    </select>

    <label for="scale">Dataset scale</label>
    <select id="scale">
      <option value="small">Small — &lt;100k examples</option>
      <option value="medium" selected>Medium — 100k to 10M</option>
      <option value="large">Large — 10M+</option>
    </select>

    <div id="ranges"></div>

    <label class="check">
      <input id="humanReview" type="checkbox" checked>
      Human review is available for uncertain examples
    </label>

    <button id="generate">Generate curation plan</button>
  </aside>

  <section class="panel">
    <div class="head">
      <div>
        <div class="eyebrow">Recommended workflow</div>
        <div class="route" id="route"></div>
      </div>
      <span class="badge" id="badge"></span>
    </div>

    <div class="summary" id="summary"></div>

    <div class="health" id="health"></div>

    <div class="flowbox"><div class="flow" id="flow"></div></div>

    <div class="planTitle">Concrete action plan</div>
    <div id="actions"></div>

    <div class="validation">
      <div class="eyebrow">Before release or training</div>
      <ul id="validationList"></ul>
    </div>

    <div class="note">
      Educational and vendor-neutral guidance. Validate recommendations against licensing, privacy, safety, governance and downstream model behavior.
    </div>
  </section>
</section>
</main>

<footer>
<div class="wrap">
  <strong>Dataset Curation</strong> — an independent Hugging Face Space for AI data curation.<br>
  Collaboration and partnerships: <strong>agenten@magenta.de</strong>
</div>
</footer>

<script>
const $=id=>document.getElementById(id);

const dimensions=[
  ["duplicates","Duplicate level",35],
  ["quality","Quality inconsistency",40],
  ["provenance","Missing provenance",30],
  ["privacy","Privacy / PII risk",25],
  ["contamination","Contamination risk",20],
  ["imbalance","Distribution imbalance",35]
];

const ranges=$("ranges");
dimensions.forEach(([id,label,val])=>{
  const d=document.createElement("div");
  d.className="group";
  d.innerHTML=`<div class="groupTitle"><span>${label}</span><span class="val" id="${id}Val">${val}</span></div>
  <input id="${id}" type="range" min="0" max="100" value="${val}" aria-label="${label}">`;
  ranges.appendChild(d);
  d.querySelector("input").addEventListener("input",e=>{
    $(id+"Val").textContent=e.target.value;
    build();
  });
});

const base={
  pretraining:{
    label:"Pretraining",
    intro:"Build a scalable pipeline that reduces redundancy and noise while preserving useful diversity.",
    stages:["Validate & Normalize","Language / Format Filter","Deduplicate","Quality Score","Privacy / Safety","Decontaminate","Select & Mix","Version & Evaluate"]
  },
  posttraining:{
    label:"Post-Training",
    intro:"Prioritize correctness, supervision quality, task diversity and reliable labels.",
    stages:["Validate Schema","Instruction Quality","Verify Responses","Deduplicate","Difficulty / Diversity","Privacy / Safety","Select & Balance","Evaluate"]
  },
  evaluation:{
    label:"Evaluation",
    intro:"Protect benchmark integrity and make ground truth, coverage and difficulty auditable.",
    stages:["Validate Schema","Verify Ground Truth","Decontaminate","Deduplicate","Balance Difficulty","Audit Coverage","Freeze Version","Evaluate Judges"]
  },
  rag:{
    label:"RAG / Retrieval",
    intro:"Optimize the knowledge base for relevance, freshness, provenance and retrieval quality.",
    stages:["Validate Sources","Normalize","Deduplicate","Quality / Relevance","Freshness","Metadata / Access","Chunk & Index","Retrieval Eval"]
  },
  agents:{
    label:"Agent Data",
    intro:"Select trajectories that demonstrate successful, efficient and safe tool use.",
    stages:["Validate Trace","Check Tool Calls","Verify Outcome","Score Efficiency","Deduplicate","Safety Review","Balance Tasks","Evaluate Policy"]
  }
};

const modalitySteps={
  text:["Language identification","Boilerplate and malformed-text filtering"],
  code:["Parse or compile checks","Repository and license-level deduplication"],
  synthetic:["Generator-artifact detection","Independent verification and difficulty scoring"],
  multimodal:["Media integrity checks","Cross-modal alignment and synchronization"],
  trajectories:["State-action consistency","Outcome and trajectory verification"]
};

const actionText={
  "Validate & Normalize":"Repair encoding, normalize schema and reject structurally invalid records before deeper scoring.",
  "Language / Format Filter":"Measure language and format distribution; remove only clearly out-of-scope or malformed records.",
  "Deduplicate":"Run exact hashes first, then near-duplicate detection; add semantic deduplication only where redundancy remains costly.",
  "Quality Score":"Combine interpretable heuristics with a task-specific learned or model-based quality signal.",
  "Privacy / Safety":"Scan for PII and policy-sensitive content; log whether examples are removed, masked, restricted or retained.",
  "Decontaminate":"Compare against target evaluation sets using exact, fuzzy and semantic overlap checks.",
  "Select & Mix":"Select for quality and utility, then rebalance sources, domains, languages and difficulty before training.",
  "Version & Evaluate":"Freeze a versioned output and measure downstream model impact against an uncurated or previous baseline.",
  "Validate Schema":"Reject malformed records and enforce consistent fields, IDs and metadata.",
  "Instruction Quality":"Check whether prompts are clear, non-trivial and representative of target tasks.",
  "Verify Responses":"Use deterministic checks where possible, calibrated model judges where needed, and humans for uncertain high-value examples.",
  "Difficulty / Diversity":"Measure task clusters and difficulty; prevent easy or repetitive examples from dominating.",
  "Select & Balance":"Retain verified examples while maintaining representative task and domain coverage.",
  "Evaluate":"Run downstream fine-tuning or post-training ablations to validate that curation improves the target system.",
  "Verify Ground Truth":"Audit expected answers, labels and scoring rules; isolate ambiguous examples.",
  "Balance Difficulty":"Construct a deliberate mix of easy, medium, hard and adversarial cases.",
  "Audit Coverage":"Map benchmark items to target capabilities and identify missing or overrepresented skills.",
  "Freeze Version":"Create an immutable evaluation version with provenance and documented changes.",
  "Evaluate Judges":"Measure judge agreement, calibration and known biases where automated judging is used.",
  "Validate Sources":"Confirm source identity, permissions and relevance before ingesting documents.",
  "Normalize":"Standardize text, metadata, timestamps and fields before chunking or indexing.",
  "Quality / Relevance":"Score documents for usefulness to the target query distribution rather than generic writing quality alone.",
  "Freshness":"Detect stale documents and define refresh or expiry policies.",
  "Metadata / Access":"Attach source, permissions, timestamps, ownership and domain metadata to each retrievable unit.",
  "Chunk & Index":"Tune chunk boundaries and indexing strategy after document-level curation.",
  "Retrieval Eval":"Test retrieval recall, ranking quality and answer support on representative queries.",
  "Validate Trace":"Ensure each trajectory has a coherent sequence of observations, actions, tool results and outcomes.",
  "Check Tool Calls":"Flag invalid tools, malformed arguments, redundant calls and incorrect use of tool outputs.",
  "Verify Outcome":"Label task success using deterministic or carefully calibrated evaluation where possible.",
  "Score Efficiency":"Measure unnecessary steps, cost, latency and repeated actions.",
  "Safety Review":"Detect unsafe actions and distinguish useful failure examples from trajectories that should be excluded.",
  "Balance Tasks":"Avoid overrepresenting a narrow set of environments, tools or task templates.",
  "Evaluate Policy":"Test whether training on the curated trajectories improves task success, efficiency and safety."
};

function risk(id){return +$(id).value}
function severity(v){return v>=70?"critical":v>=45?"high":"normal"}

function build(){
  const objective=$("objective").value;
  const modality=$("modality").value;
  const scale=$("scale").value;
  const cfg=base[objective];

  const risks={
    duplicates:risk("duplicates"),
    quality:risk("quality"),
    provenance:risk("provenance"),
    privacy:risk("privacy"),
    contamination:risk("contamination"),
    imbalance:risk("imbalance")
  };

  let stages=[...cfg.stages];

  if(risks.provenance>=55 && !stages.includes("Validate Sources")) stages.unshift("Source & Provenance Audit");
  if(risks.duplicates>=65 && !stages.includes("Deduplicate")) stages.splice(2,0,"Deduplicate");
  if(risks.privacy>=65 && !stages.includes("Privacy / Safety")) stages.splice(Math.max(2,stages.length-2),0,"Privacy / Safety");
  if(risks.contamination>=65 && !stages.includes("Decontaminate")) stages.splice(Math.max(2,stages.length-2),0,"Decontaminate");
  stages=[...new Set(stages)];

  $("route").textContent=cfg.label+" Curation";
  $("badge").textContent=scale.charAt(0).toUpperCase()+scale.slice(1)+" · "+$("modality").options[$("modality").selectedIndex].text;
  $("summary").textContent=cfg.intro+" "+summarySentence(risks, modality, scale);

  const overallRisk=Math.round(Object.values(risks).reduce((a,b)=>a+b,0)/6);
  const readiness=Math.max(0,100-overallRisk);
  const review=$("humanReview").checked ? "Available" : "Limited";

  $("health").innerHTML=`
    <div class="stat"><strong>${readiness}</strong><span>estimated readiness</span></div>
    <div class="stat"><strong>${overallRisk}</strong><span>average risk</span></div>
    <div class="stat"><strong>${stages.length}</strong><span>pipeline stages</span></div>
    <div class="stat"><strong>${review}</strong><span>human review</span></div>`;

  $("flow").innerHTML=stages.map((s,i)=>`
    <span class="node ${importantStage(s,risks)?'high':''}">${s}</span>${i<stages.length-1?'<span class="arrow">→</span>':''}`
  ).join("");

  let actions=stages.map(stage=>({
    stage,
    text:actionText[stage] || customText(stage),
    priority:priorityFor(stage,risks)
  }));

  modalitySteps[modality].forEach((txt,j)=>{
    actions.splice(Math.min(2+j,actions.length),0,{
      stage:modalityLabel(modality,j),
      text:txt+".",
      priority:(modality==="synthetic"||modality==="trajectories")?"high":"normal"
    });
  });

  if($("humanReview").checked){
    actions.push({
      stage:"Targeted Human Review",
      text:"Send uncertain, high-value or high-risk examples to human review instead of applying blanket removal.",
      priority:"high"
    });
  }

  $("actions").innerHTML=actions.slice(0,11).map((a,i)=>`
    <div class="action">
      <div class="stepno">${i+1}</div>
      <div><b>${a.stage}</b><p>${a.text}</p></div>
      <span class="priority ${a.priority}">${a.priority==="critical"?"CRITICAL":a.priority==="high"?"HIGH":"STANDARD"}</span>
    </div>`).join("");

  $("validationList").innerHTML=validationItems(objective,risks,scale).map(x=>`<li>${x}</li>`).join("");
}

function summarySentence(r, modality, scale){
  const arr=Object.entries(r).sort((a,b)=>b[1]-a[1]).slice(0,2);
  const nice={
    duplicates:"duplication",
    quality:"quality inconsistency",
    provenance:"provenance gaps",
    privacy:"privacy risk",
    contamination:"contamination risk",
    imbalance:"distribution imbalance"
  };
  return `The highest current concerns are ${nice[arr[0][0]]} and ${nice[arr[1][0]]}; the plan prioritizes those risks for this ${scale}-scale ${modality} dataset.`;
}

function importantStage(stage,r){
  return (stage.includes("Deduplicate")&&r.duplicates>=55) ||
         (stage.includes("Quality")&&r.quality>=55) ||
         (stage.includes("Privacy")&&r.privacy>=55) ||
         (stage.includes("Decontaminate")&&r.contamination>=55) ||
         (stage.includes("Provenance")&&r.provenance>=55) ||
         (stage.includes("Balance")&&r.imbalance>=55);
}

function priorityFor(stage,r){
  let v=35;
  if(stage.includes("Deduplicate")) v=r.duplicates;
  else if(stage.includes("Quality")||stage.includes("Verify Response")) v=r.quality;
  else if(stage.includes("Privacy")) v=r.privacy;
  else if(stage.includes("Decontaminate")) v=r.contamination;
  else if(stage.includes("Source")||stage.includes("Provenance")||stage.includes("Metadata")) v=r.provenance;
  else if(stage.includes("Balance")||stage.includes("Mix")||stage.includes("Coverage")) v=r.imbalance;
  return severity(v);
}

function customText(stage){
  if(stage==="Source & Provenance Audit") return "Inventory sources, licenses, collection dates and transformation history before additional processing.";
  return "Apply this stage with measurable thresholds and log the decision for reproducibility.";
}

function modalityLabel(modality,i){
  const labels={
    text:["Text Integrity","Boilerplate Control"],
    code:["Code Validity","Repository Hygiene"],
    synthetic:["Synthetic Verification","Difficulty & Diversity"],
    multimodal:["Media Integrity","Modality Alignment"],
    trajectories:["Trajectory Integrity","Outcome Verification"]
  };
  return labels[modality][i];
}

function validationItems(objective,r,scale){
  const items=[
    "Save filter thresholds, scorer versions and random seeds with the dataset version.",
    "Manually inspect retained and rejected samples from every major source or cluster.",
    "Run an ablation or downstream comparison against the previous or uncurated dataset."
  ];
  if(r.contamination>=45) items.push("Re-run contamination checks against the exact evaluation suite used for reporting.");
  if(r.provenance>=45) items.push("Do not publish or train until source and license gaps are explicitly documented.");
  if(r.privacy>=45) items.push("Review the treatment of flagged personal data and retain an auditable removal/redaction policy.");
  if(scale==="large") items.push("Measure curation throughput, storage overhead and failure recovery on representative shards before full-scale processing.");
  if(objective==="rag") items.push("Evaluate retrieval on representative user queries before measuring generation quality.");
  if(objective==="posttraining") items.push("Check correctness and difficulty distributions after filtering so easy examples do not dominate.");
  if(objective==="evaluation") items.push("Freeze the final benchmark version and prevent accidental reuse in training pipelines.");
  if(objective==="agents") items.push("Compare task success, step count, tool accuracy and safety before and after trajectory curation.");
  return items;
}

["objective","modality","scale","humanReview"].forEach(id=>$(id).addEventListener("change",build));
$("generate").addEventListener("click",build);
build();
</script>
</body>
</html>