@@ -52,6 +52,32 @@ export interface TrainExtras {
5252 brick_kinds ?: string [ ] | string ;
5353 num_brick_kinds ?: number ;
5454 } ;
55+ // V7-Q06.3: styled panels for previously-untyped extras keys.
56+ plasticity ?: {
57+ fire_fired_at_step ?: number ;
58+ fire_keys_modified ?: string [ ] ;
59+ dash_last_keys_count ?: number ;
60+ redo_last_recycled ?: number | string | null ;
61+ [ k : string ] : unknown ;
62+ } ;
63+ mtp ?: {
64+ k ?: number ;
65+ beta ?: number | number [ ] ;
66+ head_losses ?: number [ ] ;
67+ [ k : string ] : unknown ;
68+ } | null ;
69+ ifim ?: {
70+ instr_loss ?: number ;
71+ instr_token_count ?: number ;
72+ lambda ?: number ;
73+ [ k : string ] : unknown ;
74+ } | null ;
75+ mhc ?: {
76+ consistency_loss ?: number ;
77+ heads_correlated ?: number ;
78+ lambda ?: number ;
79+ [ k : string ] : unknown ;
80+ } | null ;
5581 [ k : string ] : unknown ;
5682}
5783
@@ -216,10 +242,163 @@ export function TrainExtrasOverlay({
216242 || Array . isArray ( extras . per_expert_load ) ) && (
217243 < MoEDashboard extras = { extras } />
218244 ) }
245+
246+ { /* V7-Q06.3: plasticity panel — FIRE/DASH/ReDo capture from train. */ }
247+ { extras . plasticity
248+ && Object . keys ( extras . plasticity ) . some (
249+ ( k ) => extras . plasticity ! [ k ] !== undefined
250+ && extras . plasticity ! [ k ] !== null ) && (
251+ < PlasticityPanel data = { extras . plasticity } />
252+ ) }
253+
254+ { /* V7-Q06.3: MTP-weighted head loss panel. */ }
255+ { extras . mtp && (
256+ < MTPPanel data = { extras . mtp } />
257+ ) }
258+
259+ { /* V7-Q06.3: IFIM instr-token loss panel. */ }
260+ { extras . ifim && (
261+ < IFIMPanel data = { extras . ifim } />
262+ ) }
263+
264+ { /* V7-Q06.3: MHC attention-bias consistency panel. */ }
265+ { extras . mhc && (
266+ < MHCPanel data = { extras . mhc } />
267+ ) }
219268 </ div >
220269 ) ;
221270}
222271
272+ // ---------------------------------------------------------------------------
273+ // V7-Q06.3 styled sub-panels for plasticity / mtp / ifim / mhc extras.
274+ // ---------------------------------------------------------------------------
275+
276+ function _PanelShell ( {
277+ testid, title, children,
278+ } : { testid : string ; title : string ; children : React . ReactNode } ) {
279+ return (
280+ < div data-testid = { testid }
281+ style = { { marginTop : 4 , padding : "4px 8px" ,
282+ border : "1px solid #e5e7eb" , borderRadius : 4 ,
283+ background : "#fafaf9" , fontSize : 11 } } >
284+ < div style = { { fontWeight : 600 , color : "#374151" ,
285+ marginBottom : 4 } } > { title } </ div >
286+ { children }
287+ </ div >
288+ ) ;
289+ }
290+
291+ function _MetricRow ( {
292+ testid, label, value,
293+ } : { testid : string ; label : string ; value : string } ) {
294+ return (
295+ < div style = { { display : "flex" , gap : 6 } } >
296+ < span style = { { color : "#6b7280" , minWidth : 110 } } > { label } :</ span >
297+ < span data-testid = { testid } style = { { color : "#111827" ,
298+ fontFamily : "monospace" } } >
299+ { value }
300+ </ span >
301+ </ div >
302+ ) ;
303+ }
304+
305+ function PlasticityPanel ( { data } : { data : NonNullable < TrainExtras [ "plasticity" ] > } ) {
306+ return (
307+ < _PanelShell testid = "extras-panel-plasticity"
308+ title = "Plasticity (FIRE / DASH / ReDo)" >
309+ { typeof data . fire_fired_at_step === "number" && (
310+ < _MetricRow testid = "extras-plasticity-fire-step"
311+ label = "fire_fired_at_step"
312+ value = { String ( data . fire_fired_at_step ) } />
313+ ) }
314+ { Array . isArray ( data . fire_keys_modified ) && (
315+ < _MetricRow testid = "extras-plasticity-fire-keys"
316+ label = "fire_keys_modified"
317+ value = { `${ data . fire_keys_modified . length } keys` } />
318+ ) }
319+ { typeof data . dash_last_keys_count === "number" && (
320+ < _MetricRow testid = "extras-plasticity-dash-keys-count"
321+ label = "dash_last_keys_count"
322+ value = { String ( data . dash_last_keys_count ) } />
323+ ) }
324+ { data . redo_last_recycled !== undefined
325+ && data . redo_last_recycled !== null && (
326+ < _MetricRow testid = "extras-plasticity-redo-recycled"
327+ label = "redo_last_recycled"
328+ value = { String ( data . redo_last_recycled ) } />
329+ ) }
330+ </ _PanelShell >
331+ ) ;
332+ }
333+
334+ function MTPPanel ( { data } : { data : NonNullable < TrainExtras [ "mtp" ] > } ) {
335+ return (
336+ < _PanelShell testid = "extras-panel-mtp"
337+ title = "MTP (multi-token-prediction)" >
338+ { typeof data . k === "number" && (
339+ < _MetricRow testid = "extras-mtp-k"
340+ label = "k" value = { String ( data . k ) } />
341+ ) }
342+ { data . beta !== undefined && (
343+ < _MetricRow testid = "extras-mtp-beta"
344+ label = "beta" value = { JSON . stringify ( data . beta ) } />
345+ ) }
346+ { Array . isArray ( data . head_losses ) && (
347+ < _MetricRow testid = "extras-mtp-head-losses"
348+ label = "head_losses"
349+ value = { data . head_losses . map (
350+ ( l ) => Number ( l ) . toFixed ( 4 ) ) . join ( " / " ) } />
351+ ) }
352+ </ _PanelShell >
353+ ) ;
354+ }
355+
356+ function IFIMPanel ( { data } : { data : NonNullable < TrainExtras [ "ifim" ] > } ) {
357+ return (
358+ < _PanelShell testid = "extras-panel-ifim"
359+ title = "IFIM (instruction-aware FIM)" >
360+ { typeof data . instr_loss === "number" && (
361+ < _MetricRow testid = "extras-ifim-instr-loss"
362+ label = "instr_loss"
363+ value = { Number ( data . instr_loss ) . toFixed ( 4 ) } />
364+ ) }
365+ { typeof data . instr_token_count === "number" && (
366+ < _MetricRow testid = "extras-ifim-token-count"
367+ label = "instr_token_count"
368+ value = { String ( data . instr_token_count ) } />
369+ ) }
370+ { typeof data . lambda === "number" && (
371+ < _MetricRow testid = "extras-ifim-lambda"
372+ label = "lambda"
373+ value = { Number ( data . lambda ) . toFixed ( 4 ) } />
374+ ) }
375+ </ _PanelShell >
376+ ) ;
377+ }
378+
379+ function MHCPanel ( { data } : { data : NonNullable < TrainExtras [ "mhc" ] > } ) {
380+ return (
381+ < _PanelShell testid = "extras-panel-mhc"
382+ title = "MHC (multi-head consistency)" >
383+ { typeof data . consistency_loss === "number" && (
384+ < _MetricRow testid = "extras-mhc-consistency-loss"
385+ label = "consistency_loss"
386+ value = { Number ( data . consistency_loss ) . toFixed ( 4 ) } />
387+ ) }
388+ { typeof data . heads_correlated === "number" && (
389+ < _MetricRow testid = "extras-mhc-heads-correlated"
390+ label = "heads_correlated"
391+ value = { Number ( data . heads_correlated ) . toFixed ( 4 ) } />
392+ ) }
393+ { typeof data . lambda === "number" && (
394+ < _MetricRow testid = "extras-mhc-lambda"
395+ label = "lambda"
396+ value = { Number ( data . lambda ) . toFixed ( 4 ) } />
397+ ) }
398+ </ _PanelShell >
399+ ) ;
400+ }
401+
223402function Badge ( {
224403 testid, label, value, tone = "neutral" , help,
225404} : { testid : string ; label : string ; value : string ;
0 commit comments