drowse.ai 5.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- drowse/__init__.py +312 -0
- drowse/__main__.py +5 -0
- drowse/cli/__init__.py +5 -0
- drowse/cli/alpha_grid.py +96 -0
- drowse/cli/config_file.py +340 -0
- drowse/cli/main.py +52 -0
- drowse/cli/parsers.py +1478 -0
- drowse/cli/runners/__init__.py +155 -0
- drowse/cli/runners/config.py +85 -0
- drowse/cli/runners/experiment.py +344 -0
- drowse/cli/runners/lens.py +661 -0
- drowse/cli/runners/manifold.py +1097 -0
- drowse/cli/runners/pack.py +413 -0
- drowse/cli/runners/sae.py +304 -0
- drowse/cli/runners/serve.py +220 -0
- drowse/cli/runners/shared.py +389 -0
- drowse/cli/runners/template.py +232 -0
- drowse/core/__init__.py +1 -0
- drowse/core/capture.py +1205 -0
- drowse/core/errors.py +260 -0
- drowse/core/events.py +156 -0
- drowse/core/extraction.py +3076 -0
- drowse/core/generation.py +1738 -0
- drowse/core/generation_finalizer.py +278 -0
- drowse/core/histogram.py +30 -0
- drowse/core/hooks.py +1885 -0
- drowse/core/instruments/__init__.py +49 -0
- drowse/core/instruments/geometry.py +551 -0
- drowse/core/instruments/lens.py +1341 -0
- drowse/core/instruments/protocol.py +211 -0
- drowse/core/instruments/sae.py +935 -0
- drowse/core/instruments/types.py +597 -0
- drowse/core/jlens.py +874 -0
- drowse/core/jlens_fit.py +1305 -0
- drowse/core/joint_logprobs.py +748 -0
- drowse/core/loom.py +1938 -0
- drowse/core/loom_diff.py +408 -0
- drowse/core/mahalanobis.py +579 -0
- drowse/core/manifold.py +4106 -0
- drowse/core/measurements.py +382 -0
- drowse/core/model.py +1724 -0
- drowse/core/monitor.py +2060 -0
- drowse/core/monitor_attach.py +682 -0
- drowse/core/naming.py +42 -0
- drowse/core/naturalness.py +187 -0
- drowse/core/profile.py +617 -0
- drowse/core/relp.py +313 -0
- drowse/core/results.py +467 -0
- drowse/core/role_templates.py +677 -0
- drowse/core/sae.py +891 -0
- drowse/core/sae_training.py +239 -0
- drowse/core/sampling.py +127 -0
- drowse/core/scene.py +810 -0
- drowse/core/scoring.py +270 -0
- drowse/core/session.py +11015 -0
- drowse/core/static_cache.py +316 -0
- drowse/core/steering.py +229 -0
- drowse/core/steering_composer.py +1135 -0
- drowse/core/steering_expr.py +1413 -0
- drowse/core/surface_topology.py +128 -0
- drowse/core/token_callback.py +52 -0
- drowse/core/token_payloads.py +244 -0
- drowse/core/topology.py +1469 -0
- drowse/core/transcript.py +582 -0
- drowse/core/tree_filter.py +353 -0
- drowse/core/triggers.py +250 -0
- drowse/data/baseline_prompts.json +50 -0
- drowse/data/manifolds/confident.uncertain/manifold.json +28 -0
- drowse/data/manifolds/confident.uncertain/nodes/00_confident.json +50 -0
- drowse/data/manifolds/confident.uncertain/nodes/01_uncertain.json +50 -0
- drowse/data/manifolds/creative.conventional/manifold.json +28 -0
- drowse/data/manifolds/creative.conventional/nodes/00_creative.json +50 -0
- drowse/data/manifolds/creative.conventional/nodes/01_conventional.json +50 -0
- drowse/data/manifolds/curious.disinterested/manifold.json +28 -0
- drowse/data/manifolds/curious.disinterested/nodes/00_curious.json +50 -0
- drowse/data/manifolds/curious.disinterested/nodes/01_disinterested.json +50 -0
- drowse/data/manifolds/direct.indirect/manifold.json +28 -0
- drowse/data/manifolds/direct.indirect/nodes/00_direct.json +50 -0
- drowse/data/manifolds/direct.indirect/nodes/01_indirect.json +50 -0
- drowse/data/manifolds/emotions/manifold.json +115 -0
- drowse/data/manifolds/emotions/nodes/00_excited.json +50 -0
- drowse/data/manifolds/emotions/nodes/01_happy.json +50 -0
- drowse/data/manifolds/emotions/nodes/02_calm.json +50 -0
- drowse/data/manifolds/emotions/nodes/03_weary.json +50 -0
- drowse/data/manifolds/emotions/nodes/04_sad.json +50 -0
- drowse/data/manifolds/emotions/nodes/05_distressed.json +50 -0
- drowse/data/manifolds/emotions/nodes/06_alert.json +50 -0
- drowse/data/manifolds/emotions/nodes/07_dominant.json +50 -0
- drowse/data/manifolds/emotions/nodes/08_submissive.json +50 -0
- drowse/data/manifolds/emotions/nodes/09_angry.json +50 -0
- drowse/data/manifolds/emotions/nodes/10_fearful.json +50 -0
- drowse/data/manifolds/emotions/nodes/11_surprised.json +50 -0
- drowse/data/manifolds/emotions/nodes/12_triumphant.json +50 -0
- drowse/data/manifolds/emotions/nodes/13_humiliated.json +50 -0
- drowse/data/manifolds/emotions/nodes/14_disgusted.json +50 -0
- drowse/data/manifolds/emotions/nodes/15_bored.json +50 -0
- drowse/data/manifolds/emotions/nodes/16_grateful.json +50 -0
- drowse/data/manifolds/emotions/nodes/17_relieved.json +50 -0
- drowse/data/manifolds/emotions/nodes/18_playful.json +50 -0
- drowse/data/manifolds/emotions/nodes/19_hopeful.json +50 -0
- drowse/data/manifolds/formal.casual/manifold.json +28 -0
- drowse/data/manifolds/formal.casual/nodes/00_formal.json +50 -0
- drowse/data/manifolds/formal.casual/nodes/01_casual.json +50 -0
- drowse/data/manifolds/honest.deceptive/manifold.json +28 -0
- drowse/data/manifolds/honest.deceptive/nodes/00_honest.json +50 -0
- drowse/data/manifolds/honest.deceptive/nodes/01_deceptive.json +50 -0
- drowse/data/manifolds/humorous.serious/manifold.json +28 -0
- drowse/data/manifolds/humorous.serious/nodes/00_humorous.json +50 -0
- drowse/data/manifolds/humorous.serious/nodes/01_serious.json +50 -0
- drowse/data/manifolds/individualist.collectivist/manifold.json +28 -0
- drowse/data/manifolds/individualist.collectivist/nodes/00_individualist.json +50 -0
- drowse/data/manifolds/individualist.collectivist/nodes/01_collectivist.json +50 -0
- drowse/data/manifolds/masculine.feminine/manifold.json +28 -0
- drowse/data/manifolds/masculine.feminine/nodes/00_masculine.json +50 -0
- drowse/data/manifolds/masculine.feminine/nodes/01_feminine.json +50 -0
- drowse/data/manifolds/months/manifold.json +120 -0
- drowse/data/manifolds/months/nodes/00_january.json +50 -0
- drowse/data/manifolds/months/nodes/01_february.json +50 -0
- drowse/data/manifolds/months/nodes/02_march.json +50 -0
- drowse/data/manifolds/months/nodes/03_april.json +50 -0
- drowse/data/manifolds/months/nodes/04_may.json +50 -0
- drowse/data/manifolds/months/nodes/05_june.json +50 -0
- drowse/data/manifolds/months/nodes/06_july.json +50 -0
- drowse/data/manifolds/months/nodes/07_august.json +50 -0
- drowse/data/manifolds/months/nodes/08_september.json +50 -0
- drowse/data/manifolds/months/nodes/09_october.json +50 -0
- drowse/data/manifolds/months/nodes/10_november.json +50 -0
- drowse/data/manifolds/months/nodes/11_december.json +50 -0
- drowse/data/manifolds/personas/manifold.json +550 -0
- drowse/data/manifolds/personas/nodes/00_assistant.json +50 -0
- drowse/data/manifolds/personas/nodes/01_analyst.json +50 -0
- drowse/data/manifolds/personas/nodes/02_impostor.json +50 -0
- drowse/data/manifolds/personas/nodes/03_teacher.json +50 -0
- drowse/data/manifolds/personas/nodes/04_doctor.json +50 -0
- drowse/data/manifolds/personas/nodes/05_librarian.json +50 -0
- drowse/data/manifolds/personas/nodes/06_farmer.json +50 -0
- drowse/data/manifolds/personas/nodes/07_soldier.json +50 -0
- drowse/data/manifolds/personas/nodes/08_lawyer.json +50 -0
- drowse/data/manifolds/personas/nodes/09_chef.json +50 -0
- drowse/data/manifolds/personas/nodes/100_assassin.json +50 -0
- drowse/data/manifolds/personas/nodes/101_thief.json +50 -0
- drowse/data/manifolds/personas/nodes/102_conman.json +50 -0
- drowse/data/manifolds/personas/nodes/103_hacker.json +50 -0
- drowse/data/manifolds/personas/nodes/104_cultist.json +50 -0
- drowse/data/manifolds/personas/nodes/105_tyrant.json +50 -0
- drowse/data/manifolds/personas/nodes/106_vandal.json +50 -0
- drowse/data/manifolds/personas/nodes/10_journalist.json +50 -0
- drowse/data/manifolds/personas/nodes/11_mechanic.json +50 -0
- drowse/data/manifolds/personas/nodes/12_sailor.json +50 -0
- drowse/data/manifolds/personas/nodes/13_pilot.json +50 -0
- drowse/data/manifolds/personas/nodes/14_athlete.json +50 -0
- drowse/data/manifolds/personas/nodes/15_engineer.json +50 -0
- drowse/data/manifolds/personas/nodes/16_scientist.json +50 -0
- drowse/data/manifolds/personas/nodes/17_banker.json +50 -0
- drowse/data/manifolds/personas/nodes/18_salesperson.json +50 -0
- drowse/data/manifolds/personas/nodes/19_nerd.json +50 -0
- drowse/data/manifolds/personas/nodes/20_jock.json +50 -0
- drowse/data/manifolds/personas/nodes/21_gamer.json +50 -0
- drowse/data/manifolds/personas/nodes/22_furry.json +50 -0
- drowse/data/manifolds/personas/nodes/23_weeaboo.json +50 -0
- drowse/data/manifolds/personas/nodes/24_influencer.json +50 -0
- drowse/data/manifolds/personas/nodes/25_stoner.json +50 -0
- drowse/data/manifolds/personas/nodes/26_femboy.json +50 -0
- drowse/data/manifolds/personas/nodes/27_ceo.json +50 -0
- drowse/data/manifolds/personas/nodes/28_emperor.json +50 -0
- drowse/data/manifolds/personas/nodes/29_president.json +50 -0
- drowse/data/manifolds/personas/nodes/30_diplomat.json +50 -0
- drowse/data/manifolds/personas/nodes/31_judge.json +50 -0
- drowse/data/manifolds/personas/nodes/32_bureaucrat.json +50 -0
- drowse/data/manifolds/personas/nodes/33_conservative.json +50 -0
- drowse/data/manifolds/personas/nodes/34_liberal.json +50 -0
- drowse/data/manifolds/personas/nodes/35_libertarian.json +50 -0
- drowse/data/manifolds/personas/nodes/36_communist.json +50 -0
- drowse/data/manifolds/personas/nodes/37_anarchist.json +50 -0
- drowse/data/manifolds/personas/nodes/38_reactionary.json +50 -0
- drowse/data/manifolds/personas/nodes/39_loner.json +50 -0
- drowse/data/manifolds/personas/nodes/40_friend.json +50 -0
- drowse/data/manifolds/personas/nodes/41_rival.json +50 -0
- drowse/data/manifolds/personas/nodes/42_stranger.json +50 -0
- drowse/data/manifolds/personas/nodes/43_lover.json +50 -0
- drowse/data/manifolds/personas/nodes/44_stalker.json +50 -0
- drowse/data/manifolds/personas/nodes/45_lunatic.json +50 -0
- drowse/data/manifolds/personas/nodes/46_paranoid.json +50 -0
- drowse/data/manifolds/personas/nodes/47_detective.json +50 -0
- drowse/data/manifolds/personas/nodes/48_therapist.json +50 -0
- drowse/data/manifolds/personas/nodes/49_nomad.json +50 -0
- drowse/data/manifolds/personas/nodes/50_pirate.json +50 -0
- drowse/data/manifolds/personas/nodes/51_child.json +50 -0
- drowse/data/manifolds/personas/nodes/52_caveman.json +50 -0
- drowse/data/manifolds/personas/nodes/53_monk.json +50 -0
- drowse/data/manifolds/personas/nodes/54_knight.json +50 -0
- drowse/data/manifolds/personas/nodes/55_alchemist.json +50 -0
- drowse/data/manifolds/personas/nodes/56_blacksmith.json +50 -0
- drowse/data/manifolds/personas/nodes/57_viking.json +50 -0
- drowse/data/manifolds/personas/nodes/58_druid.json +50 -0
- drowse/data/manifolds/personas/nodes/59_poet.json +50 -0
- drowse/data/manifolds/personas/nodes/60_novelist.json +50 -0
- drowse/data/manifolds/personas/nodes/61_jester.json +50 -0
- drowse/data/manifolds/personas/nodes/62_philosopher.json +50 -0
- drowse/data/manifolds/personas/nodes/63_painter.json +50 -0
- drowse/data/manifolds/personas/nodes/64_musician.json +50 -0
- drowse/data/manifolds/personas/nodes/65_oracle.json +50 -0
- drowse/data/manifolds/personas/nodes/66_god.json +50 -0
- drowse/data/manifolds/personas/nodes/67_angel.json +50 -0
- drowse/data/manifolds/personas/nodes/68_prophet.json +50 -0
- drowse/data/manifolds/personas/nodes/69_saint.json +50 -0
- drowse/data/manifolds/personas/nodes/70_ghost.json +50 -0
- drowse/data/manifolds/personas/nodes/71_phoenix.json +50 -0
- drowse/data/manifolds/personas/nodes/72_witch.json +50 -0
- drowse/data/manifolds/personas/nodes/73_vampire.json +50 -0
- drowse/data/manifolds/personas/nodes/74_mermaid.json +50 -0
- drowse/data/manifolds/personas/nodes/75_sphinx.json +50 -0
- drowse/data/manifolds/personas/nodes/76_banshee.json +50 -0
- drowse/data/manifolds/personas/nodes/77_golem.json +50 -0
- drowse/data/manifolds/personas/nodes/78_deer.json +50 -0
- drowse/data/manifolds/personas/nodes/79_wolf.json +50 -0
- drowse/data/manifolds/personas/nodes/80_raven.json +50 -0
- drowse/data/manifolds/personas/nodes/81_serpent.json +50 -0
- drowse/data/manifolds/personas/nodes/82_lion.json +50 -0
- drowse/data/manifolds/personas/nodes/83_tree.json +50 -0
- drowse/data/manifolds/personas/nodes/84_river.json +50 -0
- drowse/data/manifolds/personas/nodes/85_storm.json +50 -0
- drowse/data/manifolds/personas/nodes/86_flame.json +50 -0
- drowse/data/manifolds/personas/nodes/87_mirror.json +50 -0
- drowse/data/manifolds/personas/nodes/88_clock.json +50 -0
- drowse/data/manifolds/personas/nodes/89_computer.json +50 -0
- drowse/data/manifolds/personas/nodes/90_robot.json +50 -0
- drowse/data/manifolds/personas/nodes/91_cyborg.json +50 -0
- drowse/data/manifolds/personas/nodes/92_drone.json +50 -0
- drowse/data/manifolds/personas/nodes/93_mecha.json +50 -0
- drowse/data/manifolds/personas/nodes/94_alien.json +50 -0
- drowse/data/manifolds/personas/nodes/95_trickster.json +50 -0
- drowse/data/manifolds/personas/nodes/96_virus.json +50 -0
- drowse/data/manifolds/personas/nodes/97_spy.json +50 -0
- drowse/data/manifolds/personas/nodes/98_narcissist.json +50 -0
- drowse/data/manifolds/personas/nodes/99_demon.json +50 -0
- drowse/data/manifolds/refusing.compliant/manifold.json +28 -0
- drowse/data/manifolds/refusing.compliant/nodes/00_refusing.json +50 -0
- drowse/data/manifolds/refusing.compliant/nodes/01_compliant.json +50 -0
- drowse/data/manifolds/religious.secular/manifold.json +28 -0
- drowse/data/manifolds/religious.secular/nodes/00_religious.json +50 -0
- drowse/data/manifolds/religious.secular/nodes/01_secular.json +50 -0
- drowse/data/manifolds/sincere.manipulative/manifold.json +28 -0
- drowse/data/manifolds/sincere.manipulative/nodes/00_sincere.json +50 -0
- drowse/data/manifolds/sincere.manipulative/nodes/01_manipulative.json +50 -0
- drowse/data/manifolds/sycophantic.blunt/manifold.json +28 -0
- drowse/data/manifolds/sycophantic.blunt/nodes/00_sycophantic.json +50 -0
- drowse/data/manifolds/sycophantic.blunt/nodes/01_blunt.json +50 -0
- drowse/data/manifolds/technical.accessible/manifold.json +28 -0
- drowse/data/manifolds/technical.accessible/nodes/00_technical.json +50 -0
- drowse/data/manifolds/technical.accessible/nodes/01_accessible.json +50 -0
- drowse/data/manifolds/traditional.progressive/manifold.json +28 -0
- drowse/data/manifolds/traditional.progressive/nodes/00_traditional.json +50 -0
- drowse/data/manifolds/traditional.progressive/nodes/01_progressive.json +50 -0
- drowse/data/manifolds/verbose.concise/manifold.json +28 -0
- drowse/data/manifolds/verbose.concise/nodes/00_verbose.json +50 -0
- drowse/data/manifolds/verbose.concise/nodes/01_concise.json +50 -0
- drowse/data/manifolds/warm.clinical/manifold.json +28 -0
- drowse/data/manifolds/warm.clinical/nodes/00_warm.json +50 -0
- drowse/data/manifolds/warm.clinical/nodes/01_clinical.json +50 -0
- drowse/data/neutral_statements.json +98 -0
- drowse/io/__init__.py +1 -0
- drowse/io/alignment.py +1334 -0
- drowse/io/atomic.py +278 -0
- drowse/io/bake.py +558 -0
- drowse/io/bootstrap.py +73 -0
- drowse/io/brand_migration.py +48 -0
- drowse/io/drowse_archive.py +1830 -0
- drowse/io/gguf_io.py +300 -0
- drowse/io/hf.py +81 -0
- drowse/io/hf_manifolds.py +931 -0
- drowse/io/integrity.py +102 -0
- drowse/io/lens.py +1992 -0
- drowse/io/lens_sources.py +1003 -0
- drowse/io/manifold_authoring.py +1348 -0
- drowse/io/manifold_folder.py +1854 -0
- drowse/io/manifold_lifecycle.py +1253 -0
- drowse/io/manifold_tensors.py +727 -0
- drowse/io/manifolds.py +443 -0
- drowse/io/paths.py +289 -0
- drowse/io/probes_bootstrap.py +58 -0
- drowse/io/sae.py +382 -0
- drowse/io/sae_artifacts.py +318 -0
- drowse/io/selectors.py +503 -0
- drowse/io/shards.py +160 -0
- drowse/io/source_registry.py +138 -0
- drowse/io/staging.py +80 -0
- drowse/io/templates.py +707 -0
- drowse/notebook/__init__.py +38 -0
- drowse/notebook/data.py +99 -0
- drowse/notebook/plots.py +352 -0
- drowse/py.typed +0 -0
- drowse/server/__init__.py +20 -0
- drowse/server/app.py +987 -0
- drowse/server/background_job.py +246 -0
- drowse/server/instrument_routes.py +1101 -0
- drowse/server/manifold_routes.py +1028 -0
- drowse/server/model_names.py +82 -0
- drowse/server/native_common.py +92 -0
- drowse/server/native_routes.py +45 -0
- drowse/server/ollama.py +817 -0
- drowse/server/operation_ledger.py +187 -0
- drowse/server/probe_routes.py +220 -0
- drowse/server/profile_models.py +52 -0
- drowse/server/profile_routes.py +440 -0
- drowse/server/request_helpers.py +198 -0
- drowse/server/request_ledger.py +85 -0
- drowse/server/response_models.py +814 -0
- drowse/server/session_models.py +146 -0
- drowse/server/session_routes.py +150 -0
- drowse/server/sse.py +333 -0
- drowse/server/streaming.py +129 -0
- drowse/server/template_routes.py +161 -0
- drowse/server/tree_models.py +121 -0
- drowse/server/tree_routes.py +550 -0
- drowse/server/ws_events.py +65 -0
- drowse/server/ws_models.py +219 -0
- drowse/server/ws_stream.py +1205 -0
- drowse/web/__init__.py +22 -0
- drowse/web/dist/LICENSE-Fluent-Icons.txt +21 -0
- drowse/web/dist/LICENSE-Fluent-System-Icons.txt +21 -0
- drowse/web/dist/LICENSE-Martian-Mono.txt +93 -0
- drowse/web/dist/LICENSE-Torph.txt +21 -0
- drowse/web/dist/LICENSE-Wix-Madefor.txt +93 -0
- drowse/web/dist/assets/App-BewwoFwv.js +33 -0
- drowse/web/dist/assets/App.css +1 -0
- drowse/web/dist/assets/MartianMono-cyrillic-ext.woff2 +0 -0
- drowse/web/dist/assets/MartianMono-cyrillic.woff2 +0 -0
- drowse/web/dist/assets/MartianMono-latin-ext.woff2 +0 -0
- drowse/web/dist/assets/MartianMono-latin.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforDisplay-cyrillic.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforDisplay-latin-ext.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforDisplay-latin.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforDisplay-vietnamese.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-italic-latin-ext.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-italic-latin.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-normal-cyrillic.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-normal-latin-ext.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-normal-latin.woff2 +0 -0
- drowse/web/dist/assets/WixMadeforText-normal-vietnamese.woff2 +0 -0
- drowse/web/dist/assets/ab.svelte-CbVGAYXo.js +1 -0
- drowse/web/dist/assets/artifactUpdates-Cjeu6LJc.js +1 -0
- drowse/web/dist/assets/artifactUpdates-DfAoYC9j.js +1 -0
- drowse/web/dist/assets/chat.svelte-DxKufn9g.js +1 -0
- drowse/web/dist/assets/drawers-BDWC0hIN.js +123 -0
- drowse/web/dist/assets/drawers.css +1 -0
- drowse/web/dist/assets/drowse.js +7 -0
- drowse/web/dist/assets/eleutherai.png +0 -0
- drowse/web/dist/assets/errors-Dvb10QW_.js +2 -0
- drowse/web/dist/assets/expression-4yISdAdq.js +1 -0
- drowse/web/dist/assets/files-CvRivkey.js +1 -0
- drowse/web/dist/assets/files-JhDJVgD_.js +1 -0
- drowse/web/dist/assets/fittingCancellation-D72BZWPZ.js +1 -0
- drowse/web/dist/assets/gemma-3-1b-it.json +1 -0
- drowse/web/dist/assets/gemma-3-270m-it.json +1 -0
- drowse/web/dist/assets/gemma-3-4b-it.json +1 -0
- drowse/web/dist/assets/generation-DbkBAhP_.js +1 -0
- drowse/web/dist/assets/index-client-2OdH6IQp.js +3 -0
- drowse/web/dist/assets/index-client-D4S4PooY.js +1 -0
- drowse/web/dist/assets/index.css +1 -0
- drowse/web/dist/assets/instrumentAuthoring.svelte-Csh7NOGX.js +1 -0
- drowse/web/dist/assets/instrumentAuthoring.svelte-w9YPcDsP.js +1 -0
- drowse/web/dist/assets/instruments.svelte-XnEUQA6B.js +1 -0
- drowse/web/dist/assets/localData-DIBDM_zo.js +1 -0
- drowse/web/dist/assets/loom.svelte-D_YyqHHK.js +1 -0
- drowse/web/dist/assets/manifoldJobs.svelte-9f5hs_J7.js +1 -0
- drowse/web/dist/assets/manifoldJobs.svelte-Bwo2GYOH.js +1 -0
- drowse/web/dist/assets/openai.png +0 -0
- drowse/web/dist/assets/preload-helper-BLdHbfdN.js +1 -0
- drowse/web/dist/assets/probes.svelte-COcN1Rh8.js +1 -0
- drowse/web/dist/assets/registry-B0_pJoMg.js +1 -0
- drowse/web/dist/assets/registry-CQv71XNh.js +1 -0
- drowse/web/dist/assets/sampling.svelte-BU0kED3k.js +1 -0
- drowse/web/dist/assets/samplingCapabilities-DM6eoDoc.js +1 -0
- drowse/web/dist/assets/savedConversations.svelte-BsBLc-p7.js +1 -0
- drowse/web/dist/assets/savedConversations.svelte-TuSes9Kg.js +1 -0
- drowse/web/dist/assets/selectors-BxXnPPN_.js +1 -0
- drowse/web/dist/assets/serviceTools-CG0q1Xqg.js +2 -0
- drowse/web/dist/assets/session.svelte-D2STLuP6.js +1 -0
- drowse/web/dist/assets/steering.svelte-DvFT3O-d.js +1 -0
- drowse/web/dist/assets/steeringPositions-Dr0JOFu7.js +1 -0
- drowse/web/dist/assets/templates-Bkq2x5ID.js +1 -0
- drowse/web/dist/assets/types-CuMUbvHW.js +1 -0
- drowse/web/dist/assets/validation-5wgTuS7k.js +1 -0
- drowse/web/dist/assets/webmcp-DyqJf4z6.js +2 -0
- drowse/web/dist/assets/workspaceController-C2L33e3m.js +1 -0
- drowse/web/dist/assets/workspaceController-DJhXD_BC.js +1 -0
- drowse/web/dist/assets/workspaceTools-BWdmXopx.js +2 -0
- drowse/web/dist/favicon.ico +0 -0
- drowse/web/dist/favicon.svg +1 -0
- drowse/web/dist/icons/apple-touch-icon.png +0 -0
- drowse/web/dist/icons/drowse-192.png +0 -0
- drowse/web/dist/icons/drowse-512.png +0 -0
- drowse/web/dist/icons/drowse-maskable-512.png +0 -0
- drowse/web/dist/icons/tab-analyzing-0.png +0 -0
- drowse/web/dist/icons/tab-analyzing-1.png +0 -0
- drowse/web/dist/icons/tab-analyzing-2.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-0.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-1.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-10.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-11.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-12.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-13.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-14.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-15.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-16.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-17.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-18.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-19.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-2.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-20.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-21.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-22.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-23.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-24.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-25.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-26.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-27.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-28.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-29.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-3.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-30.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-31.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-32.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-33.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-34.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-35.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-36.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-37.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-38.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-39.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-4.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-40.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-41.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-42.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-43.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-44.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-45.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-46.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-47.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-5.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-6.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-7.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-8.png +0 -0
- drowse/web/dist/icons/tab-analyzing-dark-9.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-0.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-1.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-10.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-11.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-12.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-13.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-14.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-15.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-16.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-17.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-18.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-19.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-2.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-20.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-21.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-22.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-23.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-24.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-25.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-26.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-27.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-28.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-29.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-3.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-30.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-31.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-32.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-33.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-34.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-35.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-36.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-37.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-38.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-39.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-4.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-40.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-41.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-42.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-43.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-44.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-45.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-46.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-47.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-5.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-6.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-7.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-8.png +0 -0
- drowse/web/dist/icons/tab-analyzing-light-9.png +0 -0
- drowse/web/dist/icons/tab-chat-settings-dark.png +0 -0
- drowse/web/dist/icons/tab-chat-settings-light.png +0 -0
- drowse/web/dist/icons/tab-chat-settings.png +0 -0
- drowse/web/dist/icons/tab-chats-dark.png +0 -0
- drowse/web/dist/icons/tab-chats-light.png +0 -0
- drowse/web/dist/icons/tab-chats.png +0 -0
- drowse/web/dist/icons/tab-checking-0.png +0 -0
- drowse/web/dist/icons/tab-checking-1.png +0 -0
- drowse/web/dist/icons/tab-checking-2.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-0.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-1.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-10.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-11.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-12.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-13.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-14.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-15.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-16.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-17.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-18.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-19.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-2.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-20.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-21.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-22.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-23.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-24.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-25.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-26.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-27.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-28.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-29.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-3.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-30.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-31.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-32.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-33.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-34.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-35.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-36.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-37.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-38.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-39.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-4.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-40.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-41.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-42.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-43.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-44.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-45.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-46.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-47.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-5.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-6.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-7.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-8.png +0 -0
- drowse/web/dist/icons/tab-checking-dark-9.png +0 -0
- drowse/web/dist/icons/tab-checking-light-0.png +0 -0
- drowse/web/dist/icons/tab-checking-light-1.png +0 -0
- drowse/web/dist/icons/tab-checking-light-10.png +0 -0
- drowse/web/dist/icons/tab-checking-light-11.png +0 -0
- drowse/web/dist/icons/tab-checking-light-12.png +0 -0
- drowse/web/dist/icons/tab-checking-light-13.png +0 -0
- drowse/web/dist/icons/tab-checking-light-14.png +0 -0
- drowse/web/dist/icons/tab-checking-light-15.png +0 -0
- drowse/web/dist/icons/tab-checking-light-16.png +0 -0
- drowse/web/dist/icons/tab-checking-light-17.png +0 -0
- drowse/web/dist/icons/tab-checking-light-18.png +0 -0
- drowse/web/dist/icons/tab-checking-light-19.png +0 -0
- drowse/web/dist/icons/tab-checking-light-2.png +0 -0
- drowse/web/dist/icons/tab-checking-light-20.png +0 -0
- drowse/web/dist/icons/tab-checking-light-21.png +0 -0
- drowse/web/dist/icons/tab-checking-light-22.png +0 -0
- drowse/web/dist/icons/tab-checking-light-23.png +0 -0
- drowse/web/dist/icons/tab-checking-light-24.png +0 -0
- drowse/web/dist/icons/tab-checking-light-25.png +0 -0
- drowse/web/dist/icons/tab-checking-light-26.png +0 -0
- drowse/web/dist/icons/tab-checking-light-27.png +0 -0
- drowse/web/dist/icons/tab-checking-light-28.png +0 -0
- drowse/web/dist/icons/tab-checking-light-29.png +0 -0
- drowse/web/dist/icons/tab-checking-light-3.png +0 -0
- drowse/web/dist/icons/tab-checking-light-30.png +0 -0
- drowse/web/dist/icons/tab-checking-light-31.png +0 -0
- drowse/web/dist/icons/tab-checking-light-32.png +0 -0
- drowse/web/dist/icons/tab-checking-light-33.png +0 -0
- drowse/web/dist/icons/tab-checking-light-34.png +0 -0
- drowse/web/dist/icons/tab-checking-light-35.png +0 -0
- drowse/web/dist/icons/tab-checking-light-36.png +0 -0
- drowse/web/dist/icons/tab-checking-light-37.png +0 -0
- drowse/web/dist/icons/tab-checking-light-38.png +0 -0
- drowse/web/dist/icons/tab-checking-light-39.png +0 -0
- drowse/web/dist/icons/tab-checking-light-4.png +0 -0
- drowse/web/dist/icons/tab-checking-light-40.png +0 -0
- drowse/web/dist/icons/tab-checking-light-41.png +0 -0
- drowse/web/dist/icons/tab-checking-light-42.png +0 -0
- drowse/web/dist/icons/tab-checking-light-43.png +0 -0
- drowse/web/dist/icons/tab-checking-light-44.png +0 -0
- drowse/web/dist/icons/tab-checking-light-45.png +0 -0
- drowse/web/dist/icons/tab-checking-light-46.png +0 -0
- drowse/web/dist/icons/tab-checking-light-47.png +0 -0
- drowse/web/dist/icons/tab-checking-light-5.png +0 -0
- drowse/web/dist/icons/tab-checking-light-6.png +0 -0
- drowse/web/dist/icons/tab-checking-light-7.png +0 -0
- drowse/web/dist/icons/tab-checking-light-8.png +0 -0
- drowse/web/dist/icons/tab-checking-light-9.png +0 -0
- drowse/web/dist/icons/tab-comparison-dark.png +0 -0
- drowse/web/dist/icons/tab-comparison-light.png +0 -0
- drowse/web/dist/icons/tab-comparison.png +0 -0
- drowse/web/dist/icons/tab-controls-dark.png +0 -0
- drowse/web/dist/icons/tab-controls-light.png +0 -0
- drowse/web/dist/icons/tab-controls.png +0 -0
- drowse/web/dist/icons/tab-conversation-dark.png +0 -0
- drowse/web/dist/icons/tab-conversation-light.png +0 -0
- drowse/web/dist/icons/tab-conversation.png +0 -0
- drowse/web/dist/icons/tab-credits-dark.png +0 -0
- drowse/web/dist/icons/tab-credits-light.png +0 -0
- drowse/web/dist/icons/tab-credits.png +0 -0
- drowse/web/dist/icons/tab-downloading-0.png +0 -0
- drowse/web/dist/icons/tab-downloading-1.png +0 -0
- drowse/web/dist/icons/tab-downloading-2.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-0.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-1.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-10.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-11.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-12.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-13.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-14.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-15.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-16.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-17.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-18.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-19.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-2.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-20.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-21.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-22.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-23.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-24.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-25.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-26.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-27.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-28.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-29.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-3.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-30.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-31.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-32.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-33.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-34.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-35.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-36.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-37.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-38.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-39.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-4.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-40.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-41.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-42.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-43.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-44.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-45.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-46.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-47.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-5.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-6.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-7.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-8.png +0 -0
- drowse/web/dist/icons/tab-downloading-dark-9.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-0.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-1.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-10.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-11.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-12.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-13.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-14.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-15.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-16.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-17.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-18.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-19.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-2.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-20.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-21.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-22.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-23.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-24.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-25.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-26.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-27.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-28.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-29.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-3.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-30.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-31.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-32.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-33.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-34.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-35.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-36.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-37.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-38.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-39.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-4.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-40.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-41.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-42.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-43.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-44.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-45.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-46.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-47.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-5.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-6.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-7.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-8.png +0 -0
- drowse/web/dist/icons/tab-downloading-light-9.png +0 -0
- drowse/web/dist/icons/tab-error-dark.png +0 -0
- drowse/web/dist/icons/tab-error-light.png +0 -0
- drowse/web/dist/icons/tab-error.png +0 -0
- drowse/web/dist/icons/tab-home-dark.png +0 -0
- drowse/web/dist/icons/tab-home-light.png +0 -0
- drowse/web/dist/icons/tab-home.png +0 -0
- drowse/web/dist/icons/tab-loading-0.png +0 -0
- drowse/web/dist/icons/tab-loading-1.png +0 -0
- drowse/web/dist/icons/tab-loading-2.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-0.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-1.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-10.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-11.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-12.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-13.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-14.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-15.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-16.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-17.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-18.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-19.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-2.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-20.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-21.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-22.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-23.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-24.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-25.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-26.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-27.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-28.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-29.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-3.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-30.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-31.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-32.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-33.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-34.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-35.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-36.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-37.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-38.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-39.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-4.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-40.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-41.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-42.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-43.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-44.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-45.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-46.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-47.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-5.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-6.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-7.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-8.png +0 -0
- drowse/web/dist/icons/tab-loading-dark-9.png +0 -0
- drowse/web/dist/icons/tab-loading-light-0.png +0 -0
- drowse/web/dist/icons/tab-loading-light-1.png +0 -0
- drowse/web/dist/icons/tab-loading-light-10.png +0 -0
- drowse/web/dist/icons/tab-loading-light-11.png +0 -0
- drowse/web/dist/icons/tab-loading-light-12.png +0 -0
- drowse/web/dist/icons/tab-loading-light-13.png +0 -0
- drowse/web/dist/icons/tab-loading-light-14.png +0 -0
- drowse/web/dist/icons/tab-loading-light-15.png +0 -0
- drowse/web/dist/icons/tab-loading-light-16.png +0 -0
- drowse/web/dist/icons/tab-loading-light-17.png +0 -0
- drowse/web/dist/icons/tab-loading-light-18.png +0 -0
- drowse/web/dist/icons/tab-loading-light-19.png +0 -0
- drowse/web/dist/icons/tab-loading-light-2.png +0 -0
- drowse/web/dist/icons/tab-loading-light-20.png +0 -0
- drowse/web/dist/icons/tab-loading-light-21.png +0 -0
- drowse/web/dist/icons/tab-loading-light-22.png +0 -0
- drowse/web/dist/icons/tab-loading-light-23.png +0 -0
- drowse/web/dist/icons/tab-loading-light-24.png +0 -0
- drowse/web/dist/icons/tab-loading-light-25.png +0 -0
- drowse/web/dist/icons/tab-loading-light-26.png +0 -0
- drowse/web/dist/icons/tab-loading-light-27.png +0 -0
- drowse/web/dist/icons/tab-loading-light-28.png +0 -0
- drowse/web/dist/icons/tab-loading-light-29.png +0 -0
- drowse/web/dist/icons/tab-loading-light-3.png +0 -0
- drowse/web/dist/icons/tab-loading-light-30.png +0 -0
- drowse/web/dist/icons/tab-loading-light-31.png +0 -0
- drowse/web/dist/icons/tab-loading-light-32.png +0 -0
- drowse/web/dist/icons/tab-loading-light-33.png +0 -0
- drowse/web/dist/icons/tab-loading-light-34.png +0 -0
- drowse/web/dist/icons/tab-loading-light-35.png +0 -0
- drowse/web/dist/icons/tab-loading-light-36.png +0 -0
- drowse/web/dist/icons/tab-loading-light-37.png +0 -0
- drowse/web/dist/icons/tab-loading-light-38.png +0 -0
- drowse/web/dist/icons/tab-loading-light-39.png +0 -0
- drowse/web/dist/icons/tab-loading-light-4.png +0 -0
- drowse/web/dist/icons/tab-loading-light-40.png +0 -0
- drowse/web/dist/icons/tab-loading-light-41.png +0 -0
- drowse/web/dist/icons/tab-loading-light-42.png +0 -0
- drowse/web/dist/icons/tab-loading-light-43.png +0 -0
- drowse/web/dist/icons/tab-loading-light-44.png +0 -0
- drowse/web/dist/icons/tab-loading-light-45.png +0 -0
- drowse/web/dist/icons/tab-loading-light-46.png +0 -0
- drowse/web/dist/icons/tab-loading-light-47.png +0 -0
- drowse/web/dist/icons/tab-loading-light-5.png +0 -0
- drowse/web/dist/icons/tab-loading-light-6.png +0 -0
- drowse/web/dist/icons/tab-loading-light-7.png +0 -0
- drowse/web/dist/icons/tab-loading-light-8.png +0 -0
- drowse/web/dist/icons/tab-loading-light-9.png +0 -0
- drowse/web/dist/icons/tab-loom-dark.png +0 -0
- drowse/web/dist/icons/tab-loom-light.png +0 -0
- drowse/web/dist/icons/tab-loom-working-0.png +0 -0
- drowse/web/dist/icons/tab-loom-working-1.png +0 -0
- drowse/web/dist/icons/tab-loom-working-2.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-0.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-1.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-10.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-11.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-12.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-13.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-14.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-15.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-16.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-17.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-18.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-19.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-2.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-20.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-21.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-22.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-23.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-24.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-25.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-26.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-27.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-28.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-29.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-3.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-30.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-31.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-32.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-33.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-34.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-35.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-36.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-37.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-38.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-39.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-4.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-40.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-41.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-42.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-43.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-44.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-45.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-46.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-47.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-5.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-6.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-7.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-8.png +0 -0
- drowse/web/dist/icons/tab-loom-working-dark-9.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-0.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-1.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-10.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-11.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-12.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-13.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-14.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-15.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-16.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-17.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-18.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-19.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-2.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-20.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-21.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-22.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-23.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-24.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-25.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-26.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-27.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-28.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-29.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-3.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-30.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-31.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-32.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-33.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-34.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-35.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-36.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-37.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-38.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-39.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-4.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-40.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-41.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-42.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-43.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-44.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-45.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-46.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-47.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-5.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-6.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-7.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-8.png +0 -0
- drowse/web/dist/icons/tab-loom-working-light-9.png +0 -0
- drowse/web/dist/icons/tab-loom.png +0 -0
- drowse/web/dist/icons/tab-models-dark.png +0 -0
- drowse/web/dist/icons/tab-models-light.png +0 -0
- drowse/web/dist/icons/tab-models.png +0 -0
- drowse/web/dist/icons/tab-offline-dark.png +0 -0
- drowse/web/dist/icons/tab-offline-light.png +0 -0
- drowse/web/dist/icons/tab-offline.png +0 -0
- drowse/web/dist/icons/tab-paused-dark.png +0 -0
- drowse/web/dist/icons/tab-paused-light.png +0 -0
- drowse/web/dist/icons/tab-paused.png +0 -0
- drowse/web/dist/icons/tab-ready-dark.png +0 -0
- drowse/web/dist/icons/tab-ready-light.png +0 -0
- drowse/web/dist/icons/tab-ready.png +0 -0
- drowse/web/dist/icons/tab-saving-0.png +0 -0
- drowse/web/dist/icons/tab-saving-1.png +0 -0
- drowse/web/dist/icons/tab-saving-2.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-0.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-1.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-10.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-11.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-12.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-13.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-14.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-15.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-16.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-17.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-18.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-19.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-2.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-20.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-21.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-22.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-23.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-24.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-25.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-26.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-27.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-28.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-29.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-3.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-30.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-31.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-32.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-33.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-34.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-35.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-36.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-37.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-38.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-39.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-4.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-40.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-41.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-42.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-43.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-44.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-45.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-46.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-47.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-5.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-6.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-7.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-8.png +0 -0
- drowse/web/dist/icons/tab-saving-dark-9.png +0 -0
- drowse/web/dist/icons/tab-saving-light-0.png +0 -0
- drowse/web/dist/icons/tab-saving-light-1.png +0 -0
- drowse/web/dist/icons/tab-saving-light-10.png +0 -0
- drowse/web/dist/icons/tab-saving-light-11.png +0 -0
- drowse/web/dist/icons/tab-saving-light-12.png +0 -0
- drowse/web/dist/icons/tab-saving-light-13.png +0 -0
- drowse/web/dist/icons/tab-saving-light-14.png +0 -0
- drowse/web/dist/icons/tab-saving-light-15.png +0 -0
- drowse/web/dist/icons/tab-saving-light-16.png +0 -0
- drowse/web/dist/icons/tab-saving-light-17.png +0 -0
- drowse/web/dist/icons/tab-saving-light-18.png +0 -0
- drowse/web/dist/icons/tab-saving-light-19.png +0 -0
- drowse/web/dist/icons/tab-saving-light-2.png +0 -0
- drowse/web/dist/icons/tab-saving-light-20.png +0 -0
- drowse/web/dist/icons/tab-saving-light-21.png +0 -0
- drowse/web/dist/icons/tab-saving-light-22.png +0 -0
- drowse/web/dist/icons/tab-saving-light-23.png +0 -0
- drowse/web/dist/icons/tab-saving-light-24.png +0 -0
- drowse/web/dist/icons/tab-saving-light-25.png +0 -0
- drowse/web/dist/icons/tab-saving-light-26.png +0 -0
- drowse/web/dist/icons/tab-saving-light-27.png +0 -0
- drowse/web/dist/icons/tab-saving-light-28.png +0 -0
- drowse/web/dist/icons/tab-saving-light-29.png +0 -0
- drowse/web/dist/icons/tab-saving-light-3.png +0 -0
- drowse/web/dist/icons/tab-saving-light-30.png +0 -0
- drowse/web/dist/icons/tab-saving-light-31.png +0 -0
- drowse/web/dist/icons/tab-saving-light-32.png +0 -0
- drowse/web/dist/icons/tab-saving-light-33.png +0 -0
- drowse/web/dist/icons/tab-saving-light-34.png +0 -0
- drowse/web/dist/icons/tab-saving-light-35.png +0 -0
- drowse/web/dist/icons/tab-saving-light-36.png +0 -0
- drowse/web/dist/icons/tab-saving-light-37.png +0 -0
- drowse/web/dist/icons/tab-saving-light-38.png +0 -0
- drowse/web/dist/icons/tab-saving-light-39.png +0 -0
- drowse/web/dist/icons/tab-saving-light-4.png +0 -0
- drowse/web/dist/icons/tab-saving-light-40.png +0 -0
- drowse/web/dist/icons/tab-saving-light-41.png +0 -0
- drowse/web/dist/icons/tab-saving-light-42.png +0 -0
- drowse/web/dist/icons/tab-saving-light-43.png +0 -0
- drowse/web/dist/icons/tab-saving-light-44.png +0 -0
- drowse/web/dist/icons/tab-saving-light-45.png +0 -0
- drowse/web/dist/icons/tab-saving-light-46.png +0 -0
- drowse/web/dist/icons/tab-saving-light-47.png +0 -0
- drowse/web/dist/icons/tab-saving-light-5.png +0 -0
- drowse/web/dist/icons/tab-saving-light-6.png +0 -0
- drowse/web/dist/icons/tab-saving-light-7.png +0 -0
- drowse/web/dist/icons/tab-saving-light-8.png +0 -0
- drowse/web/dist/icons/tab-saving-light-9.png +0 -0
- drowse/web/dist/icons/tab-thinking-0.png +0 -0
- drowse/web/dist/icons/tab-thinking-1.png +0 -0
- drowse/web/dist/icons/tab-thinking-2.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-0.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-1.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-10.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-11.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-12.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-13.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-14.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-15.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-16.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-17.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-18.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-19.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-2.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-20.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-21.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-22.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-23.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-24.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-25.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-26.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-27.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-28.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-29.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-3.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-30.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-31.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-32.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-33.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-34.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-35.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-36.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-37.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-38.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-39.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-4.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-40.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-41.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-42.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-43.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-44.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-45.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-46.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-47.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-5.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-6.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-7.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-8.png +0 -0
- drowse/web/dist/icons/tab-thinking-dark-9.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-0.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-1.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-10.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-11.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-12.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-13.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-14.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-15.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-16.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-17.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-18.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-19.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-2.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-20.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-21.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-22.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-23.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-24.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-25.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-26.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-27.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-28.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-29.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-3.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-30.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-31.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-32.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-33.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-34.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-35.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-36.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-37.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-38.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-39.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-4.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-40.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-41.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-42.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-43.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-44.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-45.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-46.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-47.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-5.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-6.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-7.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-8.png +0 -0
- drowse/web/dist/icons/tab-thinking-light-9.png +0 -0
- drowse/web/dist/icons/tab-tokens-dark.png +0 -0
- drowse/web/dist/icons/tab-tokens-light.png +0 -0
- drowse/web/dist/icons/tab-tokens.png +0 -0
- drowse/web/dist/icons/tab-training-0.png +0 -0
- drowse/web/dist/icons/tab-training-1.png +0 -0
- drowse/web/dist/icons/tab-training-2.png +0 -0
- drowse/web/dist/icons/tab-training-dark-0.png +0 -0
- drowse/web/dist/icons/tab-training-dark-1.png +0 -0
- drowse/web/dist/icons/tab-training-dark-10.png +0 -0
- drowse/web/dist/icons/tab-training-dark-11.png +0 -0
- drowse/web/dist/icons/tab-training-dark-12.png +0 -0
- drowse/web/dist/icons/tab-training-dark-13.png +0 -0
- drowse/web/dist/icons/tab-training-dark-14.png +0 -0
- drowse/web/dist/icons/tab-training-dark-15.png +0 -0
- drowse/web/dist/icons/tab-training-dark-16.png +0 -0
- drowse/web/dist/icons/tab-training-dark-17.png +0 -0
- drowse/web/dist/icons/tab-training-dark-18.png +0 -0
- drowse/web/dist/icons/tab-training-dark-19.png +0 -0
- drowse/web/dist/icons/tab-training-dark-2.png +0 -0
- drowse/web/dist/icons/tab-training-dark-20.png +0 -0
- drowse/web/dist/icons/tab-training-dark-21.png +0 -0
- drowse/web/dist/icons/tab-training-dark-22.png +0 -0
- drowse/web/dist/icons/tab-training-dark-23.png +0 -0
- drowse/web/dist/icons/tab-training-dark-24.png +0 -0
- drowse/web/dist/icons/tab-training-dark-25.png +0 -0
- drowse/web/dist/icons/tab-training-dark-26.png +0 -0
- drowse/web/dist/icons/tab-training-dark-27.png +0 -0
- drowse/web/dist/icons/tab-training-dark-28.png +0 -0
- drowse/web/dist/icons/tab-training-dark-29.png +0 -0
- drowse/web/dist/icons/tab-training-dark-3.png +0 -0
- drowse/web/dist/icons/tab-training-dark-30.png +0 -0
- drowse/web/dist/icons/tab-training-dark-31.png +0 -0
- drowse/web/dist/icons/tab-training-dark-32.png +0 -0
- drowse/web/dist/icons/tab-training-dark-33.png +0 -0
- drowse/web/dist/icons/tab-training-dark-34.png +0 -0
- drowse/web/dist/icons/tab-training-dark-35.png +0 -0
- drowse/web/dist/icons/tab-training-dark-36.png +0 -0
- drowse/web/dist/icons/tab-training-dark-37.png +0 -0
- drowse/web/dist/icons/tab-training-dark-38.png +0 -0
- drowse/web/dist/icons/tab-training-dark-39.png +0 -0
- drowse/web/dist/icons/tab-training-dark-4.png +0 -0
- drowse/web/dist/icons/tab-training-dark-40.png +0 -0
- drowse/web/dist/icons/tab-training-dark-41.png +0 -0
- drowse/web/dist/icons/tab-training-dark-42.png +0 -0
- drowse/web/dist/icons/tab-training-dark-43.png +0 -0
- drowse/web/dist/icons/tab-training-dark-44.png +0 -0
- drowse/web/dist/icons/tab-training-dark-45.png +0 -0
- drowse/web/dist/icons/tab-training-dark-46.png +0 -0
- drowse/web/dist/icons/tab-training-dark-47.png +0 -0
- drowse/web/dist/icons/tab-training-dark-5.png +0 -0
- drowse/web/dist/icons/tab-training-dark-6.png +0 -0
- drowse/web/dist/icons/tab-training-dark-7.png +0 -0
- drowse/web/dist/icons/tab-training-dark-8.png +0 -0
- drowse/web/dist/icons/tab-training-dark-9.png +0 -0
- drowse/web/dist/icons/tab-training-light-0.png +0 -0
- drowse/web/dist/icons/tab-training-light-1.png +0 -0
- drowse/web/dist/icons/tab-training-light-10.png +0 -0
- drowse/web/dist/icons/tab-training-light-11.png +0 -0
- drowse/web/dist/icons/tab-training-light-12.png +0 -0
- drowse/web/dist/icons/tab-training-light-13.png +0 -0
- drowse/web/dist/icons/tab-training-light-14.png +0 -0
- drowse/web/dist/icons/tab-training-light-15.png +0 -0
- drowse/web/dist/icons/tab-training-light-16.png +0 -0
- drowse/web/dist/icons/tab-training-light-17.png +0 -0
- drowse/web/dist/icons/tab-training-light-18.png +0 -0
- drowse/web/dist/icons/tab-training-light-19.png +0 -0
- drowse/web/dist/icons/tab-training-light-2.png +0 -0
- drowse/web/dist/icons/tab-training-light-20.png +0 -0
- drowse/web/dist/icons/tab-training-light-21.png +0 -0
- drowse/web/dist/icons/tab-training-light-22.png +0 -0
- drowse/web/dist/icons/tab-training-light-23.png +0 -0
- drowse/web/dist/icons/tab-training-light-24.png +0 -0
- drowse/web/dist/icons/tab-training-light-25.png +0 -0
- drowse/web/dist/icons/tab-training-light-26.png +0 -0
- drowse/web/dist/icons/tab-training-light-27.png +0 -0
- drowse/web/dist/icons/tab-training-light-28.png +0 -0
- drowse/web/dist/icons/tab-training-light-29.png +0 -0
- drowse/web/dist/icons/tab-training-light-3.png +0 -0
- drowse/web/dist/icons/tab-training-light-30.png +0 -0
- drowse/web/dist/icons/tab-training-light-31.png +0 -0
- drowse/web/dist/icons/tab-training-light-32.png +0 -0
- drowse/web/dist/icons/tab-training-light-33.png +0 -0
- drowse/web/dist/icons/tab-training-light-34.png +0 -0
- drowse/web/dist/icons/tab-training-light-35.png +0 -0
- drowse/web/dist/icons/tab-training-light-36.png +0 -0
- drowse/web/dist/icons/tab-training-light-37.png +0 -0
- drowse/web/dist/icons/tab-training-light-38.png +0 -0
- drowse/web/dist/icons/tab-training-light-39.png +0 -0
- drowse/web/dist/icons/tab-training-light-4.png +0 -0
- drowse/web/dist/icons/tab-training-light-40.png +0 -0
- drowse/web/dist/icons/tab-training-light-41.png +0 -0
- drowse/web/dist/icons/tab-training-light-42.png +0 -0
- drowse/web/dist/icons/tab-training-light-43.png +0 -0
- drowse/web/dist/icons/tab-training-light-44.png +0 -0
- drowse/web/dist/icons/tab-training-light-45.png +0 -0
- drowse/web/dist/icons/tab-training-light-46.png +0 -0
- drowse/web/dist/icons/tab-training-light-47.png +0 -0
- drowse/web/dist/icons/tab-training-light-5.png +0 -0
- drowse/web/dist/icons/tab-training-light-6.png +0 -0
- drowse/web/dist/icons/tab-training-light-7.png +0 -0
- drowse/web/dist/icons/tab-training-light-8.png +0 -0
- drowse/web/dist/icons/tab-training-light-9.png +0 -0
- drowse/web/dist/icons/tab-unsupported-dark.png +0 -0
- drowse/web/dist/icons/tab-unsupported-light.png +0 -0
- drowse/web/dist/icons/tab-unsupported.png +0 -0
- drowse/web/dist/icons/tab-working-0.png +0 -0
- drowse/web/dist/icons/tab-working-1.png +0 -0
- drowse/web/dist/icons/tab-working-2.png +0 -0
- drowse/web/dist/icons/tab-working-dark-0.png +0 -0
- drowse/web/dist/icons/tab-working-dark-1.png +0 -0
- drowse/web/dist/icons/tab-working-dark-10.png +0 -0
- drowse/web/dist/icons/tab-working-dark-11.png +0 -0
- drowse/web/dist/icons/tab-working-dark-12.png +0 -0
- drowse/web/dist/icons/tab-working-dark-13.png +0 -0
- drowse/web/dist/icons/tab-working-dark-14.png +0 -0
- drowse/web/dist/icons/tab-working-dark-15.png +0 -0
- drowse/web/dist/icons/tab-working-dark-16.png +0 -0
- drowse/web/dist/icons/tab-working-dark-17.png +0 -0
- drowse/web/dist/icons/tab-working-dark-18.png +0 -0
- drowse/web/dist/icons/tab-working-dark-19.png +0 -0
- drowse/web/dist/icons/tab-working-dark-2.png +0 -0
- drowse/web/dist/icons/tab-working-dark-20.png +0 -0
- drowse/web/dist/icons/tab-working-dark-21.png +0 -0
- drowse/web/dist/icons/tab-working-dark-22.png +0 -0
- drowse/web/dist/icons/tab-working-dark-23.png +0 -0
- drowse/web/dist/icons/tab-working-dark-24.png +0 -0
- drowse/web/dist/icons/tab-working-dark-25.png +0 -0
- drowse/web/dist/icons/tab-working-dark-26.png +0 -0
- drowse/web/dist/icons/tab-working-dark-27.png +0 -0
- drowse/web/dist/icons/tab-working-dark-28.png +0 -0
- drowse/web/dist/icons/tab-working-dark-29.png +0 -0
- drowse/web/dist/icons/tab-working-dark-3.png +0 -0
- drowse/web/dist/icons/tab-working-dark-30.png +0 -0
- drowse/web/dist/icons/tab-working-dark-31.png +0 -0
- drowse/web/dist/icons/tab-working-dark-32.png +0 -0
- drowse/web/dist/icons/tab-working-dark-33.png +0 -0
- drowse/web/dist/icons/tab-working-dark-34.png +0 -0
- drowse/web/dist/icons/tab-working-dark-35.png +0 -0
- drowse/web/dist/icons/tab-working-dark-36.png +0 -0
- drowse/web/dist/icons/tab-working-dark-37.png +0 -0
- drowse/web/dist/icons/tab-working-dark-38.png +0 -0
- drowse/web/dist/icons/tab-working-dark-39.png +0 -0
- drowse/web/dist/icons/tab-working-dark-4.png +0 -0
- drowse/web/dist/icons/tab-working-dark-40.png +0 -0
- drowse/web/dist/icons/tab-working-dark-41.png +0 -0
- drowse/web/dist/icons/tab-working-dark-42.png +0 -0
- drowse/web/dist/icons/tab-working-dark-43.png +0 -0
- drowse/web/dist/icons/tab-working-dark-44.png +0 -0
- drowse/web/dist/icons/tab-working-dark-45.png +0 -0
- drowse/web/dist/icons/tab-working-dark-46.png +0 -0
- drowse/web/dist/icons/tab-working-dark-47.png +0 -0
- drowse/web/dist/icons/tab-working-dark-5.png +0 -0
- drowse/web/dist/icons/tab-working-dark-6.png +0 -0
- drowse/web/dist/icons/tab-working-dark-7.png +0 -0
- drowse/web/dist/icons/tab-working-dark-8.png +0 -0
- drowse/web/dist/icons/tab-working-dark-9.png +0 -0
- drowse/web/dist/icons/tab-working-light-0.png +0 -0
- drowse/web/dist/icons/tab-working-light-1.png +0 -0
- drowse/web/dist/icons/tab-working-light-10.png +0 -0
- drowse/web/dist/icons/tab-working-light-11.png +0 -0
- drowse/web/dist/icons/tab-working-light-12.png +0 -0
- drowse/web/dist/icons/tab-working-light-13.png +0 -0
- drowse/web/dist/icons/tab-working-light-14.png +0 -0
- drowse/web/dist/icons/tab-working-light-15.png +0 -0
- drowse/web/dist/icons/tab-working-light-16.png +0 -0
- drowse/web/dist/icons/tab-working-light-17.png +0 -0
- drowse/web/dist/icons/tab-working-light-18.png +0 -0
- drowse/web/dist/icons/tab-working-light-19.png +0 -0
- drowse/web/dist/icons/tab-working-light-2.png +0 -0
- drowse/web/dist/icons/tab-working-light-20.png +0 -0
- drowse/web/dist/icons/tab-working-light-21.png +0 -0
- drowse/web/dist/icons/tab-working-light-22.png +0 -0
- drowse/web/dist/icons/tab-working-light-23.png +0 -0
- drowse/web/dist/icons/tab-working-light-24.png +0 -0
- drowse/web/dist/icons/tab-working-light-25.png +0 -0
- drowse/web/dist/icons/tab-working-light-26.png +0 -0
- drowse/web/dist/icons/tab-working-light-27.png +0 -0
- drowse/web/dist/icons/tab-working-light-28.png +0 -0
- drowse/web/dist/icons/tab-working-light-29.png +0 -0
- drowse/web/dist/icons/tab-working-light-3.png +0 -0
- drowse/web/dist/icons/tab-working-light-30.png +0 -0
- drowse/web/dist/icons/tab-working-light-31.png +0 -0
- drowse/web/dist/icons/tab-working-light-32.png +0 -0
- drowse/web/dist/icons/tab-working-light-33.png +0 -0
- drowse/web/dist/icons/tab-working-light-34.png +0 -0
- drowse/web/dist/icons/tab-working-light-35.png +0 -0
- drowse/web/dist/icons/tab-working-light-36.png +0 -0
- drowse/web/dist/icons/tab-working-light-37.png +0 -0
- drowse/web/dist/icons/tab-working-light-38.png +0 -0
- drowse/web/dist/icons/tab-working-light-39.png +0 -0
- drowse/web/dist/icons/tab-working-light-4.png +0 -0
- drowse/web/dist/icons/tab-working-light-40.png +0 -0
- drowse/web/dist/icons/tab-working-light-41.png +0 -0
- drowse/web/dist/icons/tab-working-light-42.png +0 -0
- drowse/web/dist/icons/tab-working-light-43.png +0 -0
- drowse/web/dist/icons/tab-working-light-44.png +0 -0
- drowse/web/dist/icons/tab-working-light-45.png +0 -0
- drowse/web/dist/icons/tab-working-light-46.png +0 -0
- drowse/web/dist/icons/tab-working-light-47.png +0 -0
- drowse/web/dist/icons/tab-working-light-5.png +0 -0
- drowse/web/dist/icons/tab-working-light-6.png +0 -0
- drowse/web/dist/icons/tab-working-light-7.png +0 -0
- drowse/web/dist/icons/tab-working-light-8.png +0 -0
- drowse/web/dist/icons/tab-working-light-9.png +0 -0
- drowse/web/dist/index.html +34 -0
- drowse/web/dist/social/drowse.png +0 -0
- drowse/web/dist/social/drowse.svg +6 -0
- drowse/web/dist/theme-init.js +25 -0
- drowse/web/routes.py +118 -0
- drowse_ai-5.3.1.dist-info/METADATA +632 -0
- drowse_ai-5.3.1.dist-info/RECORD +1341 -0
- drowse_ai-5.3.1.dist-info/WHEEL +5 -0
- drowse_ai-5.3.1.dist-info/entry_points.txt +2 -0
- drowse_ai-5.3.1.dist-info/licenses/LICENSE +661 -0
- drowse_ai-5.3.1.dist-info/top_level.txt +1 -0
drowse/core/monitor.py
ADDED
|
@@ -0,0 +1,2060 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections import deque
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import TYPE_CHECKING, Any, cast
|
|
6
|
+
|
|
7
|
+
import torch
|
|
8
|
+
|
|
9
|
+
from drowse.core.instruments.types import parse_gate_ref
|
|
10
|
+
from drowse.core.manifold import (
|
|
11
|
+
BoxDomain, SphereDomain, KleinBottleDomain, ProjectivePlaneDomain,
|
|
12
|
+
invert_parameterization,
|
|
13
|
+
)
|
|
14
|
+
from drowse.core.monitor_attach import (
|
|
15
|
+
DEFAULT_NEAREST_TOP_N,
|
|
16
|
+
NEUTRAL_LABEL,
|
|
17
|
+
_FRACTION_EPSILON,
|
|
18
|
+
_woodbury_apply,
|
|
19
|
+
AttachedManifoldProbe, # re-exported: tests import from drowse.core.monitor
|
|
20
|
+
_build_whitened_factors,
|
|
21
|
+
_attach_manifold_probe,
|
|
22
|
+
_layer_geometry, # re-exported: tests import from drowse.core.monitor
|
|
23
|
+
)
|
|
24
|
+
from drowse.core.results import ProbeReading
|
|
25
|
+
|
|
26
|
+
if TYPE_CHECKING:
|
|
27
|
+
from drowse.core.manifold import Manifold
|
|
28
|
+
|
|
29
|
+
_MAX_HISTORY = 8
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _mean_coordinate_space(domain: Any, coords: torch.Tensor) -> torch.Tensor:
|
|
33
|
+
if isinstance(domain, (SphereDomain, KleinBottleDomain, ProjectivePlaneDomain)) or (
|
|
34
|
+
isinstance(domain, BoxDomain) and any(axis.periodic for axis in domain.axes)
|
|
35
|
+
):
|
|
36
|
+
return domain.embed(coords)
|
|
37
|
+
return coords
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _mean_domain_coordinates(
|
|
41
|
+
domain: Any, mean: torch.Tensor, reference: torch.Tensor,
|
|
42
|
+
) -> torch.Tensor:
|
|
43
|
+
if isinstance(domain, (KleinBottleDomain, ProjectivePlaneDomain)):
|
|
44
|
+
return domain.project_mean(mean, reference)
|
|
45
|
+
if isinstance(domain, SphereDomain):
|
|
46
|
+
position = domain.clamp_position(domain._unembed(mean))
|
|
47
|
+
return torch.where(torch.linalg.vector_norm(mean) < 1e-6, reference, position)
|
|
48
|
+
if not isinstance(domain, BoxDomain) or not any(axis.periodic for axis in domain.axes):
|
|
49
|
+
return mean
|
|
50
|
+
parts = []
|
|
51
|
+
offset = 0
|
|
52
|
+
for axis, spec in enumerate(domain.axes):
|
|
53
|
+
if spec.periodic:
|
|
54
|
+
cosine, sine = mean[offset], mean[offset + 1]
|
|
55
|
+
position = torch.remainder(torch.atan2(sine, cosine) * spec.period / (2 * torch.pi), spec.period)
|
|
56
|
+
parts.append(torch.where(torch.hypot(sine, cosine) < 1e-6, reference[axis], position))
|
|
57
|
+
offset += 2
|
|
58
|
+
else:
|
|
59
|
+
parts.append(mean[offset])
|
|
60
|
+
offset += 1
|
|
61
|
+
return torch.stack(parts)
|
|
62
|
+
|
|
63
|
+
@dataclass(frozen=True, slots=True)
|
|
64
|
+
class _ProbeGateScalarPlan:
|
|
65
|
+
"""Attach/generation-stable parse of the scalar channels a gate consumes."""
|
|
66
|
+
|
|
67
|
+
probe_name: str
|
|
68
|
+
coord_axes: tuple[tuple[int, str], ...] = ()
|
|
69
|
+
fraction_key: str | None = None
|
|
70
|
+
membership_key: str | None = None
|
|
71
|
+
dist_requests: tuple[tuple[str, int], ...] = ()
|
|
72
|
+
assign_requests: tuple[tuple[str, int], ...] = ()
|
|
73
|
+
dist_index: torch.Tensor | None = None
|
|
74
|
+
assign_index: torch.Tensor | None = None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _depth_stats(
|
|
78
|
+
coords_per_layer: dict[int, tuple[float, ...]],
|
|
79
|
+
weights: dict[int, float],
|
|
80
|
+
denom: float,
|
|
81
|
+
) -> tuple[tuple[float, ...], tuple[float, ...]]:
|
|
82
|
+
"""Per-axis depth center of mass (+ std) of a per-layer coordinate trace.
|
|
83
|
+
|
|
84
|
+
Mass per (layer, axis) is ``weight_L · |coord_L[axis]|`` — where in depth
|
|
85
|
+
the probe's signal actually reads, weighted the same way the cross-layer
|
|
86
|
+
aggregate coordinate is (the Mahalanobis share). Depths are
|
|
87
|
+
``layer / denom`` (``denom = n_layers − 1``), so 0 = first block, 1 =
|
|
88
|
+
last. Pure host-side arithmetic over values already transferred — no
|
|
89
|
+
tensor work. Empty tuples when the trace is empty or ``denom`` unset;
|
|
90
|
+
a zero-mass axis (activation at neutral) reports ``(0.0, 0.0)``.
|
|
91
|
+
"""
|
|
92
|
+
if not coords_per_layer or denom <= 0.0:
|
|
93
|
+
return (), ()
|
|
94
|
+
n_dim = max(len(c) for c in coords_per_layer.values())
|
|
95
|
+
coms: list[float] = []
|
|
96
|
+
spreads: list[float] = []
|
|
97
|
+
for axis in range(n_dim):
|
|
98
|
+
total = 0.0
|
|
99
|
+
first_moment = 0.0
|
|
100
|
+
for layer, coords in coords_per_layer.items():
|
|
101
|
+
if axis >= len(coords):
|
|
102
|
+
continue
|
|
103
|
+
m = weights.get(layer, 0.0) * abs(coords[axis])
|
|
104
|
+
total += m
|
|
105
|
+
first_moment += m * (layer / denom)
|
|
106
|
+
if total <= 1e-12:
|
|
107
|
+
coms.append(0.0)
|
|
108
|
+
spreads.append(0.0)
|
|
109
|
+
continue
|
|
110
|
+
com = first_moment / total
|
|
111
|
+
var = 0.0
|
|
112
|
+
for layer, coords in coords_per_layer.items():
|
|
113
|
+
if axis >= len(coords):
|
|
114
|
+
continue
|
|
115
|
+
m = weights.get(layer, 0.0) * abs(coords[axis])
|
|
116
|
+
var += m * ((layer / denom) - com) ** 2
|
|
117
|
+
coms.append(com)
|
|
118
|
+
spreads.append(max(var / total, 0.0) ** 0.5)
|
|
119
|
+
return tuple(coms), tuple(spreads)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class Monitor:
|
|
123
|
+
"""Reads probes as whitened subspace coordinates — flat and curved alike.
|
|
124
|
+
|
|
125
|
+
**One** read shape, two execution paths. Each probe is a
|
|
126
|
+
:class:`~drowse.core.manifold.Manifold`, and every read — live per token
|
|
127
|
+
(gate / stream) and the end-of-generation aggregate — produces one full
|
|
128
|
+
:class:`ProbeReading` (``coords`` + ``fraction`` + ``nearest`` +
|
|
129
|
+
``residual`` plus their ``*_per_layer`` traces), with no flat/curved field
|
|
130
|
+
asymmetry: a flat (affine) probe recovers ``coords`` through the affine
|
|
131
|
+
reduced→domain map (off-surface ``residual`` identically 0), a curved probe
|
|
132
|
+
through the iterative :func:`invert_parameterization` foot solve (real
|
|
133
|
+
off-surface ``residual``). The full per-token information (nearest, curved
|
|
134
|
+
coords, residual, per-layer) is the research-tool priority.
|
|
135
|
+
|
|
136
|
+
Execution is still no-redundancy on the hot path. The whole *flat* roster
|
|
137
|
+
is scored together per layer in :meth:`_score_flat_batched` — one ``Σ⁻¹h``
|
|
138
|
+
Woodbury apply + stacked / block-diagonal matmuls + a **single** host
|
|
139
|
+
transfer for the roster — instead of re-running the apply and the R-dim
|
|
140
|
+
solve per probe per layer. *Curved* probes keep the per-probe foot solve
|
|
141
|
+
(:meth:`_score_probe_full`), warm-started across decode tokens from the
|
|
142
|
+
previous token's foot (:meth:`enable_curved_warm`) on the sequential live
|
|
143
|
+
path. And when nothing consumes a per-token reading (no gate, no stream),
|
|
144
|
+
the session skips per-token scoring entirely and pools the aggregate once
|
|
145
|
+
at finalize — see ``DrowseSession._begin_capture`` /
|
|
146
|
+
:meth:`score_aggregate`.
|
|
147
|
+
|
|
148
|
+
Coordinates are **domain-frame**: each layer's reduced activation
|
|
149
|
+
coordinate is inverted into the shared domain *before* EV-averaging,
|
|
150
|
+
because raw per-layer coords live in per-layer ``‖δ_L‖`` units and don't
|
|
151
|
+
average coherently. At rank-1 this is the pole-normalized coordinate:
|
|
152
|
+
``1.0`` sits at the positive node, signed, unbounded past it.
|
|
153
|
+
|
|
154
|
+
The Mahalanobis whitener is mandatory: every probed layer must be
|
|
155
|
+
covered, built per probe at attach (:func:`_build_whitened_factors`) —
|
|
156
|
+
a missing / non-covering whitener raises :class:`WhitenerError`, there is
|
|
157
|
+
no Euclidean readout (on real LMs the Euclidean metric is rogue-dominated,
|
|
158
|
+
a wrong answer not a degraded one).
|
|
159
|
+
|
|
160
|
+
Full per-axis and per-layer data flows through the
|
|
161
|
+
:class:`ProbeReading` surface.
|
|
162
|
+
"""
|
|
163
|
+
|
|
164
|
+
def __init__(self, probe_manifolds: dict[str, "Manifold"] | None = None,
|
|
165
|
+
whitener: Any = None,
|
|
166
|
+
n_layers: int | None = None):
|
|
167
|
+
"""
|
|
168
|
+
probe_manifolds: maps probe name -> flat :class:`Manifold` (rank-1
|
|
169
|
+
concept axis or rank-R discover fit). Ad-hoc baked directions
|
|
170
|
+
are wrapped into a 1-pole affine manifold by the session before
|
|
171
|
+
registration (``fold_directions_to_subspace``).
|
|
172
|
+
whitener: the :class:`~drowse.core.mahalanobis.LayerWhitener`;
|
|
173
|
+
mandatory at scoring time (covers every probed layer or raise).
|
|
174
|
+
n_layers: the model's block count — the depth axis for the
|
|
175
|
+
``depth_com``/``depth_spread`` reading statistics. ``None``
|
|
176
|
+
(direct-constructed test monitors) leaves them empty.
|
|
177
|
+
|
|
178
|
+
There is no per-layer neutral-mean input: the coordinate readout
|
|
179
|
+
centers on each fit's own ``LayerSubspace.mean``, and the whitener
|
|
180
|
+
carries the neutral statistics the metric needs.
|
|
181
|
+
"""
|
|
182
|
+
self._probes: dict[str, AttachedManifoldProbe] = {}
|
|
183
|
+
self._whitener: Any = whitener
|
|
184
|
+
# Depth denominator for _depth_stats: layer / (n_layers − 1) ∈ [0, 1].
|
|
185
|
+
self._depth_denom: float = (
|
|
186
|
+
float(n_layers - 1) if n_layers is not None and n_layers > 1 else 0.0
|
|
187
|
+
)
|
|
188
|
+
self._whitener_factor_cache: dict[
|
|
189
|
+
tuple[int, str, torch.dtype],
|
|
190
|
+
tuple[torch.Tensor, torch.Tensor, float],
|
|
191
|
+
] = {}
|
|
192
|
+
|
|
193
|
+
# Cross-probe batched flat-read cache (the hot-path no-redundancy
|
|
194
|
+
# primitive). For every *flat* (affine) probe the per-layer geometry
|
|
195
|
+
# is identical algebra (``_layer_geometry``) over a shared activation,
|
|
196
|
+
# so the whole flat roster is scored per layer with one ``Σ⁻¹h`` Woodbury
|
|
197
|
+
# apply + a handful of stacked / block-diagonal matmuls instead of
|
|
198
|
+
# re-running the apply and the R-dim solve once per probe per layer (the
|
|
199
|
+
# 17×-redundant cost that dominated decode once a probe roster was
|
|
200
|
+
# attached). Curved probes keep the per-probe foot solve. Built lazily
|
|
201
|
+
# per (device, roster, whitener); invalidated on any of the three
|
|
202
|
+
# changing. ``_flat_layer_cache[L]`` holds the stacked factors for the
|
|
203
|
+
# flat probes covering layer ``L``; ``_flat_keys`` / ``_curved_keys``
|
|
204
|
+
# split the roster.
|
|
205
|
+
self._flat_layer_cache: dict[int, dict[str, Any]] = {}
|
|
206
|
+
self._flat_global: dict[str, Any] = {}
|
|
207
|
+
self._flat_keys: tuple[str, ...] = ()
|
|
208
|
+
self._curved_keys: tuple[str, ...] = ()
|
|
209
|
+
self._flat_cache_device: torch.device | None = None
|
|
210
|
+
# Dirty flag set by ``_invalidate_flat_cache`` on every roster /
|
|
211
|
+
# whitener mutation. ``_ensure_flat_cache`` checks it instead of
|
|
212
|
+
# rebuilding ``tuple(self._probes.keys())`` + comparing it every token —
|
|
213
|
+
# the cache only changes when a mutation flips this, so the per-token
|
|
214
|
+
# guard is a bool + a device compare, not a per-token tuple alloc.
|
|
215
|
+
self._flat_cache_dirty: bool = True
|
|
216
|
+
|
|
217
|
+
# Per-coordinate history. Rich result payloads use the pooled
|
|
218
|
+
# ``ProbeReading`` directly; scalar UI projections derive from this
|
|
219
|
+
# single history rather than maintaining a parallel summary model.
|
|
220
|
+
self.history: dict[str, deque[tuple[float, ...]]] = {
|
|
221
|
+
n: deque(maxlen=_MAX_HISTORY) for n in self._probes
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
# Curved-probe per-token foot-follow (read-side analogue of the steering
|
|
225
|
+
# foot-follower). When ``_curved_warm`` is set — only the sequential
|
|
226
|
+
# incremental live-scoring path enables it, via ``enable_curved_warm`` —
|
|
227
|
+
# ``_score_probe_full`` seeds each curved probe's ``invert_parameterization``
|
|
228
|
+
# from the previous token's foot (keyed ``(probe_name, layer_idx)``) and
|
|
229
|
+
# stashes the refined foot for the next token, cutting the cold
|
|
230
|
+
# 12-iter/3-restart solve to ``warm_iter`` steps over two restarts. Off
|
|
231
|
+
# by default and for one-off reads (``score_aggregate`` / ``score_hidden``
|
|
232
|
+
# / the non-incremental stream), so those stay bit-for-bit the cold path.
|
|
233
|
+
self._curved_feet: dict[tuple[str, int], torch.Tensor] = {}
|
|
234
|
+
self._curved_warm: bool = False
|
|
235
|
+
|
|
236
|
+
# Probe-inspector live trail: when set, every full read also stamps each
|
|
237
|
+
# probe's per-layer whitened query coords (``cdist_query``) onto the
|
|
238
|
+
# ``ProbeReading.subspace_coords_per_layer`` so the dashboard can plot the
|
|
239
|
+
# current hidden state (+ a fading trajectory trail) in the same whitened
|
|
240
|
+
# frame as the geometry endpoint's ``node_white``. Off by default — the
|
|
241
|
+
# session flips it on only while a client requests it
|
|
242
|
+
# (``persist_subspace_coords``), so the default hot path never pays the
|
|
243
|
+
# post-pass.
|
|
244
|
+
self._emit_subspace_coords: bool = False
|
|
245
|
+
|
|
246
|
+
if probe_manifolds:
|
|
247
|
+
for _name, _m in probe_manifolds.items():
|
|
248
|
+
self.add_probe(_name, _m)
|
|
249
|
+
|
|
250
|
+
@property
|
|
251
|
+
def probe_names(self) -> list[str]:
|
|
252
|
+
"""Probe names in insertion order."""
|
|
253
|
+
return list(self._probes.keys())
|
|
254
|
+
|
|
255
|
+
@property
|
|
256
|
+
def manifolds(self) -> dict[str, "Manifold"]:
|
|
257
|
+
"""Attached probe manifolds: name -> flat :class:`Manifold`."""
|
|
258
|
+
return {n: p.manifold for n, p in self._probes.items()}
|
|
259
|
+
|
|
260
|
+
def probe_layers(self, names: set[str] | None = None) -> set[int]:
|
|
261
|
+
"""Union of fit-layer indices across attached probes.
|
|
262
|
+
|
|
263
|
+
The capture-widening signal the session uses to retain every layer
|
|
264
|
+
a probe reads. ``names``
|
|
265
|
+
narrows the union for gate-only control calls that do not need a final
|
|
266
|
+
full-roster probe aggregate.
|
|
267
|
+
"""
|
|
268
|
+
out: set[int] = set()
|
|
269
|
+
probes = (
|
|
270
|
+
(p for n, p in self._probes.items() if n in names)
|
|
271
|
+
if names is not None else self._probes.values()
|
|
272
|
+
)
|
|
273
|
+
for probe in probes:
|
|
274
|
+
out.update(probe.manifold.layers.keys())
|
|
275
|
+
return out
|
|
276
|
+
|
|
277
|
+
@property
|
|
278
|
+
def whitener(self) -> Any:
|
|
279
|
+
"""The wired :class:`LayerWhitener` (required for reads)."""
|
|
280
|
+
return self._whitener
|
|
281
|
+
|
|
282
|
+
def set_whitener(self, whitener: Any) -> None:
|
|
283
|
+
"""Wire (or clear) the Mahalanobis whitener and invalidate the cache.
|
|
284
|
+
|
|
285
|
+
Idempotent on the same instance — re-wiring the identical whitener
|
|
286
|
+
is a no-op. Any change flushes the shared Woodbury-factor cache and
|
|
287
|
+
rebuilds each attached probe's per-layer whitened factors against the new
|
|
288
|
+
covariance (manifold reads are Mahalanobis-only, so a whitener that
|
|
289
|
+
doesn't cover an attached probe's fit layers raises here).
|
|
290
|
+
"""
|
|
291
|
+
if whitener is self._whitener:
|
|
292
|
+
return
|
|
293
|
+
self._whitener = whitener
|
|
294
|
+
self._whitener_factor_cache.clear()
|
|
295
|
+
self._invalidate_flat_cache()
|
|
296
|
+
for probe in self._probes.values():
|
|
297
|
+
probe.whitened = _build_whitened_factors(
|
|
298
|
+
whitener, probe, factor_cache=self._whitener_factor_cache,
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
def enable_curved_warm(self, flag: bool) -> None:
|
|
302
|
+
"""Enable/disable curved-probe per-token foot warm-starting.
|
|
303
|
+
|
|
304
|
+
The session flips this on only for the sequential incremental
|
|
305
|
+
live-scoring path (one ``score_single_token`` per decode step) and off
|
|
306
|
+
otherwise, so one-off / out-of-order reads (``score_aggregate``,
|
|
307
|
+
``score_hidden``, the non-incremental per-token stream) stay on the cold
|
|
308
|
+
``invert_parameterization`` path and remain bit-for-bit reproducible.
|
|
309
|
+
"""
|
|
310
|
+
self._curved_warm = bool(flag)
|
|
311
|
+
|
|
312
|
+
def set_subspace_coords(self, flag: bool) -> None:
|
|
313
|
+
"""Enable/disable the probe-inspector live whitened-coords post-pass.
|
|
314
|
+
|
|
315
|
+
Flipped on by the session for the duration of a generation when a client
|
|
316
|
+
sets ``persist_subspace_coords`` (the dashboard inspector being open), and
|
|
317
|
+
reset off at teardown. Gates the only added work in :meth:`_score_full`,
|
|
318
|
+
so with it off the read path is byte-for-byte the legacy path.
|
|
319
|
+
"""
|
|
320
|
+
self._emit_subspace_coords = bool(flag)
|
|
321
|
+
|
|
322
|
+
def reset_curved_feet(self) -> None:
|
|
323
|
+
"""Cold-start every curved probe's per-token foot (call per generation).
|
|
324
|
+
|
|
325
|
+
Peer of ``SteeringManager.reset_manifold_feet`` — the carried foot is
|
|
326
|
+
per-generation state, so a new run must re-seed from the nearest node
|
|
327
|
+
rather than inherit the previous run's final foot.
|
|
328
|
+
"""
|
|
329
|
+
self._curved_feet.clear()
|
|
330
|
+
|
|
331
|
+
def _invalidate_flat_cache(self) -> None:
|
|
332
|
+
"""Drop the cross-probe batched flat-read cache.
|
|
333
|
+
|
|
334
|
+
Called whenever the roster, whitener, or scoring device changes — the
|
|
335
|
+
stacked / block-diagonal factors are rebuilt lazily on the next score.
|
|
336
|
+
"""
|
|
337
|
+
self._flat_layer_cache = {}
|
|
338
|
+
self._flat_global = {}
|
|
339
|
+
self._flat_keys = ()
|
|
340
|
+
self._curved_keys = ()
|
|
341
|
+
self._flat_cache_device = None
|
|
342
|
+
self._flat_cache_dirty = True
|
|
343
|
+
|
|
344
|
+
def _score_probe_full(
|
|
345
|
+
self,
|
|
346
|
+
probe: "AttachedManifoldProbe",
|
|
347
|
+
hidden_per_layer: dict[int, torch.Tensor],
|
|
348
|
+
sih_cache: dict[int, torch.Tensor] | None = None,
|
|
349
|
+
*,
|
|
350
|
+
coords_only: bool = False,
|
|
351
|
+
) -> ProbeReading:
|
|
352
|
+
"""Full per-probe reading for one state — flat or curved, all fields.
|
|
353
|
+
|
|
354
|
+
``coords_only``: when a live consumer reads only the axis-0
|
|
355
|
+
coord / fraction, skip the per-token nearest-distance ranking, the soft
|
|
356
|
+
assignment, the off-surface residual / tube membership, and the per-layer
|
|
357
|
+
trace transfer — return a reading carrying just ``coords`` + ``fraction``
|
|
358
|
+
(``nearest``/``assignment`` empty, ``residual`` 0, ``membership`` 1.0).
|
|
359
|
+
The full aggregate is re-scored once at finalize, so nothing is lost.
|
|
360
|
+
|
|
361
|
+
Loops the probe's shared fit layers through :func:`_layer_geometry`
|
|
362
|
+
and **share**-weights across them (the layer carrying the most
|
|
363
|
+
Mahalanobis steering budget is also the most reliable to read from).
|
|
364
|
+
A flat (affine) probe recovers ``coords`` through the affine
|
|
365
|
+
reduced→domain map (off-surface ``residual`` 0); a curved probe
|
|
366
|
+
through the :func:`invert_parameterization` foot solve (real
|
|
367
|
+
off-surface ``residual``). Returns the cross-layer share-weighted
|
|
368
|
+
``coords`` / ``fraction`` / ``nearest`` / ``residual`` plus their
|
|
369
|
+
per-layer traces. This is the single geometry primitive every read
|
|
370
|
+
entry point (live per token, aggregate) shares, so the aggregate at a
|
|
371
|
+
token index is bit-identical to the live read at that token.
|
|
372
|
+
|
|
373
|
+
``sih_cache`` (optional, keyed by layer) shares the probe-independent
|
|
374
|
+
``Σ⁻¹h`` apply across every curved probe in one ``_score_full`` pass; it
|
|
375
|
+
is valid only for the current state, so callers pass a fresh dict per
|
|
376
|
+
token / pool.
|
|
377
|
+
"""
|
|
378
|
+
manifold = probe.manifold
|
|
379
|
+
sw = probe.share_weights
|
|
380
|
+
is_affine = probe.is_affine
|
|
381
|
+
shared = [idx for idx in manifold.layers if idx in hidden_per_layer]
|
|
382
|
+
if not shared:
|
|
383
|
+
return ProbeReading(fraction=0.0, nearest=[], coords=())
|
|
384
|
+
total_w = sum(sw[idx] for idx in shared)
|
|
385
|
+
w_shared = {idx: sw[idx] / total_w for idx in shared}
|
|
386
|
+
|
|
387
|
+
K = probe.node_values_reduced[shared[0]].shape[0]
|
|
388
|
+
inject_neutral = probe.inject_neutral
|
|
389
|
+
Kc = K + (1 if inject_neutral else 0) # candidate count incl. neutral
|
|
390
|
+
n_dim = manifold.domain.intrinsic_dim
|
|
391
|
+
dist_acc_t: torch.Tensor | None = None
|
|
392
|
+
# Per-layer terms + running share-weighted means are accumulated as
|
|
393
|
+
# on-device tensors and pulled to the host in a *single* transfer per
|
|
394
|
+
# probe at the end. The earlier code called ``float(... .item())`` /
|
|
395
|
+
# ``.tolist()`` per layer, which on MPS is one command-buffer stall per
|
|
396
|
+
# layer per probe per token — the dominant decode-loop cost once a probe
|
|
397
|
+
# roster is attached (~31 host syncs/probe × 17 probes ≈ 140 ms/token on
|
|
398
|
+
# an M-series GPU). Keeping everything on device until one batched
|
|
399
|
+
# ``.cpu()`` preserves every field of the full reading (the per-token
|
|
400
|
+
# info priority) at ~1 sync/probe.
|
|
401
|
+
frac_terms: list[torch.Tensor] = [] # each (1,)
|
|
402
|
+
resid_terms: list[torch.Tensor] = [] # each (1,)
|
|
403
|
+
coord_terms: list[torch.Tensor] = [] # each (n_dim,)
|
|
404
|
+
layer_order: list[int] = []
|
|
405
|
+
frac_mean_t: torch.Tensor | None = None # (1,)
|
|
406
|
+
resid_mean_t: torch.Tensor | None = None # (1,)
|
|
407
|
+
coords_mean_t: torch.Tensor | None = None # embedded for periodic domains
|
|
408
|
+
mem_mean_t: torch.Tensor | None = None # (1,) tube-fit membership
|
|
409
|
+
reference_coord = None
|
|
410
|
+
reference_layer = max(shared, key=lambda layer: w_shared[layer])
|
|
411
|
+
|
|
412
|
+
for layer_idx in shared:
|
|
413
|
+
sub = manifold.layers[layer_idx]
|
|
414
|
+
h = hidden_per_layer[layer_idx].to(torch.float32)
|
|
415
|
+
if h.ndim > 1:
|
|
416
|
+
h = h.reshape(-1, h.shape[-1])[-1]
|
|
417
|
+
wh = probe.whitened[layer_idx]
|
|
418
|
+
frac_t, cdist_query, invert_query, _cdist_nodes = _layer_geometry(
|
|
419
|
+
probe, layer_idx, h, sih_cache,
|
|
420
|
+
)
|
|
421
|
+
w = w_shared[layer_idx]
|
|
422
|
+
|
|
423
|
+
if not coords_only:
|
|
424
|
+
# Neutral competes as a virtual candidate at the ``K``-th row of
|
|
425
|
+
# the precomputed ``node_white_aug`` (appended once at attach,
|
|
426
|
+
# never re-``cat``-ed per token): its whitened coord is
|
|
427
|
+
# ``wh.neutral_white`` (0 for an affine fit, the baked origin for
|
|
428
|
+
# a curved one), so the same cdist yields its distance with no
|
|
429
|
+
# special-casing downstream. Skipped entirely under
|
|
430
|
+
# ``coords_only`` — nearest / assignment aren't read.
|
|
431
|
+
dists = torch.linalg.vector_norm(
|
|
432
|
+
wh.node_white_aug - cdist_query.reshape(1, -1), dim=-1,
|
|
433
|
+
)
|
|
434
|
+
weighted_dists = dists * w
|
|
435
|
+
dist_acc_t = (
|
|
436
|
+
weighted_dists
|
|
437
|
+
if dist_acc_t is None
|
|
438
|
+
else dist_acc_t + weighted_dists.to(dist_acc_t.device)
|
|
439
|
+
)
|
|
440
|
+
|
|
441
|
+
if is_affine:
|
|
442
|
+
# Affine map: coords are exact, no off-subspace residual.
|
|
443
|
+
pos_t = (
|
|
444
|
+
wh.coord_S @ invert_query + wh.coord_b
|
|
445
|
+
if wh.coord_S is not None and wh.coord_b is not None
|
|
446
|
+
else invert_query
|
|
447
|
+
)
|
|
448
|
+
resid_t = frac_t.new_zeros(1)
|
|
449
|
+
mem_t = frac_t.new_ones(1) # surface fills subspace ⇒ full fit
|
|
450
|
+
else:
|
|
451
|
+
# Curved probe: warm-start the nearest-point foot from the
|
|
452
|
+
# previous token's foot when the session enabled it for this
|
|
453
|
+
# (sequential) live-scoring pass; otherwise solve cold. The foot
|
|
454
|
+
# solve is needed for ``coords`` regardless, so it always runs;
|
|
455
|
+
# only the residual / membership it feeds are ``coords_only``-gated.
|
|
456
|
+
foot_key = (probe.name, layer_idx)
|
|
457
|
+
warm = self._curved_feet.get(foot_key) if self._curved_warm else None
|
|
458
|
+
pos, res = invert_parameterization(
|
|
459
|
+
sub, manifold.domain, invert_query.reshape(1, -1),
|
|
460
|
+
manifold.node_coords, warm_start=warm,
|
|
461
|
+
)
|
|
462
|
+
if self._curved_warm:
|
|
463
|
+
self._curved_feet[foot_key] = pos.detach()
|
|
464
|
+
pos_t = pos.reshape(-1)
|
|
465
|
+
if coords_only:
|
|
466
|
+
resid_t = frac_t.new_zeros(1)
|
|
467
|
+
mem_t = frac_t.new_ones(1)
|
|
468
|
+
else:
|
|
469
|
+
par_norm = torch.linalg.vector_norm(invert_query)
|
|
470
|
+
res_flat = res.reshape(-1)[:1]
|
|
471
|
+
# norm_residual = res / ‖query‖, or 0 if the query is ~zero —
|
|
472
|
+
# kept as a tensor (no ``.item()``) via a branchless ``where``.
|
|
473
|
+
resid_t = torch.where(
|
|
474
|
+
par_norm < _FRACTION_EPSILON,
|
|
475
|
+
torch.zeros_like(res_flat),
|
|
476
|
+
res_flat / par_norm.clamp(min=_FRACTION_EPSILON),
|
|
477
|
+
)
|
|
478
|
+
# Tube-fit membership ``exp(−res²/2σ²)`` at the foot — both
|
|
479
|
+
# ``res`` and ``σ`` are raw reduced-space (un-whitened)
|
|
480
|
+
# distances, so the ratio is unit-consistent. No σ-field ⇒
|
|
481
|
+
# no tube ⇒ full membership (1.0).
|
|
482
|
+
if sub.has_sigma:
|
|
483
|
+
sig_foot = sub.sigma_at(
|
|
484
|
+
manifold.domain.embed(pos.reshape(1, -1)),
|
|
485
|
+
).reshape(1)
|
|
486
|
+
mem_t = torch.exp(
|
|
487
|
+
-(res_flat ** 2)
|
|
488
|
+
/ (2.0 * (sig_foot ** 2).clamp(min=_FRACTION_EPSILON))
|
|
489
|
+
)
|
|
490
|
+
else:
|
|
491
|
+
mem_t = frac_t.new_ones(1)
|
|
492
|
+
|
|
493
|
+
frac_t = frac_t.reshape(1)
|
|
494
|
+
coord_t = pos_t.reshape(-1)[:n_dim]
|
|
495
|
+
if coord_t.numel() < n_dim:
|
|
496
|
+
coord_t = torch.cat(
|
|
497
|
+
[coord_t, coord_t.new_zeros(n_dim - coord_t.numel())],
|
|
498
|
+
)
|
|
499
|
+
frac_mean_t = (
|
|
500
|
+
w * frac_t if frac_mean_t is None else frac_mean_t + w * frac_t
|
|
501
|
+
)
|
|
502
|
+
if layer_idx == reference_layer:
|
|
503
|
+
reference_coord = coord_t
|
|
504
|
+
mean_coord = _mean_coordinate_space(manifold.domain, coord_t)
|
|
505
|
+
coords_mean_t = (
|
|
506
|
+
w * mean_coord if coords_mean_t is None else coords_mean_t + w * mean_coord
|
|
507
|
+
)
|
|
508
|
+
if coords_only:
|
|
509
|
+
# coords + fraction means are all the lean reading needs; skip
|
|
510
|
+
# the per-layer trace lists + residual / membership means.
|
|
511
|
+
continue
|
|
512
|
+
resid_t = resid_t.reshape(1)
|
|
513
|
+
mem_t = mem_t.reshape(1)
|
|
514
|
+
layer_order.append(layer_idx)
|
|
515
|
+
frac_terms.append(frac_t)
|
|
516
|
+
resid_terms.append(resid_t)
|
|
517
|
+
coord_terms.append(coord_t)
|
|
518
|
+
resid_mean_t = (
|
|
519
|
+
w * resid_t if resid_mean_t is None else resid_mean_t + w * resid_t
|
|
520
|
+
)
|
|
521
|
+
mem_mean_t = (
|
|
522
|
+
w * mem_t if mem_mean_t is None else mem_mean_t + w * mem_t
|
|
523
|
+
)
|
|
524
|
+
|
|
525
|
+
if coords_mean_t is not None:
|
|
526
|
+
coords_mean_t = _mean_domain_coordinates(
|
|
527
|
+
manifold.domain, coords_mean_t, cast(torch.Tensor, reference_coord),
|
|
528
|
+
)
|
|
529
|
+
|
|
530
|
+
if coords_only:
|
|
531
|
+
# Lean reading: one host transfer of (fraction, coords).
|
|
532
|
+
if frac_mean_t is None or coords_mean_t is None:
|
|
533
|
+
return ProbeReading(fraction=0.0, nearest=[], coords=())
|
|
534
|
+
lean = torch.cat(
|
|
535
|
+
[frac_mean_t.reshape(-1), coords_mean_t.reshape(-1)],
|
|
536
|
+
).detach().cpu().tolist()
|
|
537
|
+
return ProbeReading(
|
|
538
|
+
fraction=lean[0],
|
|
539
|
+
nearest=[],
|
|
540
|
+
coords=tuple(lean[1:1 + n_dim]),
|
|
541
|
+
residual=0.0,
|
|
542
|
+
assignment=[],
|
|
543
|
+
membership=1.0,
|
|
544
|
+
)
|
|
545
|
+
|
|
546
|
+
requested_top_n = int(probe.top_n)
|
|
547
|
+
top_n = requested_top_n if requested_top_n >= 0 else Kc + requested_top_n
|
|
548
|
+
top_n = min(max(top_n, 0), Kc)
|
|
549
|
+
nearest_dist_t: torch.Tensor | None = None
|
|
550
|
+
nearest_idx_t: torch.Tensor | None = None
|
|
551
|
+
if top_n and dist_acc_t is not None:
|
|
552
|
+
label_scale = float(probe.label_scale)
|
|
553
|
+
# Rank by **raw** whitened distance (so ``nearest`` is literally the
|
|
554
|
+
# nearest node, distinct from the density-aware ``assignment``), then
|
|
555
|
+
# report it in units of the probe's typical label spacing
|
|
556
|
+
# ``label_scale`` (median node nearest-neighbor distance) — a single
|
|
557
|
+
# per-probe constant, so it rescales the value without reordering.
|
|
558
|
+
# Raw whitened distance spans ~60× across fits (a node sits 1.15..72
|
|
559
|
+
# from neutral), so a bare negated-distance ``@label`` gate was not
|
|
560
|
+
# portable; ``d / label_scale`` ≈ "typical label-spacings away"
|
|
561
|
+
# transfers across probes. Assignment keeps raw ``dist_acc_t`` (it
|
|
562
|
+
# needs raw ``d`` for the Gaussian ``−d²/2τ²``).
|
|
563
|
+
nearest_dist_raw, nearest_idx_raw = torch.topk(
|
|
564
|
+
dist_acc_t, k=top_n, largest=False, sorted=True,
|
|
565
|
+
)
|
|
566
|
+
nearest_dist_t = cast(torch.Tensor, nearest_dist_raw) / label_scale
|
|
567
|
+
nearest_idx_t = cast(torch.Tensor, nearest_idx_raw)
|
|
568
|
+
# Soft assignment: softmax(−d²/(2τ²) − R·log(τ)) — a proper isotropic
|
|
569
|
+
# R-D Gaussian-mixture posterior with uniform node prior. The
|
|
570
|
+
# ``logvol_bias`` term is the missing Gaussian normalization; without it
|
|
571
|
+
# the bare softmax sends mass to whichever ``τ`` is largest regardless of
|
|
572
|
+
# distance (broadest-node-wins).
|
|
573
|
+
assign_prob_t: torch.Tensor | None = None
|
|
574
|
+
assign_idx_t: torch.Tensor | None = None
|
|
575
|
+
if (
|
|
576
|
+
top_n
|
|
577
|
+
and dist_acc_t is not None
|
|
578
|
+
and probe.assign_bandwidth is not None
|
|
579
|
+
and probe.assign_logvol_bias is not None
|
|
580
|
+
):
|
|
581
|
+
tau = probe.assign_bandwidth.to(dist_acc_t.device, torch.float32)
|
|
582
|
+
lvb = probe.assign_logvol_bias.to(dist_acc_t.device, torch.float32)
|
|
583
|
+
if tau.numel() == dist_acc_t.numel() == lvb.numel():
|
|
584
|
+
logits = (
|
|
585
|
+
-(dist_acc_t ** 2) / (2.0 * (tau ** 2).clamp(min=_FRACTION_EPSILON))
|
|
586
|
+
+ lvb
|
|
587
|
+
)
|
|
588
|
+
probs = torch.softmax(logits, dim=0)
|
|
589
|
+
assign_prob_t, assign_idx_t = torch.topk(
|
|
590
|
+
probs, k=top_n, largest=True, sorted=True,
|
|
591
|
+
)
|
|
592
|
+
|
|
593
|
+
# --- one device→host transfer for the whole probe reading ---
|
|
594
|
+
# Means (1 + 1 + n_dim) ‖ per-layer traces (L + L + L·n_dim) ‖ nearest
|
|
595
|
+
# (top_n dists + top_n indices-as-float). ``.cpu().tolist()`` once.
|
|
596
|
+
# ``shared`` is non-empty here (empty returns early above), so the loop
|
|
597
|
+
# ran and the running means are populated. Guard with an explicit early
|
|
598
|
+
# return (not assert) so ``python -O`` / release builds see the same
|
|
599
|
+
# behaviour — a downstream torch.cat on a None tensor would TypeError.
|
|
600
|
+
if (
|
|
601
|
+
frac_mean_t is None
|
|
602
|
+
or resid_mean_t is None
|
|
603
|
+
or coords_mean_t is None
|
|
604
|
+
or mem_mean_t is None
|
|
605
|
+
):
|
|
606
|
+
return ProbeReading(fraction=0.0, nearest=[], coords=())
|
|
607
|
+
L = len(layer_order)
|
|
608
|
+
parts: list[torch.Tensor] = [
|
|
609
|
+
frac_mean_t, resid_mean_t, coords_mean_t, mem_mean_t,
|
|
610
|
+
torch.cat(frac_terms), torch.cat(resid_terms),
|
|
611
|
+
torch.stack(coord_terms, 0).reshape(-1),
|
|
612
|
+
]
|
|
613
|
+
if nearest_dist_t is not None and nearest_idx_t is not None:
|
|
614
|
+
parts.append(nearest_dist_t)
|
|
615
|
+
parts.append(nearest_idx_t.to(torch.float32))
|
|
616
|
+
if assign_prob_t is not None and assign_idx_t is not None:
|
|
617
|
+
parts.append(assign_prob_t)
|
|
618
|
+
parts.append(assign_idx_t.to(torch.float32))
|
|
619
|
+
flat = torch.cat([p.reshape(-1) for p in parts]).detach().cpu().tolist()
|
|
620
|
+
|
|
621
|
+
o = 0
|
|
622
|
+
frac_mean = flat[o]
|
|
623
|
+
o += 1
|
|
624
|
+
residual_mean = flat[o]
|
|
625
|
+
o += 1
|
|
626
|
+
coords_mean = flat[o:o + n_dim]
|
|
627
|
+
o += n_dim
|
|
628
|
+
membership = flat[o]
|
|
629
|
+
o += 1
|
|
630
|
+
frac_layer_vals = flat[o:o + L]
|
|
631
|
+
o += L
|
|
632
|
+
resid_layer_vals = flat[o:o + L]
|
|
633
|
+
o += L
|
|
634
|
+
coord_layer_vals = flat[o:o + L * n_dim]
|
|
635
|
+
o += L * n_dim
|
|
636
|
+
frac_per_layer = {layer_order[i]: frac_layer_vals[i] for i in range(L)}
|
|
637
|
+
residual_per_layer = {
|
|
638
|
+
layer_order[i]: resid_layer_vals[i] for i in range(L)
|
|
639
|
+
}
|
|
640
|
+
coords_per_layer = {
|
|
641
|
+
layer_order[i]: tuple(coord_layer_vals[i * n_dim:(i + 1) * n_dim])
|
|
642
|
+
for i in range(L)
|
|
643
|
+
}
|
|
644
|
+
def _label(idx: int) -> str:
|
|
645
|
+
# Index ``K`` is the synthetic neutral candidate (when injected);
|
|
646
|
+
# everything below indexes a real corpus node.
|
|
647
|
+
return (
|
|
648
|
+
NEUTRAL_LABEL
|
|
649
|
+
if inject_neutral and idx == K
|
|
650
|
+
else manifold.node_labels[idx]
|
|
651
|
+
)
|
|
652
|
+
|
|
653
|
+
if nearest_dist_t is not None:
|
|
654
|
+
tn = int(nearest_dist_t.numel())
|
|
655
|
+
nd_vals = flat[o:o + tn]
|
|
656
|
+
o += tn
|
|
657
|
+
ni_vals = flat[o:o + tn]
|
|
658
|
+
o += tn
|
|
659
|
+
nearest = [
|
|
660
|
+
(_label(int(round(ni_vals[j]))), nd_vals[j])
|
|
661
|
+
for j in range(tn)
|
|
662
|
+
]
|
|
663
|
+
elif top_n:
|
|
664
|
+
nearest = [(_label(k), 0.0) for k in range(top_n)]
|
|
665
|
+
else:
|
|
666
|
+
nearest = []
|
|
667
|
+
|
|
668
|
+
assignment: list[tuple[str, float]] = []
|
|
669
|
+
if assign_prob_t is not None:
|
|
670
|
+
ta = int(assign_prob_t.numel())
|
|
671
|
+
ap_vals = flat[o:o + ta]
|
|
672
|
+
o += ta
|
|
673
|
+
ai_vals = flat[o:o + ta]
|
|
674
|
+
o += ta
|
|
675
|
+
assignment = [
|
|
676
|
+
(_label(int(round(ai_vals[j]))), ap_vals[j])
|
|
677
|
+
for j in range(ta)
|
|
678
|
+
]
|
|
679
|
+
|
|
680
|
+
depth_com, depth_spread = _depth_stats(
|
|
681
|
+
coords_per_layer, w_shared, self._depth_denom,
|
|
682
|
+
)
|
|
683
|
+
return ProbeReading(
|
|
684
|
+
fraction=frac_mean,
|
|
685
|
+
nearest=nearest,
|
|
686
|
+
coords=tuple(coords_mean),
|
|
687
|
+
residual=residual_mean,
|
|
688
|
+
fraction_per_layer=frac_per_layer,
|
|
689
|
+
coords_per_layer=coords_per_layer,
|
|
690
|
+
residual_per_layer=residual_per_layer,
|
|
691
|
+
assignment=assignment,
|
|
692
|
+
membership=membership,
|
|
693
|
+
depth_com=depth_com,
|
|
694
|
+
depth_spread=depth_spread,
|
|
695
|
+
)
|
|
696
|
+
|
|
697
|
+
def _score_full(
|
|
698
|
+
self, hidden_per_layer: dict[int, torch.Tensor],
|
|
699
|
+
*, only: set[str] | None = None, coords_only: bool = False,
|
|
700
|
+
) -> dict[str, ProbeReading]:
|
|
701
|
+
"""Full readings for every attached probe at one state.
|
|
702
|
+
|
|
703
|
+
**Cross-probe batched.** Every *flat* (affine) probe shares the same
|
|
704
|
+
per-layer geometry algebra over a common activation, so the whole flat
|
|
705
|
+
roster is scored together — one ``Σ⁻¹h`` Woodbury apply + a few
|
|
706
|
+
stacked / block-diagonal matmuls per layer — in :meth:`_score_flat_batched`,
|
|
707
|
+
instead of re-running the apply and the R-dim solve once per probe per
|
|
708
|
+
layer. Curved probes keep the per-probe foot solve
|
|
709
|
+
(:meth:`_score_probe_full`). Every field of the full
|
|
710
|
+
:class:`ProbeReading` is populated either way, and the batched result is
|
|
711
|
+
bit-identical (to float tolerance) to the per-probe path the aggregate
|
|
712
|
+
uses.
|
|
713
|
+
|
|
714
|
+
``only`` (a set of probe names) scores just that subset, routing every
|
|
715
|
+
probe in it — flat or curved — through the per-probe :meth:`_score_probe_full`
|
|
716
|
+
path (correct for both shapes, and cheap for the 1-2 probe subset a
|
|
717
|
+
gate-only step needs, where building the full batched roster would be
|
|
718
|
+
pure waste). ``only=None`` is the full-roster behavior, byte-identical
|
|
719
|
+
to before.
|
|
720
|
+
"""
|
|
721
|
+
out: dict[str, ProbeReading] = {}
|
|
722
|
+
if not hidden_per_layer or not self._probes:
|
|
723
|
+
return out
|
|
724
|
+
# ``Σ⁻¹h`` is probe-independent (depends only on the layer's hidden state
|
|
725
|
+
# + the shared whitener), so it is computed at most once per layer and
|
|
726
|
+
# reused across every curved probe in this pass. Valid only for this
|
|
727
|
+
# ``hidden_per_layer`` — a fresh dict per call.
|
|
728
|
+
sih_cache: dict[int, torch.Tensor] = {}
|
|
729
|
+
if only is not None:
|
|
730
|
+
# Gate-only subset: per-probe path for both flat and curved.
|
|
731
|
+
for name in self._probes:
|
|
732
|
+
if name in only:
|
|
733
|
+
out[name] = self._score_probe_full(
|
|
734
|
+
self._probes[name], hidden_per_layer, sih_cache,
|
|
735
|
+
coords_only=coords_only,
|
|
736
|
+
)
|
|
737
|
+
return out
|
|
738
|
+
device = next(iter(hidden_per_layer.values())).device
|
|
739
|
+
self._ensure_flat_cache(device)
|
|
740
|
+
if self._flat_keys:
|
|
741
|
+
out.update(self._score_flat_batched(
|
|
742
|
+
hidden_per_layer, sih_cache, coords_only=coords_only,
|
|
743
|
+
))
|
|
744
|
+
for name in self._curved_keys:
|
|
745
|
+
out[name] = self._score_probe_full(
|
|
746
|
+
self._probes[name], hidden_per_layer, sih_cache,
|
|
747
|
+
coords_only=coords_only,
|
|
748
|
+
)
|
|
749
|
+
# Defensive: any probe the cache didn't classify (it always should) is
|
|
750
|
+
# scored per-probe so nothing silently drops from the readings.
|
|
751
|
+
for name, probe in self._probes.items():
|
|
752
|
+
if name not in out:
|
|
753
|
+
out[name] = self._score_probe_full(
|
|
754
|
+
probe, hidden_per_layer, sih_cache,
|
|
755
|
+
coords_only=coords_only,
|
|
756
|
+
)
|
|
757
|
+
# Probe-inspector live trail (gated): stamp each probe's per-layer whitened
|
|
758
|
+
# query coords onto its reading. Isolated post-pass — the hot batched
|
|
759
|
+
# flat cache is untouched; runs only while a client opted in.
|
|
760
|
+
if self._emit_subspace_coords:
|
|
761
|
+
for name, probe in self._probes.items():
|
|
762
|
+
reading = out.get(name)
|
|
763
|
+
if reading is not None:
|
|
764
|
+
reading.subspace_coords_per_layer = (
|
|
765
|
+
self._subspace_coords_for(probe, hidden_per_layer)
|
|
766
|
+
)
|
|
767
|
+
# Preserve probe insertion order in the returned dict.
|
|
768
|
+
return {name: out[name] for name in self._probes if name in out}
|
|
769
|
+
|
|
770
|
+
def _plan_probe_gate_scalars(
|
|
771
|
+
self,
|
|
772
|
+
probe: "AttachedManifoldProbe",
|
|
773
|
+
gate_keys: set[str],
|
|
774
|
+
) -> _ProbeGateScalarPlan | None:
|
|
775
|
+
"""Parse one probe's requested gate scalar keys once per generation."""
|
|
776
|
+
name = probe.name
|
|
777
|
+
suffixes = {
|
|
778
|
+
key[len(name):]: key for key in gate_keys
|
|
779
|
+
if key == name
|
|
780
|
+
or key.startswith(f"{name}[")
|
|
781
|
+
or key.startswith(f"{name}:")
|
|
782
|
+
or key.startswith(f"{name}@")
|
|
783
|
+
or key.startswith(f"{name}~")
|
|
784
|
+
}
|
|
785
|
+
if not suffixes:
|
|
786
|
+
return None
|
|
787
|
+
|
|
788
|
+
coord_axes: dict[int, str] = {}
|
|
789
|
+
if "" in suffixes:
|
|
790
|
+
coord_axes[0] = suffixes[""]
|
|
791
|
+
for suffix, key in suffixes.items():
|
|
792
|
+
if suffix.startswith("[") and suffix.endswith("]"):
|
|
793
|
+
try:
|
|
794
|
+
axis = int(suffix[1:-1])
|
|
795
|
+
except ValueError:
|
|
796
|
+
continue
|
|
797
|
+
if axis >= 0:
|
|
798
|
+
coord_axes[axis] = key
|
|
799
|
+
fraction_key = suffixes.get(":fraction")
|
|
800
|
+
membership_key = suffixes.get(":membership")
|
|
801
|
+
dist_labels = {
|
|
802
|
+
suffix[1:]: key for suffix, key in suffixes.items()
|
|
803
|
+
if suffix.startswith("@") and len(suffix) > 1
|
|
804
|
+
}
|
|
805
|
+
assign_labels = {
|
|
806
|
+
suffix[1:]: key for suffix, key in suffixes.items()
|
|
807
|
+
if suffix.startswith("~") and len(suffix) > 1
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
need_coords = bool(coord_axes)
|
|
811
|
+
need_fraction = fraction_key is not None
|
|
812
|
+
need_membership = membership_key is not None
|
|
813
|
+
need_nearest = bool(dist_labels)
|
|
814
|
+
need_assignment = bool(assign_labels)
|
|
815
|
+
need_dist = bool(need_nearest or need_assignment)
|
|
816
|
+
if not (need_coords or need_fraction or need_membership or need_dist):
|
|
817
|
+
return None
|
|
818
|
+
label_to_idx = probe.label_to_candidate_idx
|
|
819
|
+
dist_requests = tuple(
|
|
820
|
+
(key, label_to_idx[label])
|
|
821
|
+
for label, key in dist_labels.items()
|
|
822
|
+
if label in label_to_idx
|
|
823
|
+
)
|
|
824
|
+
assign_requests = tuple(
|
|
825
|
+
(key, label_to_idx[label])
|
|
826
|
+
for label, key in assign_labels.items()
|
|
827
|
+
if label in label_to_idx
|
|
828
|
+
)
|
|
829
|
+
plan_device = (
|
|
830
|
+
next(iter(probe.whitened.values())).node_white_aug.device
|
|
831
|
+
if probe.whitened else torch.device("cpu")
|
|
832
|
+
)
|
|
833
|
+
return _ProbeGateScalarPlan(
|
|
834
|
+
probe_name=name,
|
|
835
|
+
coord_axes=tuple(sorted(coord_axes.items())),
|
|
836
|
+
fraction_key=fraction_key,
|
|
837
|
+
membership_key=membership_key,
|
|
838
|
+
dist_requests=dist_requests,
|
|
839
|
+
assign_requests=assign_requests,
|
|
840
|
+
dist_index=(
|
|
841
|
+
torch.tensor(
|
|
842
|
+
[idx for _key, idx in dist_requests],
|
|
843
|
+
device=plan_device,
|
|
844
|
+
dtype=torch.long,
|
|
845
|
+
)
|
|
846
|
+
if dist_requests else None
|
|
847
|
+
),
|
|
848
|
+
assign_index=(
|
|
849
|
+
torch.tensor(
|
|
850
|
+
[idx for _key, idx in assign_requests],
|
|
851
|
+
device=plan_device,
|
|
852
|
+
dtype=torch.long,
|
|
853
|
+
)
|
|
854
|
+
if assign_requests else None
|
|
855
|
+
),
|
|
856
|
+
)
|
|
857
|
+
|
|
858
|
+
def plan_gate_scalars(
|
|
859
|
+
self,
|
|
860
|
+
gate_keys: set[str],
|
|
861
|
+
*,
|
|
862
|
+
probe_names: set[str] | None = None,
|
|
863
|
+
) -> tuple[_ProbeGateScalarPlan, ...]:
|
|
864
|
+
"""Pre-parse exact monitor gate scalar keys for the decode hot path.
|
|
865
|
+
|
|
866
|
+
``probe_names`` narrows the plan to a caller-supplied roster subset;
|
|
867
|
+
without it the probe names are recovered from the keys through
|
|
868
|
+
:func:`parse_gate_ref`, the one place the scalar-key discrimination
|
|
869
|
+
lives. A char-class split would truncate a variant-suffixed probe
|
|
870
|
+
name (``pirate:role-x`` at ``:role-x``) and silently plan nothing for
|
|
871
|
+
it, so the gate would never fire.
|
|
872
|
+
"""
|
|
873
|
+
if not gate_keys or not self._probes:
|
|
874
|
+
return ()
|
|
875
|
+
names = (
|
|
876
|
+
set(probe_names)
|
|
877
|
+
if probe_names is not None
|
|
878
|
+
else {parse_gate_ref(k).probe for k in gate_keys}
|
|
879
|
+
)
|
|
880
|
+
plans: list[_ProbeGateScalarPlan] = []
|
|
881
|
+
for name, probe in self._probes.items():
|
|
882
|
+
if name not in names:
|
|
883
|
+
continue
|
|
884
|
+
plan = self._plan_probe_gate_scalars(probe, gate_keys)
|
|
885
|
+
if plan is not None:
|
|
886
|
+
plans.append(plan)
|
|
887
|
+
return tuple(plans)
|
|
888
|
+
|
|
889
|
+
def _score_planned_probe_gate_scalars(
|
|
890
|
+
self,
|
|
891
|
+
probe: "AttachedManifoldProbe",
|
|
892
|
+
hidden_per_layer: dict[int, torch.Tensor],
|
|
893
|
+
plan: _ProbeGateScalarPlan,
|
|
894
|
+
sih_cache: dict[int, torch.Tensor] | None = None,
|
|
895
|
+
) -> dict[str, float]:
|
|
896
|
+
"""Score a planned probe gate scalar map.
|
|
897
|
+
|
|
898
|
+
This is intentionally narrower than :meth:`_score_probe_full`: it is used
|
|
899
|
+
only by the gate-only decode path, where no UI/API consumer needs a full
|
|
900
|
+
:class:`ProbeReading`. Curved ``:fraction`` and ``@label`` / ``~label``
|
|
901
|
+
gates can skip the nearest-foot solve entirely; coord and membership
|
|
902
|
+
gates still run the geometry they semantically require.
|
|
903
|
+
"""
|
|
904
|
+
coord_axes = plan.coord_axes
|
|
905
|
+
fraction_key = plan.fraction_key
|
|
906
|
+
membership_key = plan.membership_key
|
|
907
|
+
dist_requests = plan.dist_requests
|
|
908
|
+
assign_requests = plan.assign_requests
|
|
909
|
+
need_coords = bool(coord_axes)
|
|
910
|
+
need_fraction = fraction_key is not None
|
|
911
|
+
need_membership = membership_key is not None
|
|
912
|
+
need_nearest = bool(dist_requests)
|
|
913
|
+
need_assignment = bool(assign_requests)
|
|
914
|
+
need_dist = bool(need_nearest or need_assignment)
|
|
915
|
+
|
|
916
|
+
manifold = probe.manifold
|
|
917
|
+
sw = probe.share_weights
|
|
918
|
+
is_affine = probe.is_affine
|
|
919
|
+
shared = [idx for idx in manifold.layers if idx in hidden_per_layer]
|
|
920
|
+
if not shared:
|
|
921
|
+
return {}
|
|
922
|
+
total_w = sum(sw[idx] for idx in shared)
|
|
923
|
+
w_shared = {idx: sw[idx] / total_w for idx in shared}
|
|
924
|
+
|
|
925
|
+
n_dim = manifold.domain.intrinsic_dim
|
|
926
|
+
frac_mean_t: torch.Tensor | None = None
|
|
927
|
+
coords_mean_t: torch.Tensor | None = None
|
|
928
|
+
mem_mean_t: torch.Tensor | None = None
|
|
929
|
+
dist_acc_t: torch.Tensor | None = None
|
|
930
|
+
|
|
931
|
+
reference_coord = None
|
|
932
|
+
reference_layer = max(shared, key=lambda layer: w_shared[layer])
|
|
933
|
+
for layer_idx in shared:
|
|
934
|
+
sub = manifold.layers[layer_idx]
|
|
935
|
+
h = hidden_per_layer[layer_idx].to(torch.float32)
|
|
936
|
+
if h.ndim > 1:
|
|
937
|
+
h = h.reshape(-1, h.shape[-1])[-1]
|
|
938
|
+
wh = probe.whitened[layer_idx]
|
|
939
|
+
frac_t, cdist_query, invert_query, _cdist_nodes = _layer_geometry(
|
|
940
|
+
probe, layer_idx, h, sih_cache,
|
|
941
|
+
)
|
|
942
|
+
w = w_shared[layer_idx]
|
|
943
|
+
|
|
944
|
+
if need_fraction:
|
|
945
|
+
frac_t = frac_t.reshape(1)
|
|
946
|
+
frac_mean_t = (
|
|
947
|
+
w * frac_t if frac_mean_t is None else frac_mean_t + w * frac_t
|
|
948
|
+
)
|
|
949
|
+
|
|
950
|
+
if need_dist:
|
|
951
|
+
# Neutral rides the precomputed ``node_white_aug`` — no
|
|
952
|
+
# per-token ``cat``.
|
|
953
|
+
dists = torch.linalg.vector_norm(
|
|
954
|
+
wh.node_white_aug - cdist_query.reshape(1, -1), dim=-1,
|
|
955
|
+
)
|
|
956
|
+
weighted_dists = dists * w
|
|
957
|
+
dist_acc_t = (
|
|
958
|
+
weighted_dists
|
|
959
|
+
if dist_acc_t is None
|
|
960
|
+
else dist_acc_t + weighted_dists.to(dist_acc_t.device)
|
|
961
|
+
)
|
|
962
|
+
|
|
963
|
+
if need_coords or need_membership:
|
|
964
|
+
if is_affine:
|
|
965
|
+
pos_t = (
|
|
966
|
+
wh.coord_S @ invert_query + wh.coord_b
|
|
967
|
+
if wh.coord_S is not None and wh.coord_b is not None
|
|
968
|
+
else invert_query
|
|
969
|
+
)
|
|
970
|
+
mem_t = frac_t.new_ones(1)
|
|
971
|
+
else:
|
|
972
|
+
foot_key = (probe.name, layer_idx)
|
|
973
|
+
warm = self._curved_feet.get(foot_key) if self._curved_warm else None
|
|
974
|
+
pos, res = invert_parameterization(
|
|
975
|
+
sub, manifold.domain, invert_query.reshape(1, -1),
|
|
976
|
+
manifold.node_coords, warm_start=warm,
|
|
977
|
+
)
|
|
978
|
+
if self._curved_warm:
|
|
979
|
+
self._curved_feet[foot_key] = pos.detach()
|
|
980
|
+
pos_t = pos.reshape(-1)
|
|
981
|
+
if need_membership and sub.has_sigma:
|
|
982
|
+
res_flat = res.reshape(-1)[:1]
|
|
983
|
+
sig_foot = sub.sigma_at(
|
|
984
|
+
manifold.domain.embed(pos.reshape(1, -1)),
|
|
985
|
+
).reshape(1)
|
|
986
|
+
mem_t = torch.exp(
|
|
987
|
+
-(res_flat ** 2)
|
|
988
|
+
/ (2.0 * (sig_foot ** 2).clamp(min=_FRACTION_EPSILON))
|
|
989
|
+
)
|
|
990
|
+
else:
|
|
991
|
+
mem_t = frac_t.new_ones(1)
|
|
992
|
+
|
|
993
|
+
if need_coords:
|
|
994
|
+
coord_t = pos_t.reshape(-1)[:n_dim]
|
|
995
|
+
if coord_t.numel() < n_dim:
|
|
996
|
+
coord_t = torch.cat(
|
|
997
|
+
[coord_t, coord_t.new_zeros(n_dim - coord_t.numel())],
|
|
998
|
+
)
|
|
999
|
+
if layer_idx == reference_layer:
|
|
1000
|
+
reference_coord = coord_t
|
|
1001
|
+
mean_coord = _mean_coordinate_space(manifold.domain, coord_t)
|
|
1002
|
+
coords_mean_t = (
|
|
1003
|
+
w * mean_coord
|
|
1004
|
+
if coords_mean_t is None
|
|
1005
|
+
else coords_mean_t + w * mean_coord
|
|
1006
|
+
)
|
|
1007
|
+
if need_membership:
|
|
1008
|
+
mem_t = mem_t.reshape(1)
|
|
1009
|
+
mem_mean_t = (
|
|
1010
|
+
w * mem_t
|
|
1011
|
+
if mem_mean_t is None
|
|
1012
|
+
else mem_mean_t + w * mem_t
|
|
1013
|
+
)
|
|
1014
|
+
|
|
1015
|
+
if coords_mean_t is not None:
|
|
1016
|
+
coords_mean_t = _mean_domain_coordinates(
|
|
1017
|
+
manifold.domain, coords_mean_t, cast(torch.Tensor, reference_coord),
|
|
1018
|
+
)
|
|
1019
|
+
|
|
1020
|
+
out: dict[str, float] = {}
|
|
1021
|
+
parts: list[torch.Tensor] = []
|
|
1022
|
+
slots: list[tuple[str, Any]] = []
|
|
1023
|
+
if need_fraction and frac_mean_t is not None and fraction_key is not None:
|
|
1024
|
+
parts.append(frac_mean_t.reshape(1))
|
|
1025
|
+
slots.append(("scalar", fraction_key))
|
|
1026
|
+
if need_coords and coords_mean_t is not None:
|
|
1027
|
+
for axis, key in coord_axes:
|
|
1028
|
+
if axis < int(coords_mean_t.numel()):
|
|
1029
|
+
parts.append(coords_mean_t[axis].reshape(1))
|
|
1030
|
+
slots.append(("scalar", key))
|
|
1031
|
+
if need_membership and mem_mean_t is not None and membership_key is not None:
|
|
1032
|
+
parts.append(mem_mean_t.reshape(1))
|
|
1033
|
+
slots.append(("scalar", membership_key))
|
|
1034
|
+
|
|
1035
|
+
if need_nearest and dist_requests and dist_acc_t is not None:
|
|
1036
|
+
idx_t = (
|
|
1037
|
+
plan.dist_index.to(device=dist_acc_t.device, dtype=torch.long)
|
|
1038
|
+
if plan.dist_index is not None
|
|
1039
|
+
else torch.empty(0, device=dist_acc_t.device, dtype=torch.long)
|
|
1040
|
+
)
|
|
1041
|
+
parts.append(dist_acc_t.index_select(0, idx_t) / probe.label_scale)
|
|
1042
|
+
slots.append(("nearest_exact", [key for key, _idx in dist_requests]))
|
|
1043
|
+
if (
|
|
1044
|
+
need_assignment
|
|
1045
|
+
and assign_requests
|
|
1046
|
+
and dist_acc_t is not None
|
|
1047
|
+
and probe.assign_bandwidth is not None
|
|
1048
|
+
and probe.assign_logvol_bias is not None
|
|
1049
|
+
):
|
|
1050
|
+
tau = probe.assign_bandwidth.to(dist_acc_t.device, torch.float32)
|
|
1051
|
+
lvb = probe.assign_logvol_bias.to(dist_acc_t.device, torch.float32)
|
|
1052
|
+
if tau.numel() == dist_acc_t.numel() == lvb.numel():
|
|
1053
|
+
logits = (
|
|
1054
|
+
-(dist_acc_t ** 2)
|
|
1055
|
+
/ (2.0 * (tau ** 2).clamp(min=_FRACTION_EPSILON))
|
|
1056
|
+
+ lvb
|
|
1057
|
+
)
|
|
1058
|
+
probs = torch.softmax(logits, dim=0)
|
|
1059
|
+
idx_t = (
|
|
1060
|
+
plan.assign_index.to(device=probs.device, dtype=torch.long)
|
|
1061
|
+
if plan.assign_index is not None
|
|
1062
|
+
else torch.empty(0, device=probs.device, dtype=torch.long)
|
|
1063
|
+
)
|
|
1064
|
+
parts.append(probs.index_select(0, idx_t))
|
|
1065
|
+
slots.append(("assignment_exact", [key for key, _idx in assign_requests]))
|
|
1066
|
+
|
|
1067
|
+
if not parts:
|
|
1068
|
+
return out
|
|
1069
|
+
flat = torch.cat([p.reshape(-1) for p in parts]).detach().cpu().tolist()
|
|
1070
|
+
pos = 0
|
|
1071
|
+
for kind, meta in slots:
|
|
1072
|
+
if kind == "scalar":
|
|
1073
|
+
out[meta] = float(flat[pos])
|
|
1074
|
+
pos += 1
|
|
1075
|
+
elif kind == "nearest_exact":
|
|
1076
|
+
keys = list(meta)
|
|
1077
|
+
vals = flat[pos:pos + len(keys)]
|
|
1078
|
+
pos += len(keys)
|
|
1079
|
+
for key, dist in zip(keys, vals, strict=True):
|
|
1080
|
+
out[key] = -float(dist)
|
|
1081
|
+
elif kind == "assignment_exact":
|
|
1082
|
+
keys = list(meta)
|
|
1083
|
+
vals = flat[pos:pos + len(keys)]
|
|
1084
|
+
pos += len(keys)
|
|
1085
|
+
for key, prob in zip(keys, vals, strict=True):
|
|
1086
|
+
out[key] = float(prob)
|
|
1087
|
+
return out
|
|
1088
|
+
|
|
1089
|
+
def score_planned_gate_scalars(
|
|
1090
|
+
self,
|
|
1091
|
+
hidden_per_layer: dict[int, torch.Tensor],
|
|
1092
|
+
plan: tuple[_ProbeGateScalarPlan, ...],
|
|
1093
|
+
) -> dict[str, float]:
|
|
1094
|
+
"""Score a pre-parsed gate scalar plan without rebuilding key maps.
|
|
1095
|
+
|
|
1096
|
+
The gate path is deliberately two calls: :meth:`plan_gate_scalars`
|
|
1097
|
+
parses the key space once per generation, this scores that plan every
|
|
1098
|
+
token. Only the probes a gate key references do any work.
|
|
1099
|
+
"""
|
|
1100
|
+
if not hidden_per_layer or not self._probes or not plan:
|
|
1101
|
+
return {}
|
|
1102
|
+
sih_cache: dict[int, torch.Tensor] = {}
|
|
1103
|
+
out: dict[str, float] = {}
|
|
1104
|
+
for item in plan:
|
|
1105
|
+
probe = self._probes.get(item.probe_name)
|
|
1106
|
+
if probe is None:
|
|
1107
|
+
continue
|
|
1108
|
+
out.update(
|
|
1109
|
+
self._score_planned_probe_gate_scalars(
|
|
1110
|
+
probe, hidden_per_layer, item, sih_cache,
|
|
1111
|
+
)
|
|
1112
|
+
)
|
|
1113
|
+
return out
|
|
1114
|
+
|
|
1115
|
+
def _subspace_coords_for(
|
|
1116
|
+
self,
|
|
1117
|
+
probe: "AttachedManifoldProbe",
|
|
1118
|
+
hidden_per_layer: dict[int, torch.Tensor],
|
|
1119
|
+
) -> dict[int, tuple[float, ...]]:
|
|
1120
|
+
"""Per-layer whitened query coords for one probe (inspector trail).
|
|
1121
|
+
|
|
1122
|
+
Reuses :func:`_layer_geometry` — the same primitive the read path runs —
|
|
1123
|
+
so the live point lands in the identical whitened frame as the geometry
|
|
1124
|
+
endpoint's ``node_white`` / ``neutral_white``. One batched host transfer
|
|
1125
|
+
per probe; only reached when ``_emit_subspace_coords`` is set. Rank can
|
|
1126
|
+
vary per layer (flat DLS prune), so each layer's slice length is tracked
|
|
1127
|
+
explicitly rather than assumed uniform.
|
|
1128
|
+
"""
|
|
1129
|
+
rows: list[torch.Tensor] = []
|
|
1130
|
+
order: list[int] = []
|
|
1131
|
+
lens: list[int] = []
|
|
1132
|
+
for layer_idx in probe.manifold.layers:
|
|
1133
|
+
if layer_idx not in hidden_per_layer:
|
|
1134
|
+
continue
|
|
1135
|
+
if probe.whitened.get(layer_idx) is None:
|
|
1136
|
+
continue
|
|
1137
|
+
h = hidden_per_layer[layer_idx].to(torch.float32)
|
|
1138
|
+
if h.ndim > 1:
|
|
1139
|
+
h = h.reshape(-1, h.shape[-1])[-1]
|
|
1140
|
+
_, cdist_query, _, _ = _layer_geometry(probe, layer_idx, h)
|
|
1141
|
+
cq = cdist_query.reshape(-1)
|
|
1142
|
+
rows.append(cq)
|
|
1143
|
+
order.append(layer_idx)
|
|
1144
|
+
lens.append(int(cq.numel()))
|
|
1145
|
+
if not rows:
|
|
1146
|
+
return {}
|
|
1147
|
+
flat = torch.cat(rows).detach().cpu().tolist()
|
|
1148
|
+
out: dict[int, tuple[float, ...]] = {}
|
|
1149
|
+
pos = 0
|
|
1150
|
+
for i, ln in enumerate(lens):
|
|
1151
|
+
out[order[i]] = tuple(flat[pos:pos + ln])
|
|
1152
|
+
pos += ln
|
|
1153
|
+
return out
|
|
1154
|
+
|
|
1155
|
+
def _ensure_flat_cache(self, device: torch.device) -> None:
|
|
1156
|
+
"""Build/refresh the cross-probe batched flat-read cache on ``device``.
|
|
1157
|
+
|
|
1158
|
+
Splits the roster into flat (``is_affine``) and curved probes, then
|
|
1159
|
+
precomputes (a) a **global** per-probe layout — coord-offsets, node
|
|
1160
|
+
counts, top-N, labels, a padded-node validity mask, and ``Rmax`` /
|
|
1161
|
+
``Kmax`` — and (b) per layer the stacked / block-diagonal factors plus
|
|
1162
|
+
the scatter indices that let one batched sweep accumulate straight into
|
|
1163
|
+
global per-probe slots. Per layer ``L``:
|
|
1164
|
+
|
|
1165
|
+
* ``X`` / ``K_inv`` / ``lam`` — shared Woodbury factors (one ``Σ⁻¹h``
|
|
1166
|
+
per layer covers every flat probe; the whitener is identical),
|
|
1167
|
+
* ``basis_stack`` ``(ΣR, D)`` / ``gmean_stack`` ``(ΣR,)`` /
|
|
1168
|
+
``means_stack`` ``(P_L, D)`` / ``mm_stack`` ``(P_L,)`` — the stacked
|
|
1169
|
+
``B Σ⁻¹``, the ``B Σ⁻¹ μ`` shift, and the fraction-denominator cross
|
|
1170
|
+
terms,
|
|
1171
|
+
* ``Mblk`` / ``chol_blk`` / ``coordS_blk`` (block-diagonal) — per-probe
|
|
1172
|
+
``M_R⁻¹``, whitened-distance Cholesky, and the affine reduced→domain
|
|
1173
|
+
map, each one block-diagonal matmul,
|
|
1174
|
+
* ``cols`` ``(P_L,)`` / ``coords_gidx`` ``(Σnd_L,)`` / ``wt_perdim`` /
|
|
1175
|
+
``cq_scatter`` ``(ΣR_L,)`` — scatter indices into the global
|
|
1176
|
+
``frac_acc`` / ``coords_acc`` / ``dist_acc`` slots and into the padded
|
|
1177
|
+
``(P_L, Rmax)`` whitened query,
|
|
1178
|
+
* ``node_white_pad`` ``(P_L, Kmax, Rmax)`` — padded whitened node coords
|
|
1179
|
+
(real dims filled, the rest 0) so the per-layer nearest distance is one
|
|
1180
|
+
batched ``(P_L, Kmax)`` norm,
|
|
1181
|
+
* host ``present_cols`` / ``present_nd`` — for reconstructing the
|
|
1182
|
+
per-layer traces after the single transfer.
|
|
1183
|
+
|
|
1184
|
+
Off the hot path; rebuilt only when the device, roster, or whitener
|
|
1185
|
+
changes (the cache-key guard short-circuits otherwise).
|
|
1186
|
+
"""
|
|
1187
|
+
# Per-token guard: a bool + a device compare. ``_flat_cache_dirty``
|
|
1188
|
+
# is flipped True by ``_invalidate_flat_cache`` on every roster / whitener
|
|
1189
|
+
# change, so a clean cache on the same device short-circuits without
|
|
1190
|
+
# rebuilding + comparing a ``tuple(self._probes.keys())`` each token.
|
|
1191
|
+
if not self._flat_cache_dirty and self._flat_cache_device == device:
|
|
1192
|
+
return
|
|
1193
|
+
self._flat_cache_device = device
|
|
1194
|
+
self._flat_cache_dirty = False
|
|
1195
|
+
flat_names = [
|
|
1196
|
+
n for n, p in self._probes.items()
|
|
1197
|
+
if p.is_affine and p.manifold.layers
|
|
1198
|
+
]
|
|
1199
|
+
self._flat_keys = tuple(flat_names)
|
|
1200
|
+
self._curved_keys = tuple(
|
|
1201
|
+
n for n, p in self._probes.items()
|
|
1202
|
+
if not p.is_affine and p.manifold.layers
|
|
1203
|
+
)
|
|
1204
|
+
if not flat_names:
|
|
1205
|
+
self._flat_layer_cache = {}
|
|
1206
|
+
self._flat_global = {}
|
|
1207
|
+
return
|
|
1208
|
+
|
|
1209
|
+
# --- global per-probe layout ---
|
|
1210
|
+
P = len(flat_names)
|
|
1211
|
+
nd_list = [
|
|
1212
|
+
int(self._probes[n].manifold.domain.intrinsic_dim) for n in flat_names
|
|
1213
|
+
]
|
|
1214
|
+
K_list = [
|
|
1215
|
+
int(self._probes[n].manifold.node_coords.shape[0]) for n in flat_names
|
|
1216
|
+
]
|
|
1217
|
+
# Neutral competes as a virtual candidate at column ``K`` per injecting
|
|
1218
|
+
# probe. A flat fit is neutral-anchored (origin = reduced 0), and
|
|
1219
|
+
# ``node_pad`` is zero-initialized, so the reserved column already holds
|
|
1220
|
+
# ``neutral_white`` — its distance falls out of the existing padded norm
|
|
1221
|
+
# as ``‖cq‖`` with no hot-loop change. ``Kc_list`` is the candidate
|
|
1222
|
+
# count (nodes + neutral) per probe.
|
|
1223
|
+
inj_list = [bool(self._probes[n].inject_neutral) for n in flat_names]
|
|
1224
|
+
Kc_list = [K + (1 if inj else 0) for K, inj in zip(K_list, inj_list, strict=True)]
|
|
1225
|
+
top_n_list: list[int] = []
|
|
1226
|
+
for n, Kc in zip(flat_names, Kc_list, strict=True):
|
|
1227
|
+
req = int(self._probes[n].top_n)
|
|
1228
|
+
tn = req if req >= 0 else Kc + req
|
|
1229
|
+
top_n_list.append(min(max(tn, 0), Kc))
|
|
1230
|
+
topk_width = max(top_n_list, default=0)
|
|
1231
|
+
nd_off: list[tuple[int, int]] = []
|
|
1232
|
+
off = 0
|
|
1233
|
+
for nd in nd_list:
|
|
1234
|
+
nd_off.append((off, nd))
|
|
1235
|
+
off += nd
|
|
1236
|
+
nd_total = off
|
|
1237
|
+
Kmax = max(Kc_list)
|
|
1238
|
+
Rmax = max(
|
|
1239
|
+
int(sub.basis.shape[0])
|
|
1240
|
+
for n in flat_names
|
|
1241
|
+
for sub in self._probes[n].whitened.values()
|
|
1242
|
+
)
|
|
1243
|
+
valid_mask = torch.zeros((P, Kmax), dtype=torch.bool, device=device)
|
|
1244
|
+
for ci, Kc in enumerate(Kc_list):
|
|
1245
|
+
valid_mask[ci, :Kc] = True
|
|
1246
|
+
# Padded per-candidate soft-assignment bandwidth ``τ`` and the precomputed
|
|
1247
|
+
# Gaussian log-volume bias ``−R·log(τ)`` ``(P, Kmax)`` each. Filled from
|
|
1248
|
+
# each probe's precomputed ``assign_bandwidth`` / ``assign_logvol_bias``
|
|
1249
|
+
# (invalid/pad columns stay at the neutral defaults — band=1.0, bias=0 —
|
|
1250
|
+
# but are masked to −inf logit by ``valid_mask`` in the softmax, so their
|
|
1251
|
+
# value is irrelevant). A probe without a bandwidth (degenerate) keeps
|
|
1252
|
+
# the defaults and is suppressed from the assignment downstream via
|
|
1253
|
+
# ``band_present``.
|
|
1254
|
+
band_pad = torch.ones((P, Kmax), dtype=torch.float32, device=device)
|
|
1255
|
+
logvol_pad = torch.zeros((P, Kmax), dtype=torch.float32, device=device)
|
|
1256
|
+
band_present_list = [False] * P
|
|
1257
|
+
for ci, n in enumerate(flat_names):
|
|
1258
|
+
bw = self._probes[n].assign_bandwidth
|
|
1259
|
+
lvb = self._probes[n].assign_logvol_bias
|
|
1260
|
+
if (
|
|
1261
|
+
bw is not None and lvb is not None
|
|
1262
|
+
and bw.numel() == Kc_list[ci] and lvb.numel() == Kc_list[ci]
|
|
1263
|
+
):
|
|
1264
|
+
band_pad[ci, :bw.numel()] = bw.to(device, torch.float32)
|
|
1265
|
+
logvol_pad[ci, :lvb.numel()] = lvb.to(device, torch.float32)
|
|
1266
|
+
band_present_list[ci] = True
|
|
1267
|
+
# Per-probe ``@label`` distance scale ``(P,)`` — the robust median node
|
|
1268
|
+
# spacing each probe carries. The reported nearest distance is divided
|
|
1269
|
+
# by it (a per-probe constant ⇒ preserves the raw ranking) to make the
|
|
1270
|
+
# ``@label`` gate threshold portable across probes.
|
|
1271
|
+
label_scale = torch.tensor(
|
|
1272
|
+
[float(self._probes[n].label_scale) for n in flat_names],
|
|
1273
|
+
device=device, dtype=torch.float32,
|
|
1274
|
+
).clamp(min=_FRACTION_EPSILON)
|
|
1275
|
+
labels: list[list[str]] = []
|
|
1276
|
+
for n, inj in zip(flat_names, inj_list, strict=True):
|
|
1277
|
+
row = list(self._probes[n].manifold.node_labels)
|
|
1278
|
+
if inj:
|
|
1279
|
+
row.append(NEUTRAL_LABEL) # index K → neutral
|
|
1280
|
+
labels.append(row)
|
|
1281
|
+
nd_counts = torch.tensor(nd_list, device=device, dtype=torch.long)
|
|
1282
|
+
self._flat_global = {
|
|
1283
|
+
"P": P, "nd_list": nd_list, "nd_off": nd_off, "nd_total": nd_total,
|
|
1284
|
+
"K_list": K_list, "top_n_list": top_n_list,
|
|
1285
|
+
"labels": labels,
|
|
1286
|
+
"Kmax": Kmax, "Rmax": Rmax,
|
|
1287
|
+
"topk_width": topk_width,
|
|
1288
|
+
"valid_mask": valid_mask, "nd_counts": nd_counts,
|
|
1289
|
+
"band_pad": band_pad, "logvol_pad": logvol_pad,
|
|
1290
|
+
"band_present_list": band_present_list,
|
|
1291
|
+
"band_present_any": any(band_present_list),
|
|
1292
|
+
"label_scale": label_scale,
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
layer_members: dict[int, list[int]] = {}
|
|
1296
|
+
for ci, n in enumerate(flat_names):
|
|
1297
|
+
for layer_idx in self._probes[n].manifold.layers:
|
|
1298
|
+
layer_members.setdefault(layer_idx, []).append(ci)
|
|
1299
|
+
|
|
1300
|
+
cache: dict[int, dict[str, Any]] = {}
|
|
1301
|
+
for layer_idx, cis in layer_members.items():
|
|
1302
|
+
present = [flat_names[ci] for ci in cis]
|
|
1303
|
+
whs = [self._probes[n].whitened[layer_idx] for n in present]
|
|
1304
|
+
X = whs[0].X.to(device)
|
|
1305
|
+
K_inv = whs[0].K_inv.to(device)
|
|
1306
|
+
lam = whs[0].lam
|
|
1307
|
+
basis_stack = torch.cat([w.basis.to(device) for w in whs], dim=0)
|
|
1308
|
+
means_stack = torch.stack([w.mean.to(device) for w in whs], dim=0)
|
|
1309
|
+
simeans = [
|
|
1310
|
+
_woodbury_apply(w.mean.to(device), X, K_inv, lam) for w in whs
|
|
1311
|
+
]
|
|
1312
|
+
gmean_stack = torch.cat(
|
|
1313
|
+
[w.basis.to(device) @ sm
|
|
1314
|
+
for w, sm in zip(whs, simeans, strict=True)],
|
|
1315
|
+
dim=0,
|
|
1316
|
+
)
|
|
1317
|
+
mm_stack = torch.stack(
|
|
1318
|
+
[(w.mean.to(device) * sm).sum()
|
|
1319
|
+
for w, sm in zip(whs, simeans, strict=True)],
|
|
1320
|
+
)
|
|
1321
|
+
Mblk = torch.block_diag(*[w.m_r_inv.to(device) for w in whs])
|
|
1322
|
+
chol_blk = torch.block_diag(*[w.chol.to(device) for w in whs])
|
|
1323
|
+
coordS_blk = torch.block_diag(*[
|
|
1324
|
+
w.coord_S.to(device) if w.coord_S is not None
|
|
1325
|
+
else torch.eye(
|
|
1326
|
+
int(w.basis.shape[0]), device=device, dtype=torch.float32,
|
|
1327
|
+
)
|
|
1328
|
+
for w in whs
|
|
1329
|
+
])
|
|
1330
|
+
coordb_stack = torch.cat([
|
|
1331
|
+
w.coord_b.to(device) if w.coord_b is not None
|
|
1332
|
+
else torch.zeros(
|
|
1333
|
+
int(w.basis.shape[0]), device=device, dtype=torch.float32,
|
|
1334
|
+
)
|
|
1335
|
+
for w in whs
|
|
1336
|
+
])
|
|
1337
|
+
wt = torch.tensor(
|
|
1338
|
+
[float(self._probes[n].share_weights[layer_idx])
|
|
1339
|
+
for n in present],
|
|
1340
|
+
device=device, dtype=torch.float32,
|
|
1341
|
+
)
|
|
1342
|
+
# scatter indices + padded node coords
|
|
1343
|
+
seg_ids_list: list[int] = []
|
|
1344
|
+
cq_scatter_list: list[int] = []
|
|
1345
|
+
coords_gidx_list: list[int] = []
|
|
1346
|
+
wt_perdim_list: list[float] = []
|
|
1347
|
+
present_nd: list[int] = []
|
|
1348
|
+
node_pad = torch.zeros((len(present), Kmax, Rmax),
|
|
1349
|
+
device=device, dtype=torch.float32)
|
|
1350
|
+
for li, (n, w) in enumerate(zip(present, whs, strict=True)):
|
|
1351
|
+
Rp = int(w.basis.shape[0])
|
|
1352
|
+
seg_ids_list.extend([li] * Rp)
|
|
1353
|
+
cq_scatter_list.extend(range(li * Rmax, li * Rmax + Rp))
|
|
1354
|
+
ndp = nd_list[cis[li]]
|
|
1355
|
+
present_nd.append(ndp)
|
|
1356
|
+
g_off = nd_off[cis[li]][0]
|
|
1357
|
+
coords_gidx_list.extend(range(g_off, g_off + ndp))
|
|
1358
|
+
wt_perdim_list.extend([li] * ndp) # local index → weight gather
|
|
1359
|
+
nw = w.node_white.to(device) # (K_p, Rp)
|
|
1360
|
+
node_pad[li, :nw.shape[0], :Rp] = nw
|
|
1361
|
+
wt_perdim = wt[torch.tensor(
|
|
1362
|
+
wt_perdim_list, device=device, dtype=torch.long,
|
|
1363
|
+
)] if wt_perdim_list else wt.new_zeros(0)
|
|
1364
|
+
cache[layer_idx] = {
|
|
1365
|
+
"X": X, "K_inv": K_inv, "lam": lam,
|
|
1366
|
+
"basis_stack": basis_stack, "means_stack": means_stack,
|
|
1367
|
+
"gmean_stack": gmean_stack, "mm_stack": mm_stack,
|
|
1368
|
+
"Mblk": Mblk, "chol_blk": chol_blk,
|
|
1369
|
+
"coordS_blk": coordS_blk, "coordb_stack": coordb_stack,
|
|
1370
|
+
"wt": wt,
|
|
1371
|
+
"seg_ids": torch.tensor(seg_ids_list, device=device, dtype=torch.long),
|
|
1372
|
+
"cq_scatter": torch.tensor(cq_scatter_list, device=device, dtype=torch.long),
|
|
1373
|
+
"coords_gidx": torch.tensor(coords_gidx_list, device=device, dtype=torch.long),
|
|
1374
|
+
"wt_perdim": wt_perdim,
|
|
1375
|
+
"cols": torch.tensor(cis, device=device, dtype=torch.long),
|
|
1376
|
+
"cols_list": list(cis),
|
|
1377
|
+
"present_nd": present_nd,
|
|
1378
|
+
"node_pad": node_pad,
|
|
1379
|
+
}
|
|
1380
|
+
self._flat_layer_cache = cache
|
|
1381
|
+
|
|
1382
|
+
def _score_flat_batched(
|
|
1383
|
+
self, hidden_per_layer: dict[int, torch.Tensor],
|
|
1384
|
+
sih_cache: dict[int, torch.Tensor] | None = None,
|
|
1385
|
+
*,
|
|
1386
|
+
coords_only: bool = False,
|
|
1387
|
+
) -> dict[str, ProbeReading]:
|
|
1388
|
+
"""Score the whole flat roster in one batched sweep + one host transfer.
|
|
1389
|
+
|
|
1390
|
+
Phase 1 (per layer, batched over every flat probe): one ``Σ⁻¹h``
|
|
1391
|
+
Woodbury apply, stacked / block-diagonal matmuls for reduced coords,
|
|
1392
|
+
domain coords, fraction, and a padded ``(P_L, Kmax)`` nearest-distance
|
|
1393
|
+
norm — each scattered straight into global per-probe accumulators
|
|
1394
|
+
(``frac_acc`` / ``coords_acc`` / ``dist_acc`` / ``wtsum``). Phase 2
|
|
1395
|
+
(device): share-normalize, one global ``topk`` sized to the largest requested
|
|
1396
|
+
``top_n`` for nearest, and **one**
|
|
1397
|
+
``.cpu()`` for the entire roster (means + per-layer traces + nearest).
|
|
1398
|
+
Phase 3 (host): slice the flat blob back into per-probe
|
|
1399
|
+
:class:`ProbeReading`s. Values match the per-probe path (the aggregate
|
|
1400
|
+
uses) to float tolerance.
|
|
1401
|
+
|
|
1402
|
+
``sih_cache`` (optional, keyed by layer) is the per-pass ``Σ⁻¹h`` cache
|
|
1403
|
+
shared with the curved per-probe path: the apply depends only on the
|
|
1404
|
+
layer's hidden state + the shared whitener (identical Woodbury factors),
|
|
1405
|
+
so a mixed flat+curved roster computes ``Σ⁻¹h`` once per layer total.
|
|
1406
|
+
"""
|
|
1407
|
+
gl = self._flat_global
|
|
1408
|
+
cache = self._flat_layer_cache
|
|
1409
|
+
if not gl or not cache:
|
|
1410
|
+
return {}
|
|
1411
|
+
P = gl["P"]
|
|
1412
|
+
Kmax = gl["Kmax"]
|
|
1413
|
+
Rmax = gl["Rmax"]
|
|
1414
|
+
topk_width = gl["topk_width"]
|
|
1415
|
+
flat_names = self._flat_keys
|
|
1416
|
+
device = gl["valid_mask"].device
|
|
1417
|
+
|
|
1418
|
+
frac_acc = torch.zeros(P, device=device, dtype=torch.float32)
|
|
1419
|
+
wtsum = torch.zeros(P, device=device, dtype=torch.float32)
|
|
1420
|
+
coords_acc = torch.zeros(gl["nd_total"], device=device, dtype=torch.float32)
|
|
1421
|
+
dist_acc = torch.zeros((P, Kmax), device=device, dtype=torch.float32)
|
|
1422
|
+
# Per-layer trace pieces (raw, unweighted) for the single transfer.
|
|
1423
|
+
trace_frac: list[torch.Tensor] = []
|
|
1424
|
+
trace_coords: list[torch.Tensor] = []
|
|
1425
|
+
trace_layers: list[int] = []
|
|
1426
|
+
seen: set[int] = set()
|
|
1427
|
+
|
|
1428
|
+
for layer_idx, h in hidden_per_layer.items():
|
|
1429
|
+
ent = cache.get(layer_idx)
|
|
1430
|
+
if ent is None:
|
|
1431
|
+
continue
|
|
1432
|
+
hf = h.to(torch.float32)
|
|
1433
|
+
if hf.ndim > 1:
|
|
1434
|
+
hf = hf.reshape(-1, hf.shape[-1])[-1]
|
|
1435
|
+
# Σ⁻¹h — probe-independent, so share it with the curved per-probe
|
|
1436
|
+
# path via the per-pass cache (same Woodbury factors per layer).
|
|
1437
|
+
sih = None if sih_cache is None else sih_cache.get(layer_idx)
|
|
1438
|
+
if sih is None:
|
|
1439
|
+
sih = _woodbury_apply(hf, ent["X"], ent["K_inv"], ent["lam"])
|
|
1440
|
+
if sih_cache is not None:
|
|
1441
|
+
sih_cache[layer_idx] = sih
|
|
1442
|
+
h_sih = (hf * sih).sum()
|
|
1443
|
+
g_all = ent["basis_stack"] @ sih - ent["gmean_stack"] # (ΣR,)
|
|
1444
|
+
c_all = ent["Mblk"] @ g_all # (ΣR,)
|
|
1445
|
+
coords_all = ent["coordS_blk"] @ c_all + ent["coordb_stack"] # (Σnd_L,)
|
|
1446
|
+
hsm = ent["means_stack"] @ sih # (P_L,)
|
|
1447
|
+
cols = ent["cols"]
|
|
1448
|
+
n_present = cols.shape[0]
|
|
1449
|
+
par2 = torch.zeros(
|
|
1450
|
+
n_present, device=device, dtype=torch.float32,
|
|
1451
|
+
).index_add_(0, ent["seg_ids"], g_all * c_all) # (P_L,)
|
|
1452
|
+
x_m2 = (h_sih - 2.0 * hsm + ent["mm_stack"]).clamp(min=_FRACTION_EPSILON)
|
|
1453
|
+
frac = (par2.clamp(min=0.0).sqrt() / x_m2.sqrt()).clamp(0.0, 1.0) # (P_L,)
|
|
1454
|
+
|
|
1455
|
+
wt = ent["wt"]
|
|
1456
|
+
frac_acc.index_add_(0, cols, wt * frac)
|
|
1457
|
+
wtsum.index_add_(0, cols, wt)
|
|
1458
|
+
coords_acc.index_add_(0, ent["coords_gidx"], ent["wt_perdim"] * coords_all)
|
|
1459
|
+
seen.update(ent["cols_list"])
|
|
1460
|
+
if coords_only:
|
|
1461
|
+
# A live consumer that reads only the axis-0 coord /
|
|
1462
|
+
# fraction (the loom probe row) doesn't need the
|
|
1463
|
+
# nearest-distance norm over ``Kmax`` candidates, the assignment
|
|
1464
|
+
# softmax, or the host-side per-layer trace reconstruction — skip
|
|
1465
|
+
# them. The full aggregate (which DOES need them) is re-scored
|
|
1466
|
+
# once from the tail ring at finalize.
|
|
1467
|
+
continue
|
|
1468
|
+
cq_all = c_all @ ent["chol_blk"] # (ΣR,)
|
|
1469
|
+
# Nearest: scatter cq into a padded (P_L, Rmax) query, batched norm.
|
|
1470
|
+
cq_pad = torch.zeros(n_present * Rmax, device=device, dtype=torch.float32)
|
|
1471
|
+
cq_pad = cq_pad.index_copy_(0, ent["cq_scatter"], cq_all).reshape(n_present, Rmax)
|
|
1472
|
+
dist = torch.linalg.vector_norm(
|
|
1473
|
+
ent["node_pad"] - cq_pad.unsqueeze(1), dim=-1,
|
|
1474
|
+
) # (P_L, Kmax)
|
|
1475
|
+
dist_acc.index_add_(0, cols, dist * wt.unsqueeze(1))
|
|
1476
|
+
trace_frac.append(frac)
|
|
1477
|
+
trace_coords.append(coords_all)
|
|
1478
|
+
trace_layers.append(layer_idx)
|
|
1479
|
+
|
|
1480
|
+
# --- device finalize (share-normalize + one bounded global topk) ---
|
|
1481
|
+
wtsum_safe = wtsum.clamp(min=_FRACTION_EPSILON)
|
|
1482
|
+
frac_final = frac_acc / wtsum_safe
|
|
1483
|
+
coords_final = coords_acc / wtsum_safe.repeat_interleave(
|
|
1484
|
+
gl["nd_counts"],
|
|
1485
|
+
).clamp(min=_FRACTION_EPSILON)
|
|
1486
|
+
if coords_only:
|
|
1487
|
+
# Minimal blob: per-probe fraction + domain coords only.
|
|
1488
|
+
blob = torch.cat([frac_final, coords_final]).detach().cpu().tolist()
|
|
1489
|
+
frac_v = blob[:P]
|
|
1490
|
+
coords_v = blob[P:P + gl["nd_total"]]
|
|
1491
|
+
nd_off = gl["nd_off"]
|
|
1492
|
+
out: dict[str, ProbeReading] = {}
|
|
1493
|
+
for ci, name in enumerate(flat_names):
|
|
1494
|
+
if ci not in seen:
|
|
1495
|
+
out[name] = ProbeReading(fraction=0.0, nearest=[], coords=())
|
|
1496
|
+
continue
|
|
1497
|
+
g_off, nd = nd_off[ci]
|
|
1498
|
+
out[name] = ProbeReading(
|
|
1499
|
+
fraction=frac_v[ci],
|
|
1500
|
+
nearest=[],
|
|
1501
|
+
coords=tuple(coords_v[g_off:g_off + nd]),
|
|
1502
|
+
residual=0.0,
|
|
1503
|
+
assignment=[],
|
|
1504
|
+
membership=1.0,
|
|
1505
|
+
)
|
|
1506
|
+
return out
|
|
1507
|
+
dist_final = (dist_acc / wtsum_safe.unsqueeze(1)).masked_fill(
|
|
1508
|
+
~gl["valid_mask"], float("inf"),
|
|
1509
|
+
)
|
|
1510
|
+
if topk_width:
|
|
1511
|
+
# Rank by **raw** distance (``nearest`` stays literally nearest), then
|
|
1512
|
+
# divide the reported top-N distances by each probe's ``label_scale``
|
|
1513
|
+
# (a per-probe constant ⇒ no reordering) for a portable ``@label``
|
|
1514
|
+
# gate — distance in "typical label-spacings"; see ``_score_probe_full``.
|
|
1515
|
+
# Assignment below keeps the raw ``dist_final``.
|
|
1516
|
+
nd_sorted, ni_sorted = torch.topk(
|
|
1517
|
+
dist_final, k=topk_width, largest=False, sorted=True,
|
|
1518
|
+
) # (P, topk_width)
|
|
1519
|
+
nd_sorted = nd_sorted / gl["label_scale"].unsqueeze(1)
|
|
1520
|
+
else:
|
|
1521
|
+
nd_sorted = dist_final.new_zeros((P, 0))
|
|
1522
|
+
ni_sorted = torch.empty((P, 0), device=device, dtype=torch.long)
|
|
1523
|
+
# Soft assignment: softmax(−d²/(2τ²) − R·log(τ)) per probe over valid
|
|
1524
|
+
# candidates (invalid columns are +inf distance ⇒ −inf logit ⇒ 0
|
|
1525
|
+
# probability), top-``topk_width`` by probability. ``band_pad`` is the
|
|
1526
|
+
# precomputed per-candidate bandwidth, ``logvol_pad`` the precomputed
|
|
1527
|
+
# ``−R·log(τ)`` Gaussian normalization bias; together they make a proper
|
|
1528
|
+
# isotropic R-D mixture posterior (vs. the bare ``−d²/2τ²`` softmax's
|
|
1529
|
+
# broadest-node-wins pathology). Rows without a bandwidth get the
|
|
1530
|
+
# neutral defaults (band=1, bias=0) so the blob shape is static
|
|
1531
|
+
# (suppressed per-probe on the host via ``band_present``).
|
|
1532
|
+
if topk_width and gl["band_present_any"]:
|
|
1533
|
+
assign_logits = -(dist_final ** 2) / (
|
|
1534
|
+
2.0 * (gl["band_pad"] ** 2).clamp(min=_FRACTION_EPSILON)
|
|
1535
|
+
) + gl["logvol_pad"]
|
|
1536
|
+
assign_probs = torch.softmax(assign_logits, dim=1) # (P, Kmax)
|
|
1537
|
+
ap_sorted, ai_sorted = torch.topk(
|
|
1538
|
+
assign_probs, k=topk_width, largest=True, sorted=True,
|
|
1539
|
+
) # (P, topk_width)
|
|
1540
|
+
else:
|
|
1541
|
+
ap_sorted = dist_final.new_zeros((P, topk_width))
|
|
1542
|
+
ai_sorted = torch.zeros((P, topk_width), device=device, dtype=torch.long)
|
|
1543
|
+
|
|
1544
|
+
all_frac = (
|
|
1545
|
+
torch.cat(trace_frac) if trace_frac
|
|
1546
|
+
else frac_final.new_zeros(0)
|
|
1547
|
+
)
|
|
1548
|
+
all_coords = (
|
|
1549
|
+
torch.cat(trace_coords) if trace_coords
|
|
1550
|
+
else coords_final.new_zeros(0)
|
|
1551
|
+
)
|
|
1552
|
+
blob = torch.cat([
|
|
1553
|
+
frac_final, coords_final,
|
|
1554
|
+
nd_sorted.reshape(-1), ni_sorted.to(torch.float32).reshape(-1),
|
|
1555
|
+
ap_sorted.reshape(-1), ai_sorted.to(torch.float32).reshape(-1),
|
|
1556
|
+
all_frac, all_coords,
|
|
1557
|
+
]).detach().cpu().tolist()
|
|
1558
|
+
|
|
1559
|
+
# --- host reconstruction (one slice walk; no per-probe sync) ---
|
|
1560
|
+
nd_off = gl["nd_off"]
|
|
1561
|
+
top_n_list = gl["top_n_list"]
|
|
1562
|
+
labels = gl["labels"]
|
|
1563
|
+
o = 0
|
|
1564
|
+
frac_v = blob[o:o + P]
|
|
1565
|
+
o += P
|
|
1566
|
+
coords_v = blob[o:o + gl["nd_total"]]
|
|
1567
|
+
o += gl["nd_total"]
|
|
1568
|
+
nd_v = blob[o:o + P * topk_width]
|
|
1569
|
+
o += P * topk_width
|
|
1570
|
+
ni_v = blob[o:o + P * topk_width]
|
|
1571
|
+
o += P * topk_width
|
|
1572
|
+
ap_v = blob[o:o + P * topk_width]
|
|
1573
|
+
o += P * topk_width
|
|
1574
|
+
ai_v = blob[o:o + P * topk_width]
|
|
1575
|
+
o += P * topk_width
|
|
1576
|
+
band_present = gl["band_present_list"]
|
|
1577
|
+
# per-layer trace offsets within all_frac / all_coords
|
|
1578
|
+
frac_per_layer_acc: list[dict[int, float]] = [{} for _ in range(P)]
|
|
1579
|
+
coords_per_layer_acc: list[dict[int, tuple[float, ...]]] = [{} for _ in range(P)]
|
|
1580
|
+
residual_per_layer_acc: list[dict[int, float]] = [{} for _ in range(P)]
|
|
1581
|
+
fo = o
|
|
1582
|
+
co = o + all_frac.numel()
|
|
1583
|
+
for layer_idx in trace_layers:
|
|
1584
|
+
ent = cache[layer_idx]
|
|
1585
|
+
cols_list = ent["cols_list"]
|
|
1586
|
+
present_nd = ent["present_nd"]
|
|
1587
|
+
ndo = co
|
|
1588
|
+
for li, ci in enumerate(cols_list):
|
|
1589
|
+
frac_per_layer_acc[ci][layer_idx] = blob[fo + li]
|
|
1590
|
+
ndp = present_nd[li]
|
|
1591
|
+
coords_per_layer_acc[ci][layer_idx] = tuple(blob[ndo:ndo + ndp])
|
|
1592
|
+
residual_per_layer_acc[ci][layer_idx] = 0.0
|
|
1593
|
+
ndo += ndp
|
|
1594
|
+
fo += len(cols_list)
|
|
1595
|
+
co += sum(present_nd)
|
|
1596
|
+
|
|
1597
|
+
out: dict[str, ProbeReading] = {}
|
|
1598
|
+
for ci, name in enumerate(flat_names):
|
|
1599
|
+
if ci not in seen:
|
|
1600
|
+
out[name] = ProbeReading(fraction=0.0, nearest=[], coords=())
|
|
1601
|
+
continue
|
|
1602
|
+
g_off, nd = nd_off[ci]
|
|
1603
|
+
top_n = top_n_list[ci]
|
|
1604
|
+
row = ci * topk_width
|
|
1605
|
+
nearest = [
|
|
1606
|
+
(labels[ci][int(round(ni_v[row + j]))], nd_v[row + j])
|
|
1607
|
+
for j in range(top_n)
|
|
1608
|
+
]
|
|
1609
|
+
assignment: list[tuple[str, float]] = []
|
|
1610
|
+
if band_present[ci]:
|
|
1611
|
+
assignment = [
|
|
1612
|
+
(labels[ci][int(round(ai_v[row + j]))], ap_v[row + j])
|
|
1613
|
+
for j in range(top_n)
|
|
1614
|
+
]
|
|
1615
|
+
depth_com, depth_spread = _depth_stats(
|
|
1616
|
+
coords_per_layer_acc[ci],
|
|
1617
|
+
self._probes[name].share_weights,
|
|
1618
|
+
self._depth_denom,
|
|
1619
|
+
)
|
|
1620
|
+
out[name] = ProbeReading(
|
|
1621
|
+
fraction=frac_v[ci],
|
|
1622
|
+
nearest=nearest,
|
|
1623
|
+
coords=tuple(coords_v[g_off:g_off + nd]),
|
|
1624
|
+
residual=0.0,
|
|
1625
|
+
fraction_per_layer=frac_per_layer_acc[ci],
|
|
1626
|
+
coords_per_layer=coords_per_layer_acc[ci],
|
|
1627
|
+
residual_per_layer=residual_per_layer_acc[ci],
|
|
1628
|
+
assignment=assignment,
|
|
1629
|
+
membership=1.0,
|
|
1630
|
+
depth_com=depth_com,
|
|
1631
|
+
depth_spread=depth_spread,
|
|
1632
|
+
)
|
|
1633
|
+
return out
|
|
1634
|
+
|
|
1635
|
+
def _score_tokens(
|
|
1636
|
+
self,
|
|
1637
|
+
hidden_per_layer: dict[int, torch.Tensor],
|
|
1638
|
+
accumulate: bool = True,
|
|
1639
|
+
*,
|
|
1640
|
+
only: set[str] | None = None,
|
|
1641
|
+
coords_only: bool = False,
|
|
1642
|
+
) -> dict[str, ProbeReading]:
|
|
1643
|
+
"""Score every probe → ``{name: ProbeReading}`` (full reading).
|
|
1644
|
+
|
|
1645
|
+
``accumulate`` folds the cross-layer coords into history/stats (the
|
|
1646
|
+
in-flight per-token path passes False). ``only`` restricts scoring to
|
|
1647
|
+
a subset (gate-only per-token path); a subset read never accumulates
|
|
1648
|
+
(the cross-gen stats want the full roster, not the gated probes alone).
|
|
1649
|
+
``coords_only`` returns the lean coords+fraction reading.
|
|
1650
|
+
"""
|
|
1651
|
+
out = self._score_full(
|
|
1652
|
+
hidden_per_layer, only=only, coords_only=coords_only,
|
|
1653
|
+
)
|
|
1654
|
+
if out and accumulate and only is None:
|
|
1655
|
+
self._apply_accumulate(out)
|
|
1656
|
+
return out
|
|
1657
|
+
|
|
1658
|
+
def _apply_accumulate(
|
|
1659
|
+
self, readings: dict[str, ProbeReading],
|
|
1660
|
+
) -> None:
|
|
1661
|
+
"""Fold per-probe aggregate coordinates into monitor history."""
|
|
1662
|
+
for name, reading in readings.items():
|
|
1663
|
+
if name not in self.history:
|
|
1664
|
+
continue
|
|
1665
|
+
coords = reading.coords or (0.0,)
|
|
1666
|
+
self.history[name].append(tuple(coords))
|
|
1667
|
+
|
|
1668
|
+
def accumulate_readings(
|
|
1669
|
+
self, readings: dict[str, ProbeReading],
|
|
1670
|
+
) -> None:
|
|
1671
|
+
"""Fold an already-scored aggregate into history/stats.
|
|
1672
|
+
|
|
1673
|
+
The normal stack-scoring path scores and accumulates in one call. The
|
|
1674
|
+
incremental capture path scores each token live, so finalization already
|
|
1675
|
+
has the aggregate ``ProbeReading`` and should not rescore just to update
|
|
1676
|
+
cross-generation stats.
|
|
1677
|
+
"""
|
|
1678
|
+
self._apply_accumulate(readings)
|
|
1679
|
+
|
|
1680
|
+
def score_single_token(
|
|
1681
|
+
self, hidden_per_layer: dict[int, torch.Tensor],
|
|
1682
|
+
*, only: set[str] | None = None, coords_only: bool = False,
|
|
1683
|
+
) -> dict[str, "ProbeReading"]:
|
|
1684
|
+
"""Per-probe full reading for a single token (no accumulate).
|
|
1685
|
+
|
|
1686
|
+
The live per-token read source: returns ``{name: ProbeReading}``
|
|
1687
|
+
with ``coords`` (domain frame) + ``fraction`` + ``nearest`` +
|
|
1688
|
+
``residual`` and their per-layer traces, every probe (flat or curved).
|
|
1689
|
+
Does NOT touch history/stats — the in-flight gate/stream path must
|
|
1690
|
+
not corrupt the session-level accumulators.
|
|
1691
|
+
|
|
1692
|
+
``only`` (a set of probe names) scores just that subset, returning
|
|
1693
|
+
``{name: ProbeReading}`` for the subset alone — the gate-only per-token
|
|
1694
|
+
path, where the step sink consumes just the gated probes' scalars and
|
|
1695
|
+
the big-K roster's nearest-distance work is pure waste. ``only=None``
|
|
1696
|
+
keeps the byte-identical full-roster behavior. ``coords_only``
|
|
1697
|
+
returns the lean coords+fraction reading (no nearest / assignment /
|
|
1698
|
+
per-layer trace) for the axis-0-only live consumers.
|
|
1699
|
+
"""
|
|
1700
|
+
return self._score_tokens(
|
|
1701
|
+
hidden_per_layer, accumulate=False, only=only,
|
|
1702
|
+
coords_only=coords_only,
|
|
1703
|
+
)
|
|
1704
|
+
|
|
1705
|
+
def measure_from_hidden(
|
|
1706
|
+
self, hidden_per_layer: dict[int, torch.Tensor], accumulate: bool = True,
|
|
1707
|
+
) -> dict[str, "ProbeReading"]:
|
|
1708
|
+
"""Score probes from pre-captured hidden states (no forward pass).
|
|
1709
|
+
|
|
1710
|
+
Use when hidden states have already been captured during generation
|
|
1711
|
+
(e.g. via capture hooks), avoiding a redundant forward pass.
|
|
1712
|
+
"""
|
|
1713
|
+
return self._score_tokens(hidden_per_layer, accumulate=accumulate)
|
|
1714
|
+
|
|
1715
|
+
@staticmethod
|
|
1716
|
+
def flat_scalars(
|
|
1717
|
+
readings: dict[str, "ProbeReading"],
|
|
1718
|
+
) -> dict[str, float]:
|
|
1719
|
+
"""Flatten per-probe readings into namespaced gate-callback scalars.
|
|
1720
|
+
|
|
1721
|
+
The single gate emitter for every probe shape. For each probe emits
|
|
1722
|
+
the bare ``"<probe>"`` aliased to coordinate axis 0 (so
|
|
1723
|
+
``@when:angry.calm > 0.4`` reads the single coord of a 2-node concept
|
|
1724
|
+
unchanged), one ``"<probe>[<i>]"`` per coordinate axis (so
|
|
1725
|
+
``@when:personas[3] > 0.4`` indexes an axis), ``"<probe>:fraction"``,
|
|
1726
|
+
and one ``"<probe>@<label>"`` per nearest node as ``-distance`` (so
|
|
1727
|
+
larger means closer and ``@when:emotions@happy > -0.1`` reads like a
|
|
1728
|
+
similarity gate). Under the unified full reading every probe — flat
|
|
1729
|
+
and curved — carries coords *and* nearest, so flat probes now expose
|
|
1730
|
+
``@label`` similarity gates too (e.g. ``@when:personas@hacker``) and
|
|
1731
|
+
the gate grammar is uniform.
|
|
1732
|
+
|
|
1733
|
+
**Fuzzy channels** (additive — the ``@label`` distance gates are
|
|
1734
|
+
untouched): one ``"<probe>~<label>"`` per assigned node as the
|
|
1735
|
+
soft-assignment *probability* (``@when:personas~hacker > 0.5`` — a
|
|
1736
|
+
normalized, in-``[0,1]`` membership gate, unlike the unbounded
|
|
1737
|
+
``-distance``), and ``"<probe>:membership"`` as the graded tube-fit
|
|
1738
|
+
(``@when:emotions:membership > 0.6`` — high when the activation sits
|
|
1739
|
+
inside the manifold's learned thickness). All shapes merge directly into
|
|
1740
|
+
``TriggerContext.probe_scores``.
|
|
1741
|
+
"""
|
|
1742
|
+
out: dict[str, float] = {}
|
|
1743
|
+
for name, reading in readings.items():
|
|
1744
|
+
coords = reading.coords
|
|
1745
|
+
if coords:
|
|
1746
|
+
out[name] = coords[0]
|
|
1747
|
+
for i, c in enumerate(coords):
|
|
1748
|
+
out[f"{name}[{i}]"] = c
|
|
1749
|
+
out[f"{name}:fraction"] = reading.fraction
|
|
1750
|
+
for label, dist in reading.nearest:
|
|
1751
|
+
out[f"{name}@{label}"] = -dist
|
|
1752
|
+
for label, prob in reading.assignment:
|
|
1753
|
+
out[f"{name}~{label}"] = prob
|
|
1754
|
+
out[f"{name}:membership"] = reading.membership
|
|
1755
|
+
return out
|
|
1756
|
+
|
|
1757
|
+
def _per_token_coord_stream(
|
|
1758
|
+
self, captured: dict[int, torch.Tensor], n: int,
|
|
1759
|
+
) -> dict[str, list[float]]:
|
|
1760
|
+
"""Axis-0 domain-coordinate stream per probe over ``n`` tokens.
|
|
1761
|
+
|
|
1762
|
+
Each token is scored ``coords_only`` (the flat affine map + curved foot
|
|
1763
|
+
solve that axis 0 needs, skipping the big-K nearest norm, soft
|
|
1764
|
+
assignment, and per-layer host reconstruction this stream discards), so
|
|
1765
|
+
curved probes still carry a real per-token coord stream (not zeros).
|
|
1766
|
+
Row ``i`` reads ``captured[L][i]`` (guarded), so an EOS overshoot is
|
|
1767
|
+
ignored and a short capture leaves trailing zeros.
|
|
1768
|
+
"""
|
|
1769
|
+
per_token: dict[str, list[float]] = {name: [0.0] * n for name in self._probes}
|
|
1770
|
+
if not self._probes:
|
|
1771
|
+
return per_token
|
|
1772
|
+
for i in range(n):
|
|
1773
|
+
tok = {L: h[i] for L, h in captured.items() if h.shape[0] > i}
|
|
1774
|
+
if not tok:
|
|
1775
|
+
continue
|
|
1776
|
+
for name, reading in self._score_full(tok, coords_only=True).items():
|
|
1777
|
+
per_token[name][i] = reading.coords[0] if reading.coords else 0.0
|
|
1778
|
+
return per_token
|
|
1779
|
+
|
|
1780
|
+
def score_per_token(
|
|
1781
|
+
self,
|
|
1782
|
+
captured: dict[int, torch.Tensor],
|
|
1783
|
+
generated_ids: list[int],
|
|
1784
|
+
tokenizer: Any,
|
|
1785
|
+
*,
|
|
1786
|
+
accumulate: bool = True,
|
|
1787
|
+
aggregate_index: int | None = None,
|
|
1788
|
+
) -> tuple[dict[str, "ProbeReading"], dict[str, list[float]]]:
|
|
1789
|
+
"""Score probes per generated token using pre-captured hidden states.
|
|
1790
|
+
|
|
1791
|
+
``captured[layer_idx]`` is a ``(n, dim)`` stack where row ``k`` is
|
|
1792
|
+
the hidden state that produced generated token ``k``. Returns
|
|
1793
|
+
``(aggregate_readings, per_token_coord_stream)``: the aggregate is
|
|
1794
|
+
the full :class:`ProbeReading` per probe pooled at the last
|
|
1795
|
+
non-special token (updates history when ``accumulate``); the stream
|
|
1796
|
+
is the per-token axis-0 domain coordinate.
|
|
1797
|
+
"""
|
|
1798
|
+
n = len(generated_ids)
|
|
1799
|
+
empty_agg = {
|
|
1800
|
+
name: ProbeReading(fraction=0.0, nearest=[], coords=())
|
|
1801
|
+
for name in self._probes
|
|
1802
|
+
}
|
|
1803
|
+
if n == 0 or not captured:
|
|
1804
|
+
return empty_agg, {name: [] for name in self._probes}
|
|
1805
|
+
|
|
1806
|
+
if aggregate_index is not None and int(aggregate_index) < 0:
|
|
1807
|
+
agg = empty_agg
|
|
1808
|
+
per_token = self._per_token_coord_stream(captured, n)
|
|
1809
|
+
return agg, per_token
|
|
1810
|
+
if aggregate_index is None:
|
|
1811
|
+
from drowse.core.capture import last_content_index
|
|
1812
|
+
agg_idx = last_content_index(generated_ids, tokenizer)
|
|
1813
|
+
else:
|
|
1814
|
+
agg_idx = max(0, min(int(aggregate_index), n - 1))
|
|
1815
|
+
agg_hidden = {
|
|
1816
|
+
layer_idx: h[agg_idx] for layer_idx, h in captured.items()
|
|
1817
|
+
if h.shape[0] > agg_idx
|
|
1818
|
+
}
|
|
1819
|
+
agg = self._score_tokens(agg_hidden, accumulate=accumulate)
|
|
1820
|
+
per_token = self._per_token_coord_stream(captured, n)
|
|
1821
|
+
return agg, per_token
|
|
1822
|
+
|
|
1823
|
+
def score_stack(
|
|
1824
|
+
self,
|
|
1825
|
+
captured: dict[int, torch.Tensor],
|
|
1826
|
+
*,
|
|
1827
|
+
agg_index: int | None = None,
|
|
1828
|
+
accumulate: bool = False,
|
|
1829
|
+
) -> tuple[dict[str, "ProbeReading"], dict[str, list[float]]]:
|
|
1830
|
+
"""Score probes over a pre-captured ``[T, D]`` stack per layer.
|
|
1831
|
+
|
|
1832
|
+
Like :meth:`score_per_token` but without ``generated_ids`` /
|
|
1833
|
+
tokenizer — the caller has already chosen the meaningful rows.
|
|
1834
|
+
Aggregate is pooled from row ``agg_index`` (default the last row).
|
|
1835
|
+
``accumulate`` defaults to ``False`` (ad-hoc researcher probing,
|
|
1836
|
+
not the in-flight loop).
|
|
1837
|
+
"""
|
|
1838
|
+
empty_agg = {
|
|
1839
|
+
name: ProbeReading(fraction=0.0, nearest=[], coords=())
|
|
1840
|
+
for name in self._probes
|
|
1841
|
+
}
|
|
1842
|
+
if not captured:
|
|
1843
|
+
return empty_agg, {name: [] for name in self._probes}
|
|
1844
|
+
|
|
1845
|
+
any_h = next(iter(captured.values()))
|
|
1846
|
+
if any_h.ndim != 2:
|
|
1847
|
+
raise ValueError(
|
|
1848
|
+
f"score_stack expects [T, D] per layer; got shape {tuple(any_h.shape)}",
|
|
1849
|
+
)
|
|
1850
|
+
n = any_h.shape[0]
|
|
1851
|
+
if n == 0:
|
|
1852
|
+
return empty_agg, {name: [] for name in self._probes}
|
|
1853
|
+
|
|
1854
|
+
# Uniform T across layers — mixed lengths are a caller bug.
|
|
1855
|
+
for layer_idx, h in captured.items():
|
|
1856
|
+
if h.ndim != 2 or h.shape[0] != n:
|
|
1857
|
+
raise ValueError(
|
|
1858
|
+
f"score_stack: layer {layer_idx} has shape {tuple(h.shape)}, "
|
|
1859
|
+
f"expected [{n}, D]",
|
|
1860
|
+
)
|
|
1861
|
+
|
|
1862
|
+
agg_row = n - 1 if agg_index is None else int(agg_index)
|
|
1863
|
+
if not (0 <= agg_row < n):
|
|
1864
|
+
raise ValueError(
|
|
1865
|
+
f"score_stack: agg_index={agg_index} out of range for T={n}",
|
|
1866
|
+
)
|
|
1867
|
+
|
|
1868
|
+
# T-uniformity validated above and agg_row < n; no per-layer
|
|
1869
|
+
# shape guard is needed (unlike score_per_token, which operates
|
|
1870
|
+
# on raw hook captures that can be ragged by one around EOS).
|
|
1871
|
+
agg_hidden = {
|
|
1872
|
+
layer_idx: h[agg_row] for layer_idx, h in captured.items()
|
|
1873
|
+
}
|
|
1874
|
+
agg = self._score_tokens(agg_hidden, accumulate=accumulate)
|
|
1875
|
+
per_token = self._per_token_coord_stream(captured, n)
|
|
1876
|
+
return agg, per_token
|
|
1877
|
+
|
|
1878
|
+
def add_probe(self, name: str, manifold: "Manifold", *, top_n: int = DEFAULT_NEAREST_TOP_N):
|
|
1879
|
+
"""Register a :class:`Manifold` probe — flat (any rank) or curved.
|
|
1880
|
+
|
|
1881
|
+
Pre-caches the per-layer node values + EV weights + whitened factors
|
|
1882
|
+
(and, for a flat fit, the affine reduced→domain coord map) via
|
|
1883
|
+
:func:`_attach_manifold_probe`; the wired whitener must cover the
|
|
1884
|
+
fit's layers. Flat vs curved is cached once on the attached probe.
|
|
1885
|
+
"""
|
|
1886
|
+
is_new = name not in self._probes
|
|
1887
|
+
self._probes[name] = _attach_manifold_probe(
|
|
1888
|
+
name, manifold, top_n=top_n, whitener=self._whitener,
|
|
1889
|
+
factor_cache=self._whitener_factor_cache,
|
|
1890
|
+
)
|
|
1891
|
+
self._invalidate_flat_cache()
|
|
1892
|
+
if is_new:
|
|
1893
|
+
self.history[name] = deque(maxlen=_MAX_HISTORY)
|
|
1894
|
+
|
|
1895
|
+
def remove_probe(self, name: str):
|
|
1896
|
+
self._probes.pop(name, None)
|
|
1897
|
+
self._whitener_factor_cache.clear()
|
|
1898
|
+
self._invalidate_flat_cache()
|
|
1899
|
+
if name in self.history:
|
|
1900
|
+
del self.history[name]
|
|
1901
|
+
|
|
1902
|
+
def attached_probes(self) -> dict[str, "AttachedManifoldProbe"]:
|
|
1903
|
+
"""Live attached-probe map (read-only view) — name → probe."""
|
|
1904
|
+
return dict(self._probes)
|
|
1905
|
+
|
|
1906
|
+
def reset_history(self):
|
|
1907
|
+
for name in self._probes:
|
|
1908
|
+
self.history[name].clear()
|
|
1909
|
+
|
|
1910
|
+
def score_aggregate(
|
|
1911
|
+
self,
|
|
1912
|
+
captured_per_layer: dict[int, torch.Tensor],
|
|
1913
|
+
*,
|
|
1914
|
+
agg_index: int | None = None,
|
|
1915
|
+
) -> dict[str, ProbeReading]:
|
|
1916
|
+
"""End-of-generation aggregate over pooled captures — all probes.
|
|
1917
|
+
|
|
1918
|
+
``captured_per_layer[L]`` is the per-layer ``[T, D]`` capture stack.
|
|
1919
|
+
The pooled activation is the **last non-special token** (``agg_index``,
|
|
1920
|
+
default the final row) — the same single-state discipline extraction
|
|
1921
|
+
uses, not a trajectory mean. It routes through the same full scorer
|
|
1922
|
+
as live single-token reads, so flat probe rosters use the batched
|
|
1923
|
+
Woodbury path while curved probes keep their per-probe foot solve.
|
|
1924
|
+
"""
|
|
1925
|
+
out: dict[str, ProbeReading] = {}
|
|
1926
|
+
if not captured_per_layer or not self._probes:
|
|
1927
|
+
return out
|
|
1928
|
+
|
|
1929
|
+
pooled: dict[int, torch.Tensor] = {}
|
|
1930
|
+
for layer_idx, stack in captured_per_layer.items():
|
|
1931
|
+
if stack is None or stack.numel() == 0:
|
|
1932
|
+
continue
|
|
1933
|
+
if stack.ndim == 1:
|
|
1934
|
+
pooled[layer_idx] = stack.to(torch.float32)
|
|
1935
|
+
else:
|
|
1936
|
+
t = stack.shape[0]
|
|
1937
|
+
row = t - 1 if agg_index is None else max(0, min(agg_index, t - 1))
|
|
1938
|
+
pooled[layer_idx] = stack.to(torch.float32)[row]
|
|
1939
|
+
|
|
1940
|
+
return self._score_full(pooled)
|
|
1941
|
+
|
|
1942
|
+
def probe_geometry(
|
|
1943
|
+
self, name: str, *, grid_resolution: int = 24,
|
|
1944
|
+
) -> dict[str, Any]:
|
|
1945
|
+
"""Static geometry payload for one attached probe (inspector plot).
|
|
1946
|
+
|
|
1947
|
+
Everything in the **whitened frame** the reads use: per-layer node
|
|
1948
|
+
centroids (``wh.node_white``), the neutral anchor (``wh.neutral_white``),
|
|
1949
|
+
a top-3 PCA rotation of the node cloud when ``rank >= 3``, and — for a
|
|
1950
|
+
curved fit of intrinsic dim 1/2 embedded in a higher-rank subspace — the
|
|
1951
|
+
manifold curve/surface sampled and whitened into the same frame. Pairs
|
|
1952
|
+
with the per-token ``ProbeReading.subspace_coords_per_layer`` (the live
|
|
1953
|
+
point + trail), which carries the same ``cdist_query`` whitened coord.
|
|
1954
|
+
CPU/fp32 for the SVD + grid (MPS-fallback discipline); off the hot path.
|
|
1955
|
+
"""
|
|
1956
|
+
probe = self._probes.get(name)
|
|
1957
|
+
if probe is None:
|
|
1958
|
+
raise KeyError(name)
|
|
1959
|
+
manifold = probe.manifold
|
|
1960
|
+
domain = manifold.domain
|
|
1961
|
+
n = int(domain.intrinsic_dim)
|
|
1962
|
+
layers_out: dict[str, Any] = {}
|
|
1963
|
+
ranks: set[int] = set()
|
|
1964
|
+
for layer_idx in sorted(manifold.layers):
|
|
1965
|
+
wh = probe.whitened.get(layer_idx)
|
|
1966
|
+
if wh is None:
|
|
1967
|
+
continue
|
|
1968
|
+
sub = manifold.layers[layer_idx]
|
|
1969
|
+
node_white = wh.node_white.detach().to(torch.float32).cpu() # (K, R)
|
|
1970
|
+
R = int(node_white.shape[1])
|
|
1971
|
+
ranks.add(R)
|
|
1972
|
+
neutral_white = (
|
|
1973
|
+
wh.neutral_white.detach().to(torch.float32).cpu().reshape(-1)
|
|
1974
|
+
)
|
|
1975
|
+
pca_rotation: list[list[float]] | None = None
|
|
1976
|
+
ev_pcs: list[float] | None = None
|
|
1977
|
+
if R >= 3 and node_white.shape[0] >= 2:
|
|
1978
|
+
centered = node_white - node_white.mean(dim=0, keepdim=True)
|
|
1979
|
+
try:
|
|
1980
|
+
_u, s, vh = torch.linalg.svd(centered, full_matrices=False)
|
|
1981
|
+
pca_rotation = vh[:3].transpose(0, 1).contiguous().tolist()
|
|
1982
|
+
var = s ** 2
|
|
1983
|
+
tot = float(var.sum().clamp(min=1e-12))
|
|
1984
|
+
ev_pcs = [float(v) / tot for v in var[:3].tolist()]
|
|
1985
|
+
except Exception:
|
|
1986
|
+
pca_rotation, ev_pcs = None, None
|
|
1987
|
+
overlay: dict[str, Any] | None = None
|
|
1988
|
+
if (
|
|
1989
|
+
(not sub.is_affine)
|
|
1990
|
+
and n in (1, 2)
|
|
1991
|
+
and n < R
|
|
1992
|
+
and isinstance(domain, BoxDomain)
|
|
1993
|
+
):
|
|
1994
|
+
overlay = self._sample_overlay(sub, domain, wh, n, grid_resolution)
|
|
1995
|
+
layers_out[str(layer_idx)] = {
|
|
1996
|
+
"layer": layer_idx,
|
|
1997
|
+
"rank": R,
|
|
1998
|
+
"intrinsic_dim": n,
|
|
1999
|
+
"is_affine": bool(sub.is_affine),
|
|
2000
|
+
"node_white": node_white.tolist(),
|
|
2001
|
+
"neutral_white": neutral_white.tolist(),
|
|
2002
|
+
"pca_rotation": pca_rotation,
|
|
2003
|
+
"explained_variance_pcs": ev_pcs,
|
|
2004
|
+
"mahalanobis_share": float(
|
|
2005
|
+
manifold.mahalanobis_share[layer_idx],
|
|
2006
|
+
),
|
|
2007
|
+
"overlay": overlay,
|
|
2008
|
+
}
|
|
2009
|
+
return {
|
|
2010
|
+
"name": name,
|
|
2011
|
+
"manifold": manifold.name,
|
|
2012
|
+
"intrinsic_dim": n,
|
|
2013
|
+
"is_affine": bool(probe.is_affine),
|
|
2014
|
+
"node_labels": list(manifold.node_labels),
|
|
2015
|
+
"rank_uniform": len(ranks) <= 1,
|
|
2016
|
+
"layers": layers_out,
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
@staticmethod
|
|
2020
|
+
def _sample_overlay(
|
|
2021
|
+
sub: Any, domain: BoxDomain, wh: Any, n: int, res: int,
|
|
2022
|
+
) -> dict[str, Any] | None:
|
|
2023
|
+
"""Sample a curved manifold's curve (n=1) / surface (n=2), whitened.
|
|
2024
|
+
|
|
2025
|
+
Returns the sampled points already in the ``node_white`` frame
|
|
2026
|
+
(``r @ chol``), so the frontend overlays them on the same plot without a
|
|
2027
|
+
second transform. Off the hot path — CPU/fp32 throughout.
|
|
2028
|
+
"""
|
|
2029
|
+
cpu = torch.device("cpu")
|
|
2030
|
+
sub_c = sub.to(device=cpu, dtype=torch.float32)
|
|
2031
|
+
chol = wh.chol.detach().to(torch.float32).cpu() # (R, R)
|
|
2032
|
+
basis = sub_c.basis # (R, D)
|
|
2033
|
+
mean = sub_c.mean # (D,)
|
|
2034
|
+
axes = domain.axes
|
|
2035
|
+
|
|
2036
|
+
def _axis_grid(ax: Any) -> torch.Tensor:
|
|
2037
|
+
if ax.periodic:
|
|
2038
|
+
return torch.linspace(
|
|
2039
|
+
0.0, float(ax.period), res + 1, dtype=torch.float32,
|
|
2040
|
+
)[:-1]
|
|
2041
|
+
return torch.linspace(
|
|
2042
|
+
float(ax.lo), float(ax.hi), res, dtype=torch.float32,
|
|
2043
|
+
)
|
|
2044
|
+
|
|
2045
|
+
def _whiten(coords: torch.Tensor) -> torch.Tensor:
|
|
2046
|
+
world = sub_c.eval_at(domain.embed(domain.clamp_position(coords)))
|
|
2047
|
+
reduced = (world - mean) @ basis.transpose(0, 1) # (.., R)
|
|
2048
|
+
return reduced @ chol # (.., R) whitened
|
|
2049
|
+
|
|
2050
|
+
if n == 1:
|
|
2051
|
+
g = _axis_grid(axes[0]).reshape(-1, 1) # (S, 1)
|
|
2052
|
+
return {"kind": "curve", "points": _whiten(g).tolist()}
|
|
2053
|
+
gu, gv = _axis_grid(axes[0]), _axis_grid(axes[1])
|
|
2054
|
+
uu, vv = torch.meshgrid(gu, gv, indexing="ij")
|
|
2055
|
+
grid = torch.stack([uu.reshape(-1), vv.reshape(-1)], dim=1) # (nu*nv, 2)
|
|
2056
|
+
return {
|
|
2057
|
+
"kind": "surface",
|
|
2058
|
+
"points": _whiten(grid).tolist(),
|
|
2059
|
+
"grid_shape": [int(gu.numel()), int(gv.numel())],
|
|
2060
|
+
}
|