File size: 25,952 Bytes
494c9e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82b33f3
494c9e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c911b05
494c9e4
 
 
 
 
 
 
 
c911b05
494c9e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c911b05
494c9e4
c911b05
494c9e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c911b05
494c9e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c911b05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494c9e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c911b05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494c9e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b704fe2
 
 
 
 
 
 
 
 
 
494c9e4
53e5b08
 
b704fe2
 
53e5b08
494c9e4
b704fe2
 
53e5b08
 
 
 
 
 
 
 
 
 
 
 
 
 
 
494c9e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="gen_attribute.css">
</head>

<body class="gen-attribute-page">

    <main class="main_frame">
        <section class="left_panel">
            <div class="floating_content">
                <header class="app-page-toolbar app-page-toolbar--bleed">
                    <h1 class="page-toolbar-title"><span class="title-main-line"><span data-page-title data-i18n></span><span class="title-tagline" data-page-subtitle data-i18n></span></span></h1>
                    <div class="app-page-toolbar-actions">
                        <a href="index.html" class="home-link" title="Info Lens" data-i18n="text,title">Info Lens</a>
                        <div class="settings-menu-wrapper">
                            <button id="settings_btn" class="settings-btn" title="Settings" data-i18n="title">
                                <span class="settings-icon">⚙️</span>
                            </button>
                            <div id="settings_menu" class="settings-menu" style="display: none;">
                                <!-- INCLUDE partials/settings-menu-common-mid.html -->
                                <!-- INCLUDE partials/settings-menu-trailing-admin.html -->
                            </div>
                        </div>
                    </div>
                </header>

                <div class="chat-cached-history-bar chat-cached-history-bar--dual">
                    <div class="semantic-search-input-wrapper chat-prompt-history-wrapper gen-attr-cached-demos-wrap">
                        <button type="button" id="gen_attr_cached_demos_btn" class="text-action-btn" data-i18n>Cached demos</button>
                        <ul id="gen_attr_cached_demos_dropdown" class="semantic-search-history-dropdown"></ul>
                    </div>
                    <div class="semantic-search-input-wrapper chat-prompt-history-wrapper gen-attr-cached-history-wrap">
                        <button type="button" id="gen_attr_cached_history_btn" class="text-action-btn" data-i18n>Cached history</button>
                        <ul id="gen_attr_cached_history_dropdown" class="semantic-search-history-dropdown"></ul>
                    </div>
                </div>

                <section class="input-section">
                    <div class="semantic-submode-row chat-raw-prompt-mode-row">
                        <span class="semantic-submode-group">
                            <label class="semantic-submode-label" for="gen_attr_skip_chat_template">
                                <input type="checkbox" id="gen_attr_skip_chat_template" />
                                <span data-i18n>Raw prompt mode</span>
                            </label>
                        </span>
                    </div>

                    <div id="gen_attr_raw_input_panel" class="chat-prompt-panel">
                        <div class="input-header">
                            <span class="semantic-submode-label" data-i18n>Raw prompt</span>
                            <div class="text-action-buttons-top">
                                <div class="textarea-counter" id="gen_attr_raw_text_count_display">
                                    <span id="gen_attr_raw_text_count_value">0</span> <span data-i18n>chars</span>
                                </div>
                                <button type="button" id="gen_attr_clear_raw_btn" class="text-action-btn" data-i18n>Clear</button>
                                <button type="button" id="gen_attr_paste_raw_btn" class="text-action-btn" data-i18n>Paste</button>
                                <button type="button" id="gen_attr_raw_history_btn" class="text-action-btn" data-i18n>History</button>
                            </div>
                        </div>
                        <div class="textarea-wrapper chat-prompt-textarea-block">
                            <div class="semantic-search-input-wrapper chat-prompt-history-wrapper">
                                <textarea id="gen_attr_raw_text"></textarea>
                                <ul id="gen_attr_raw_input_history_dropdown" class="semantic-search-history-dropdown"></ul>
                            </div>
                        </div>
                    </div>

                    <div id="gen_attr_chat_input_panel" hidden>
                        <div class="chat-prompt-panel" id="gen_attr_system_prompt_panel">
                            <div class="input-header">
                                <label class="chat-use-system-label semantic-submode-label" for="gen_attr_use_system_prompt">
                                    <input type="checkbox" id="gen_attr_use_system_prompt" checked />
                                    <span data-i18n>System</span>
                                </label>
                                <div class="text-action-buttons-top">
                                    <div class="textarea-counter" id="gen_attr_system_text_count_display">
                                        <span id="gen_attr_system_text_count_value">0</span> <span data-i18n>chars</span>
                                    </div>
                                    <button type="button" id="gen_attr_clear_system_btn" class="text-action-btn" data-i18n>Clear</button>
                                    <button type="button" id="gen_attr_paste_system_btn" class="text-action-btn" data-i18n>Paste</button>
                                    <button type="button" id="gen_attr_system_history_btn" class="text-action-btn" data-i18n>History</button>
                                </div>
                            </div>
                            <div class="textarea-wrapper chat-prompt-textarea-block">
                                <div class="semantic-search-input-wrapper chat-prompt-history-wrapper">
                                    <textarea id="gen_attr_system_text">You are a helpful assistant.</textarea>
                                    <ul id="gen_attr_system_prompt_history_dropdown" class="semantic-search-history-dropdown"></ul>
                                </div>
                            </div>
                        </div>
                        <div class="chat-prompt-panel">
                            <div class="input-header">
                                <span class="semantic-submode-label" data-i18n>User</span>
                                <div class="text-action-buttons-top">
                                    <div class="textarea-counter" id="gen_attr_user_text_count_display">
                                        <span id="gen_attr_user_text_count_value">0</span> <span data-i18n>chars</span>
                                    </div>
                                    <button type="button" id="gen_attr_clear_user_btn" class="text-action-btn" data-i18n>Clear</button>
                                    <button type="button" id="gen_attr_paste_user_btn" class="text-action-btn" data-i18n>Paste</button>
                                    <button type="button" id="gen_attr_user_history_btn" class="text-action-btn" data-i18n>History</button>
                                </div>
                            </div>
                            <div class="textarea-wrapper chat-prompt-textarea-block">
                                <div class="semantic-search-input-wrapper chat-prompt-history-wrapper">
                                    <textarea id="gen_attr_user_text"></textarea>
                                    <ul id="gen_attr_user_prompt_history_dropdown" class="semantic-search-history-dropdown"></ul>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="attribution-exclude-prompt-patterns-row">
                        <div class="semantic-submode-row gen-attr-teacher-forcing-toggle-row">
                            <span class="semantic-submode-group">
                                <label class="semantic-submode-label"
                                    title="When enabled, type the exact continuation after the assembled prompt. Each step attributes the next token toward that text (same tokenizer as Model), then stops when the continuation is consumed or EOS."
                                    data-i18n="title">
                                    <input type="checkbox" id="gen_attr_teacher_forcing_enable">
                                    <span data-i18n>Teacher forcing</span>
                                </label>
                            </span>
                        </div>
                        <div id="gen_attr_teacher_forcing_block" class="chat-prompt-panel" hidden>
                            <div class="input-header">
                                <span class="semantic-submode-label" data-i18n>Forced continuation</span>
                                <div class="text-action-buttons-top">
                                    <div class="textarea-counter" id="gen_attr_teacher_forcing_text_count_display">
                                        <span id="gen_attr_teacher_forcing_text_count_value">0</span> <span data-i18n>chars</span>
                                    </div>
                                    <button type="button" id="gen_attr_clear_teacher_forcing_btn" class="text-action-btn" data-i18n>Clear</button>
                                    <button type="button" id="gen_attr_paste_teacher_forcing_btn" class="text-action-btn" data-i18n>Paste</button>
                                    <button type="button" id="gen_attr_teacher_forcing_history_btn" class="text-action-btn" data-i18n>History</button>
                                </div>
                            </div>
                            <div class="textarea-wrapper chat-prompt-textarea-block">
                                <div class="semantic-search-input-wrapper chat-prompt-history-wrapper">
                                    <textarea id="gen_attr_teacher_forcing_text"
                                        spellcheck="false" autocomplete="off"
                                        title="Expected generated text after the full prompt. Each API step uses the first token of what remains here as the attribution target."
                                        data-i18n="title"></textarea>
                                    <ul id="gen_attr_teacher_forcing_history_dropdown" class="semantic-search-history-dropdown"></ul>
                                </div>
                            </div>
                            <div class="semantic-submode-row gen-attr-stop-after-tf-row">
                                <label class="semantic-submode-label"
                                    title="When unchecked, generation continues with top-1 after teacher forcing tokens are exhausted, up to Max tokens."
                                    data-i18n="title">
                                    <input type="checkbox" id="gen_attr_stop_after_teacher_forcing">
                                    <span data-i18n>Stop after teacher forcing</span>
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="textarea-wrapper chat-prompt-actions-row">
                        <div class="semantic-submode-row chat-completion-options-row attribution-model-variant-row">
                            <span class="semantic-submode-group">
                                <label class="semantic-submode-label" for="gen_attr_model_variant">Model</label>
                                <select id="gen_attr_model_variant" class="semantic-submode-select" aria-label="Model slot">
                                    <option value="base">base</option>
                                    <option value="instruct" selected>instruct</option>
                                </select>
                            </span>
                            <span class="semantic-submode-group">
                                <label class="semantic-submode-label" for="gen_attr_max_tokens">Max tokens</label>
                                <input type="number" id="gen_attr_max_tokens" class="gen-attr-max-tokens-input"
                                    value="100" min="1" max="500" step="1">
                            </span>
                        </div>
                        <div class="button-group">
                            <div class="button-left">
                                <button type="button" id="gen_attr_submit_btn" class="primary-btn inactive" disabled>Start</button>
                                <div class="generation-status-slot loader-small-container">
                                    <div class="loadersmall"></div>
                                    <span id="gen_attr_complete_reason" class="generation-end-reason"></span>
                                </div>
                                <span id="gen_attr_analyze_progress" class="analyze-progress"></span>
                            </div>
                            <div id="gen_attr_text_metrics" class="text-metrics text-metrics-chat">
                                <div id="gen_attr_metric_usage" class="text-metrics-secondary"></div>
                                <div id="gen_attr_metric_model" class="text-metrics-secondary">model: </div>
                            </div>
                            <button type="button" id="gen_attr_export_demo_btn" class="primary-btn" style="display: none" title="Admin: download current run as JSON for bundled demos">Export demo</button>
                        </div>
                    </div>

                    <div class="gen-attr-dag-measure-width-row semantic-submode-row">
                        <span class="semantic-submode-group gen-attr-dag-layout-mode-group">
                            <label class="semantic-submode-label" for="gen_attr_dag_layout_mode">DAG layout mode</label>
                            <select id="gen_attr_dag_layout_mode"
                                class="semantic-submode-select gen-attr-dag-layout-mode-select"
                                title="Choose DAG layout mode. 'text-flow' follows text layout geometry; 'linear-arc' uses fixed-order linear nodes with arc links; 'spiral' lays nodes on an Archimedean spiral (for fun)."
                                data-i18n="title">
                                <option value="text-flow">text-flow</option>
                                <option value="linear-arc">linear-arc</option>
                                <option value="spiral">spiral (for fun)</option>
                            </select>
                        </span>
                        <span class="semantic-submode-group" id="gen_attr_dag_compactness_group">
                            <label class="semantic-submode-label" for="gen_attr_dag_compactness" data-i18n>Compactness</label>
                            <input type="number" id="gen_attr_dag_compactness" class="gen-attr-dag-measure-width-input"
                                value="0.5" min="0.05" max="1" step="0.05"
                                title="Scales DAG node boxes and labels relative to the measurement layer; 1 matches full readout scale. Applies in text-flow and spiral layouts. When idle, changes replay and fit automatically; during generation or DAG playback, the setting updates for the next run or refresh."
                                data-i18n="title">
                        </span>
                        <span class="semantic-submode-group" id="gen_attr_dag_measure_width_group">
                            <label class="semantic-submode-label" for="gen_attr_dag_measure_width">Text width</label>
                            <input type="number" id="gen_attr_dag_measure_width" class="gen-attr-dag-measure-width-input"
                                value="500" min="200" max="4000" step="10"
                                title="Width (px) of the invisible measurement layer used for DAG layout. Only this width affects wrapping and node positions. When idle, changes replay and fit automatically; during generation or DAG playback, the setting updates for the next run or refresh."
                                data-i18n="title">
                            <span class="semantic-submode-label">px</span>
                        </span>
                        <span class="semantic-submode-group" id="gen_attr_dag_linear_arc_interval_group" hidden>
                            <label class="semantic-submode-label" for="gen_attr_dag_linear_arc_interval" data-i18n>Token distance</label>
                            <input type="number" id="gen_attr_dag_linear_arc_interval" class="gen-attr-dag-measure-width-input"
                                value="0" min="0" max="400" step="1"
                                title="Horizontal gap (px) between the outer left/right edges of adjacent token nodes in linear-arc layout only. When idle, the DAG refits; during generation or DAG playback, the value is stored and applied on the next sync."
                                data-i18n="title">
                            <span class="semantic-submode-label">px</span>
                        </span>
                    </div>
                    <div class="gen-attr-dag-measure-width-row semantic-submode-row">
                        <span class="semantic-submode-group">
                            <label class="semantic-submode-label">
                                <input type="checkbox" id="gen_attr_dag_hide_inactive_edges"
                                    title="When checked, gray DAG edges not adjacent to the hovered or selected node are hidden."
                                    data-i18n="title">
                                Hide inactive edges
                            </label>
                        </span>
                    </div>
                    <div class="gen-attr-dag-measure-width-row semantic-submode-row">
                        <span class="semantic-submode-group">
                            <label class="semantic-submode-label" for="gen_attr_dag_edge_top_p_coverage" data-i18n>Edge top-p coverage</label>
                            <input type="number" id="gen_attr_dag_edge_top_p_coverage" class="gen-attr-dag-measure-width-input"
                                value="0.7" min="0.05" max="1" step="0.05"
                                title="Coverage is the cumulative mass share within each generation step's Top-N candidate pool (after sorting candidates into the pool and normalizing mass inside that pool). Higher values keep more incoming edges. The denominator is this pool only, not every token-attribution entry returned for the step."
                                data-i18n="title">
                        </span>
                    </div>
                    <div class="attribution-exclude-prompt-patterns-row">
                        <div class="semantic-submode-row attribution-exclude-prompt-patterns-header">
                            <span class="semantic-submode-group">
                                <label class="attribution-use-mapping-label"
                                    title="When enabled, each line below is a regex with the global flag, matched only within the initial static prompt prefix (excluding generated continuation). If a token offset lies fully inside a match, its score is treated as 0."
                                    data-i18n="title">
                                    <input type="checkbox" id="gen_attr_exclude_prompt_patterns_enable" checked>
                                    <span></span>
                                </label>
                            </span>
                            <span class="semantic-submode-group">
                                <label class="semantic-submode-label" for="gen_attr_exclude_prompt_patterns" data-i18n>Exclude prompt patterns</label>
                            </span>
                        </div>
                        <textarea id="gen_attr_exclude_prompt_patterns" class="attribution-exclude-prompt-patterns-input" rows="2"
                            placeholder="One regex per line (prompt prefix only)"
                            spellcheck="false"
                            autocomplete="off"
                            title="One regex per line (global flag), matched only within the initial prompt prefix; if a token offset lies fully inside a match, its score is treated as 0."
                            data-i18n="placeholder,title"></textarea>
                    </div>

                    <div class="attribution-exclude-prompt-patterns-row">
                        <div class="semantic-submode-row attribution-exclude-generated-patterns-header">
                            <span class="semantic-submode-group">
                                <label class="attribution-use-mapping-label"
                                    title="When enabled, each line below is a regex with the global flag, matched only within the model-generated continuation (excluding the initial static prompt). If a token offset lies fully inside a match, its score is treated as 0."
                                    data-i18n="title">
                                    <input type="checkbox" id="gen_attr_exclude_generated_patterns_enable" checked>
                                    <span></span>
                                </label>
                            </span>
                            <span class="semantic-submode-group">
                                <label class="semantic-submode-label" for="gen_attr_exclude_generated_patterns" data-i18n>Exclude generated patterns</label>
                            </span>
                        </div>
                        <textarea id="gen_attr_exclude_generated_patterns" class="attribution-exclude-prompt-patterns-input" rows="2"
                            placeholder="One regex per line (generated continuation only)"
                            spellcheck="false"
                            autocomplete="off"
                            title="One regex per line (global flag), matched only within the generated suffix; if a token offset lies fully inside a match, its score is treated as 0."
                            data-i18n="placeholder,title"></textarea>
                    </div>

                    <div class="gen-attr-dag-measure-width-row semantic-submode-row">
                        <span class="semantic-submode-group">
                            <label class="semantic-submode-label">
                                <input type="checkbox" id="gen_attr_dag_hide_excluded_tokens"
                                    title="When checked, tokens fully covered by an exclude pattern are hidden from the DAG (linear-arc: also excluded from layout)."
                                    data-i18n="title">
                                <span data-i18n>Hide excluded tokens</span>
                            </label>
                        </span>
                    </div>
                    <div class="gen-attr-dag-measure-width-row semantic-submode-row">
                        <span class="semantic-submode-group gen-attr-dag-replay-speed-row">
                            <label class="semantic-submode-label" for="gen_attr_dag_replay_mode" data-i18n>DAG replay speed</label>
                            <select id="gen_attr_dag_replay_mode"
                                class="semantic-submode-select gen-attr-dag-replay-mode-select"
                                title="Total duration vs. fixed delay per step. Waits shrink if a step is slow; long idle realigns the beat."
                                data-i18n="title">
                                <option value="total" data-i18n>total time</option>
                                <option value="step" data-i18n>step time</option>
                            </select>
                            <span id="gen_attr_dag_replay_total_wrap" class="gen-attr-dag-replay-value-wrap">
                                <input type="number" id="gen_attr_dag_playback_total_s" class="gen-attr-dag-measure-width-input"
                                    value="7" min="1" max="3600" step="1"
                                    title="Nominal delay = total seconds ÷ (steps − 1). Saved locally; applied when you press play."
                                    data-i18n="title">
                                <span class="semantic-submode-label">s</span>
                            </span>
                            <span id="gen_attr_dag_replay_step_wrap" class="gen-attr-dag-replay-value-wrap" hidden>
                                <input type="number" id="gen_attr_dag_playback_step_ms" class="gen-attr-dag-measure-width-input"
                                    value="200" min="0" max="10000" step="10"
                                    title="Nominal ms between steps. Saved locally; applied when you press play (not mid-run)."
                                    data-i18n="title">
                                <span class="semantic-submode-label">ms</span>
                            </span>
                        </span>
                    </div>
                </section>
            </div>
        </section>

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

        <section class="right_panel">
            <div id="results" class="attribution-inspector-surface gen-attr-results-surface LMF"></div>
        </section>
    </main>

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

    <script src="vendor.js"></script>
    <script src="gen_attribute.js"></script>

</body>

</html>