repo
stringclasses
20 values
path
stringlengths
6
94
lang
stringclasses
5 values
n_chars
int64
81
200k
sha256
stringlengths
64
64
content
stringlengths
81
200k
eren23/crucible-community-tap
objectives/sigreg/sigreg.py
py
5,955
07333b7a8b73a66592e23ab73696326b3fbcb7fddda5c4b8384d07929313ff77
"""SIGReg: Sketched-Isotropic-Gaussian Regularizer. Prevents representation collapse in JEPA models by enforcing that latent embeddings follow an isotropic Gaussian N(0, I), using the Cramér-Wold theorem. If all 1D marginal projections are Gaussian, the full distribution is Gaussian. Computes M random projections of ...
eren23/crucible-community-tap
objectives/distillation/distillation.py
py
4,913
1c901570b2e3c448c725abe1559eaa38d9c9b249eab7d2aa9eb30395bae6c8ac
"""Knowledge distillation objective for generic_backend. Wraps a teacher model and computes the combined loss: L = alpha * T^2 * KL(student_soft || teacher_soft) + (1 - alpha) * task_loss Env vars: DISTILL_TEACHER_PATH: Path to teacher state dict (required) DISTILL_TEACHER_FAMILY: Model family for teach...
eren23/crucible-community-tap
objectives/state_prediction/state_prediction.py
py
2,997
7ed567a8a795acb3740ac484a77ed050796e84d05f589b18a1fd04a98af39005
"""State prediction objective -- JEPA-style latent state prediction with variance regularization. Designed for world models that produce predicted and target embeddings in latent space. Combines MSE prediction loss with VICReg-style variance hinge regularization to prevent representation collapse. Expects: predic...
eren23/crucible-community-tap
optimizers/lion/lion.py
py
2,587
f0a22f274e09cabcfc85b2b47945129c94ef278e3ba23d8a9729bb6193541a08
"""Lion optimizer — EvoLved Sign Momentum (Chen et al., 2023). Sign-based update with decoupled weight decay. Memory-efficient alternative to Adam: only stores momentum (no second moment), halving optimizer state memory. Usage: EMBED_OPTIMIZER=lion MATRIX_OPTIMIZER=lion ... """ import torch from crucible.training...
eren23/crucible-community-tap
data_adapters/trajectory_hdf5/trajectory_hdf5.py
py
8,407
459a3850b7b8e93d1537fc80c9dc62d8ad8a515550bb03f694971a5d9e5a1c59
"""HDF5 trajectory data adapter for world model training. Loads trajectory datasets with frames, actions, and optional goals from HDF5 files. Returns sub-trajectory slices for JEPA-style training. Expected HDF5 layout:: /trajectories/ /0/ frames: [T, H, W, C] uint8 or [T, C, H, W] float32 ...
eren23/crucible-community-tap
data_adapters/code_state/trajectory_adapter.py
py
9,303
3f21e5fe3d746abc394ff798de1fecfedd09b6ced87b34a13d3af24dfc788f05
"""Trajectory-aware data adapter for multi-step world model training. Loads trajectory-structured HDF5 (produced by TrajectoryCollector) and serves multi-step (state, action, next_state) chains. Falls back to single-step random sampling when trajectory metadata is absent. Each batch returns a window of ``window_len`...
eren23/crucible-community-tap
data_adapters/code_state/code_state.py
py
8,662
85610983aa93abc910fa351c4c5b83b21921b6dd5cd7570ec66642d85ed7b46b
"""Code state data adapter -- loads git edit HDF5 for world model training. Loads HDF5 files produced by the ``git_edit`` or ``commitpack`` collectors and serves (state, action, next_state) tuples for world model training. Each transition is a localized code change: - **states**: AST token IDs of file content *before...
eren23/crucible-community-tap
examples/diff_xyz/diff_xyz_train_qwen.py
py
13,853
200f63645057cfeb429ace21fba071859896a5f1f1527d2ff9d6a21755ce9d08
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.16.0 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %% [markdown] # # Fine-tune Qwen3-Coder on Diff-XY...
eren23/crucible-community-tap
examples/diff_xyz/diff_xyz_colab.py
py
6,237
ba7405b08981dfad1707a4e2253e9d46651196844a04c5abe9b9e9a00293ee7a
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.16.0 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %% [markdown] # # Diff-XYZ Colab Smoke # # Runs th...
eren23/crucible-community-tap
launchers/_launcher_common.py
py
11,797
8e15e4c048b7bc37377b75fb425683a5b61d893e94a5c4555cc1efcd0cb4aec3
"""Shared launcher utilities for LE-WM family launchers. Provides env-var parsing helpers, config loading, Hydra override application, and metadata writing that were copy-pasted across lewm_upstream, hybrid_lewm_upstream, and elastic_lewm_upstream. """ from __future__ import annotations import json import os from pat...
eren23/crucible-community-tap
launchers/lewm_upstream/precompute_pusht.py
py
9,513
c7033ff2ca96b7af8fc3ba9fef04b61f8d2d8f0083880b03987b99f81b17238f
"""Precompute PushT HDF5 dataset into a HuggingFace dataset with transforms baked in. Runs inside the upstream ``lucas-maes/le-wm`` workspace (same as the launcher). Loads the HDF5 data via ``stable_worldmodel``, applies the same transforms (image resize + column normalization) that the launcher applies at training ti...
eren23/crucible-community-tap
launchers/lewm_upstream/lewm_upstream.py
py
4,997
1464bc4995955684324e5d9c49489f56ea9c22fb17c18298597eec108a016e97
"""Reusable LE-WM launcher bundle for Crucible external projects. This launcher runs inside a cloned upstream ``lucas-maes/le-wm`` workspace. It keeps the project spec thin while making the experiment entrypoint shareable through local plugins, installed hub packages, or tap clones. """ from __future__ import annotati...
eren23/crucible-community-tap
launchers/hybrid_lewm_upstream/hybrid_lewm_upstream.py
py
23,931
bf43ac1271ceed138af3d869e059ba516daabc308e8a22263fd73276d9b2062c
"""Hybrid LE-WM upstream launcher for Crucible external projects. Fork of lewm_upstream launcher that replaces the upstream HF ViT encoder with a HybridViTEncoder (configurable mix of softmax + linear attention blocks). Runs inside a cloned upstream ``lucas-maes/le-wm`` workspace. All hybrid encoder classes are defi...
eren23/crucible-community-tap
launchers/elastic_lewm_upstream/elastic_lewm_upstream.py
py
27,021
7b7b571d688852ea7a41119057cf91841c50c98875a9ed67430e60741635d5f2
"""Elastic LE-WM launcher bundle for Crucible external projects. Fork of lewm_upstream.py with elastic compute routing. This launcher runs inside a cloned upstream ``lucas-maes/le-wm`` workspace, replacing the encoder and predictor with elastic versions and adding the DifficultyRouter. All elastic model components ar...
eren23/crucible-community-tap
launchers/code_wm/train_code_wm.py
py
52,203
8f833fee408646f8025a35eea104e89236bfe98577fd01b21da9e0924af71fbf
#!/usr/bin/env python3 """Standalone Code World Model training script for RunPod / GPU execution. Supports two data modes: - **Single-step** (default): classic (before, action, after) pairs from flat HDF5 - **Trajectory**: multi-step windows from trajectory-structured HDF5 (auto-detected via /metadata.has_traj...
eren23/crucible-community-tap
launchers/code_wm/pretrain_encoder.py
py
11,990
927c2ab61f6e5428246a9e9317d8734f17e8773db8b6315681ab39c7cf0c1360
#!/usr/bin/env python3 """Pre-train CodeWM encoder with supervised objectives (Phase 12, Direction B). Trains the state encoder to predict edit properties from the before-state encoding. This forces the encoder to learn representations that distinguish different code contexts — preventing the rank collapse seen with J...
eren23/crucible-community-tap
launchers/kernel_wm/train_kernel_wm.py
py
18,980
448934e932f0434de9c4c7548128d2df8a2357bfc9c0115d630c85f76a240989
#!/usr/bin/env python3 """KernelWM training script — trains CodeWM on GPU kernel migration pairs. Uses the same CodeWorldModel architecture with adjusted vocab (400) and action_dim (12). Adds example table logging: during validation, decodes predicted kernel configs back to readable form and saves comparison tables. ...
eren23/crucible-community-tap
launchers/code_deltatok/train_deltatok.py
py
13,348
8b6162378256a03a4408ce2172565596ec980c61c969a3cc5b01e5bd1b7d254a
#!/usr/bin/env python3 """CodeDeltaTok training script. Trains a DeltaTok-inspired delta tokenizer on pre-computed frozen backbone features. No backbone inference during training -- just loads feature vectors from HDF5 and learns to compress deltas. Env vars: CDT_HDF5_PATH: Path to pre-computed features HDF5 ...
eren23/crucible-community-tap
launchers/diff_xyz/sft_smoke.py
py
15,849
26ef1fb342d115d7a5a09032f59ca27005b308fdc69b6eae509669631c8cdac5
"""SFT-driven Diff-XYZ smoke runner. Loads a small Qwen base in 4-bit, attaches LoRA, fine-tunes for a handful of steps on a CommitPackFT subset (deduped against Diff-XYZ test), then runs post-training eval on a small Diff-XYZ slice. Written to fit a 24GB GPU (RTX 4090 / 3090 / A5000) and finish in ~5 minutes. Env va...
eren23/crucible-community-tap
launchers/diff_xyz/api_smoke.py
py
2,908
2f1d9793438db9e197db49cfe62e961353a1cdfe67e23ed63601d6b97959d36d
"""API-driven Diff-XYZ smoke runner. Invokes `evaluation.diff_xyz.harness.run_benchmark` against OpenAI / Anthropic / Google APIs. Used to validate the harness on a small sample before committing to a full sweep. Env vars (all optional with sane defaults): DIFFXYZ_MODEL model spec, default 'openai:gpt-4...
eren23/crucible-community-tap
launchers/diff_xyz/eval_only.py
py
8,420
e1e2d150067d2c0b585dd3f1976b4aba01233e747c9729565310f12bc1a1d0d6
"""Zero-shot Diff-XYZ eval runner — local HF model, no SFT. Loads a base HF model in 4-bit and runs the Diff-XYZ harness against it. The point: anchor our pipeline against the paper's no-SFT baselines (e.g. Table 5: Qwen2.5-Coder-7B Diff-Gen search-replace EM=0.68). Without that anchor we can't tell whether a fine-tun...
eren23/crucible-community-tap
evaluation/rescore_wandb_history.py
py
4,430
595b9afdc89db69da46afca228fb869cbf4c0e8ab98b4e5a6e16dc0530c5477a
#!/usr/bin/env python3 """Rescore wandb runs with mean-of-last-N instead of peak-only. Fetches metric history for every run in ``eren23/crucible-code-wm`` and reports, per run: - peak val_delta_cos (the number we used to report) - mean ± std of val_delta_cos over the last N eval steps (default N=5) - total steps run ...
eren23/crucible-community-tap
evaluation/baselines.py
py
13,018
e7bf0719d2d647d5b2bd4fb4273d15f2460e689530e9ab690323c3e37261f009
#!/usr/bin/env python3 """Baselines for the Code WM paper. Answers the question: "Is CodeWM's 92-95% edit classification and 0.14 delta_cos actually impressive, or does a trivial method get close?" Three baselines that work directly on the existing HDF5 data (no retokenization needed): 1. Bag-of-AST-tokens: cosine s...
eren23/crucible-community-tap
evaluation/code_wm/rollout_eval.py
py
14,101
33d7f7190ead48107d2b4fde4f7da81b189eb9a3e6f5f83a3a0dced2eb417982
#!/usr/bin/env python3 """Multi-step rollout evaluation for Code World Model. Two subcommands: - **drift**: Phase 1 sanity check. Sample N transitions from the training h5, roll out the predictor with a fixed action for several steps, report magnitude + cosine drift. No ground truth required. - **trajectory**: P...
eren23/crucible-community-tap
evaluation/code_wm/latent_planning.py
py
8,334
d90130bfd5bf24d5e9f7c2e7593546f2e85b5efd2daaf8351dbcefa30c6ba532
#!/usr/bin/env python3 """Latent gradient planning eval for CodeWM. Per the temporal-straightening / planning prior art (arxiv 2603.12231): given z_before = encoder(state_t) and z_target = target_encoder(state_{t+1}), can we recover the latent action via gradient descent in latent space? z_a* = argmin_z_a || p...
eren23/crucible-community-tap
evaluation/code_wm/modern_baselines_compare.py
py
11,280
9ab5def09f14b1e36cc25718a2c96f88b1f946e98192dd97828f0f2debdf2913
#!/usr/bin/env python3 """Modern code embedding baselines vs CodeWM on CodeSearchNet retrieval. Closes the "stale baselines" gap (CodeBERT 2020 only) from the Phase 5C benchmark audit by running 2024-2026 code embedding models on the same CodeSearchNet code-to-code retrieval protocol that ``codesearchnet_eval.py`` use...
eren23/crucible-community-tap
evaluation/code_wm/delta_magnitude_analysis.py
py
10,689
b8c8dcd72e936d48bd98dd15a286437f966943a4d14cafc93168754973c557c4
#!/usr/bin/env python3 """Phase 0.4 — Delta magnitude distribution analysis. Computes ||z_{t+1} - z_t|| / ||z_t|| across datasets to quantify the signal-to-noise ratio for delta prediction. Designed to compare CodeWM (Python, expected low signal) vs KernelWM (CUDA kernels, expected high signal) to confirm the domain h...
eren23/crucible-community-tap
evaluation/code_wm/_shared.py
py
4,980
42c247a68a956e97cd3734b3083801af6773e0a1ce5695423fba5745b6a582f4
"""Shared CodeWM eval helpers. Canonical implementations for the duplicated functions that used to live in every single `evaluation/code_wm/*.py` script. Pulled out into one module so a bug fix (e.g. the 2026-04-10 ``WM_POOL_MODE=cls``/ ``strict=False`` silent-drop bug) only needs to be made once. Public API: - ``lo...
eren23/crucible-community-tap
evaluation/code_wm/semantic_eval.py
py
10,880
373774e0c04943a9cd3fa96f491684466fb9ac4e3eba1518eaac1ca9b1911a43
#!/usr/bin/env python3 """Semantic downstream tests for Code World Model. Tests whether the learned latent geometry is actually useful, beyond val/cosine_sim. Four probes: 1. Edit Retrieval: For each query edit, find k-NN in delta space. Measure action-vector similarity between query and retrieved neighbors. 2. k...
eren23/crucible-community-tap
evaluation/code_wm/null_models_rollout.py
py
7,529
aa34834e83dd33a3c01a03531957bc197b578688c0407f9629b1d9c87bca8a06
"""Delta-space null models for the multi-step compositional prediction claim. The paper reports the per-step metric s_k = cos(pred_delta_k, true_delta_k) where pred_delta_k is the predictor's latent displacement between rollout step k-1 and step k, and true_delta_k is the ground-truth target-encoder displacement. The...
eren23/crucible-community-tap
evaluation/code_wm/isotropy_analysis.py
py
9,124
4857a05911cdb60f5edd8eff74848d4554e16373a460a0d13e0cf83811798713
#!/usr/bin/env python3 """Phase 0.3 — Isotropy analysis of encoder latent space. Measures how close the frozen encoder's representation space is to an isotropic Gaussian (the optimal geometry for delta prediction per LeJEPA/SIGReg theory). An anisotropic space means some delta directions are privileged over others, ma...
eren23/crucible-community-tap
evaluation/code_wm/codesearchnet_eval.py
py
10,262
c7cdc57b49171eb1cece15567093ffcd9e2eb7f0eff5244e2deddc95cade6b55
#!/usr/bin/env python3 """External-benchmark retrieval eval on CodeSearchNet Python test split. Protocol (code-to-code retrieval on a diverse external corpus): 1. Load ``code_search_net`` Python test split (22,176 functions from open-source Python projects, each annotated with its origin ``repository_name``). 2. S...
eren23/crucible-community-tap
evaluation/code_wm/delta_norm_report.py
py
9,617
bb07afdf9f7807a362728a5faef4ca323bb7b725f8ee4184d1c65552e15126bb
#!/usr/bin/env python3 """Delta magnitude / norm reporting for CodeWM. Closes the "cosine alone can hide whether the model is predicting a tiny vector" concern from the 2026-04-11 reviewer-response pass. For each checkpoint we sample N single-step transitions (and optionally longer trajectories for s2/s3) from the tra...
eren23/crucible-community-tap
evaluation/code_wm/geometry_probes.py
py
11,966
94f63912ab9190a9fc91a64abcb88ac50bdb83c16a6af321db5c4b7616ee51f6
#!/usr/bin/env python3 """Phase 0.1 — Layer-wise linear probes for CodeWM encoder. Probes intermediate representations after each loop iteration of the weight-shared LoopedTransformerBlock to answer: 1. Which loop iterations contain transition information? 2. Can linear probes predict the next-state delta directio...
eren23/crucible-community-tap
evaluation/code_wm/cross_repo_eval.py
py
14,177
c0d942043179b41a86c8ff05c4e623a321e0c6f1d277031680720f86dc851e99
#!/usr/bin/env python3 """Cross-repository retrieval eval on 20 held-out Python repos. Closes the "cross-repo generalization never measured" gap from the Phase 5C audit. The model was trained on CommitPackFT Python (IID val split). Here we test it on fresh git histories of 20 well-known Python libraries that are NOT i...
eren23/crucible-community-tap
evaluation/code_wm/curvature_analysis.py
py
10,049
8032be4dd09d4420777e682a083040eaa24e80ad91bae248d4ee2e2f01bfa99a
#!/usr/bin/env python3 """Phase 0.2 — Trajectory curvature measurement in latent space. For sequences of 3+ consecutive commits, computes curvature of the trajectory in encoder latent space: kappa = ||delta_{t} - delta_{t-1}|| / ||delta_{t-1}|| where delta_t = z_{t+1} - z_t. Low curvature (straight trajectories...
eren23/crucible-community-tap
evaluation/code_wm/commit_chronicle_eval.py
py
18,689
c3462bb61bfc848aa8fa009d8a7525b3ae69b1f380c1c8e110535bff38f4e30b
#!/usr/bin/env python3 """Evaluate CodeWM vs CodeBERT vs BoW on CommitChronicle subset_llm. JetBrains-Research/commit-chronicle subset_llm has 4,030 commits with per-file diffs and reference commit messages. The retrieval task: given a (before, after) code edit, retrieve the most similar edit by delta-NN. Relevance c...
eren23/crucible-community-tap
evaluation/code_wm/full_val_knn.py
py
8,808
bcb7f1f9a1cbd76b3687506db7589dc94ea06b4d2aa76cf9146b157c9bf21cf6
#!/usr/bin/env python3 """Full-val KNN + eff_rank evaluation on a CodeWM checkpoint. Addresses the B1 audit finding: training-time val/knn metrics run on a single 128-sample batch and are noisy. This script runs the same metrics on the FULL val set (typically 5000 samples) for a defensible paper number. Computes: -...
eren23/crucible-community-tap
evaluation/code_wm/honest_retrieval.py
py
14,280
19c1721bda4c5e44ae5f6d12997fedf107da864bdd9d096c8bd137b4037ca0f9
#!/usr/bin/env python3 """Honest retrieval evaluation that doesn't get fooled by dataset imbalance. The existing semantic_eval.py reports MRR/Recall@k with "same edit_type" as the relevance criterion. But CommitPack is 98.8% MODIFY, so this metric is trivially saturated — random retrieval scores ~0.99. This script re...
eren23/crucible-community-tap
evaluation/code_wm/delta_diagnosis.py
py
8,192
2ab9f0a8757df0642ff912e8b5fd8f7cd9daecafdf4db4774621c63f608f988a
#!/usr/bin/env python3 """DeltaCodeWM Generalization Diagnosis. Tests why in-batch training metrics (dcos=0.957, lift=+0.128) don't transfer to independent holdout (pred_vs_diff cosine=0.05). Usage: python delta_diagnosis.py --checkpoint checkpoints_delta/kernel_wm_best.pt --data data/commitpackft_with_diffs.h5 "...
eren23/crucible-community-tap
evaluation/code_wm/eval_code_wm.py
py
9,574
7fedb67238d814c3f6c7e400a6043e399c876e04d67598bfffd8c3274e3698c1
#!/usr/bin/env python3 """Evaluate a Code World Model on held-out git edit transitions. Computes: - MSE in latent space (pred vs target) - Cosine similarity between predicted and target embeddings - Nearest-neighbor accuracy (does nearest neighbor of pred = actual target?) Compares against baselines: ...
eren23/crucible-community-tap
evaluation/code_wm/codebert_compare.py
py
12,791
368183f9303970d79ac07aa6bd8c4b4533aa0687a3f704d3fd8698b847da2a7f
#!/usr/bin/env python3 """Head-to-head retrieval comparison: CodeWM vs CodeBERT vs BoW. Downloads CodeBERT (microsoft/codebert-base) and a fresh CommitPackFT sample, encodes the same edits with both models, runs the same delta-NN retrieval pipeline, and compares MRR/Recall@k under multiple relevance criteria. Why fre...
eren23/crucible-community-tap
evaluation/code_wm/cross_repo_modern_compare.py
py
18,559
93a2cac123b1cd255915e4b05fb3d2cc47476eca7b372bb3a8e59fb53d48bfb8
#!/usr/bin/env python3 """Cross-repo retrieval eval with modern baselines (CodeBERT, CodeT5+, jina). Extends ``cross_repo_eval.py`` to also embed the (before, after) pairs with modern HF code embedders, not just CodeWM + BoW. Uses the same 20-repo basket and the same leave-one-repo-out protocol so results are directly...
eren23/crucible-community-tap
evaluation/kernel_wm/cross_arch_transfer.py
py
13,372
7a92522c7d83e175d31880e4a881ddd4c49003addf5c326936763b47f2d59b4a
#!/usr/bin/env python3 """KernelWM Cross-Architecture Transfer Evaluation. The moonshot test: train on SM80->SM90 + SM90->SM100, test zero-shot on SM80->SM100. Compares model against copy-last, random, and NN baselines. Usage: python cross_arch_transfer.py \ --checkpoint kernel_wm_best.pt \ --trai...
eren23/crucible-community-tap
evaluation/code_deltatok/eval_diffxyz.py
py
7,072
a3e5cc2b52e7bd82ebc309707a45c6c5087cb0b5dbdf988ff040cdfcc4241431
#!/usr/bin/env python3 """CodeDeltaTok evaluation on Diff-XYZ public benchmark. Downloads Diff-XYZ test set from HuggingFace, encodes with UniXcoder, runs CodeDeltaTok, and evaluates cross-modal retrieval. This anchors the paper's claims to a public benchmark. Usage: python eval_diffxyz.py \ --checkpoint...
eren23/crucible-community-tap
evaluation/code_deltatok/eval_efficiency.py
py
6,170
7f1c24814a69a43321c03761ba198c6590868e6f2e0872e9433a3c1f0c923ba7
#!/usr/bin/env python3 """CodeDeltaTok efficiency benchmark. Measures the systems advantage of 1-token delta representation: - Encoding latency (ms/change) - Storage per change (bytes) - ANN retrieval latency at scale - Comparison to full-feature storage Usage: python eval_efficiency.py \ --featur...
eren23/crucible-community-tap
evaluation/code_deltatok/eval_deltatok.py
py
11,431
adc262357ca2d83a0f04e22866d2f244f744feeb8f30e45346bb4e022dd46cdb
#!/usr/bin/env python3 """CodeDeltaTok benchmark — proper downstream evaluation. Three evaluation tasks: Task 1: Cross-modal retrieval Query = delta representation (from method under test) Gallery = actual after-state features (frozen UniXcoder) Ground truth: query[i] should match gallery[i] (same code change) ...
eren23/crucible-community-tap
evaluation/code_deltatok/eval_hard_negatives.py
py
7,919
64f3b4b51f636bc32ba1876e009612727887c0b7622773a668752c60281ae6f2
#!/usr/bin/env python3 """CodeDeltaTok hard-negative evaluation. Tests whether delta tokens can discriminate between changes when the starting code is similar. This is the key reviewer defense: "MRR 0.997 with random negatives is too easy." Hard negative construction: For each query, gallery contains K hard negativ...
eren23/crucible-community-tap
evaluation/diff_xyz/metrics.py
py
5,915
c51e4b801b7e3428d7c6219a42ff5abf8002ae1109f36833911730cb4fd8d048
"""Diff-XYZ metrics (paper §3.1 + §3.2 verbatim). - Stripped EM: whitespace-only lines removed, then exact string equality - Stripped IoU: |unique lines A ∩ B| / |unique lines A ∪ B| after whitespace-strip - F1 on added lines: F1 between {added_lines in ref} and {added_lines in pred} - F1 on deleted lines: analogous -...
eren23/crucible-community-tap
evaluation/diff_xyz/harness.py
py
10,077
402bbd90fe9811fc1e7a8f846ed7f8cbcf26eb08867199ba2fe7e0802d77a00b
"""Diff-XYZ evaluation harness — the CLI that wires every piece together. Usage: python evaluation.diff_xyz/harness.py \\ --model anthropic:claude-sonnet-4-6 \\ --task apply \\ --format udiff \\ --system-prompt format \\ --limit 20 \\ --out /tmp/smoke.json Output JS...
eren23/crucible-community-tap
evaluation/diff_xyz/models.py
py
15,653
ae31ab62bfb02fdb764abeb23917a70f742a28c586fba0f74bee4417e8df61ef
"""Model adapters for the Diff-XYZ harness. Protocol: generate(system_prompt: str, user_prompt: str, *, max_tokens: int = 4096, temperature: float = 0.0) -> str Backends: - anthropic:<model_id> via `anthropic` SDK - openai:<model_id> via `openai` SDK - google:<model_id> via `goog...
eren23/crucible-community-tap
evaluation/diff_xyz/__init__.py
py
859
7a124980e36496993d7aa4fcafe449ef80400579be913dbb81a43608eed16bb4
"""Diff-XYZ eval harness (arXiv 2510.12487). Generative benchmark for LLM code-diff understanding: - Apply: old_code + diff -> new_code - Anti-Apply: new_code + diff -> old_code - Diff-Gen: old_code + new_code -> diff Public API: from evaluation.diff_xyz import compute_metrics, parse_diff, apply_d...
eren23/crucible-community-tap
evaluation/diff_xyz/prompts.py
py
6,822
83accc0ff210fb0fa5298e59ea18848bbdeee7272e8172e72f999de76ed315a6
"""System + user prompt templates for Diff-XYZ tasks. Paper Appendix A describes the prompts but the arxiv HTML export renders them as figure placeholders without figure content. The templates below are a best-effort reproduction matching the paper's description: - `w/o format` system prompt: literally "You are a h...
eren23/crucible-community-tap
evaluation/diff_xyz/dataset.py
py
3,214
deef766bc538fdee0073749b98c78afb4bc5a0870e7f36e3ffe8f882a9645256
"""Load the Diff-XYZ test set from HuggingFace. Dataset: `JetBrains-Research/diff-xyz`. Single `test` split, 1000 rows, columns per dataset card: repo, commit, path, lang, license, message, old_code, new_code, n_added, n_removed, n_hunks, change_kind, udiff, udiff-h, udiff-l, search-replace. `load_samples(limit, lang...
eren23/crucible-community-tap
evaluation/diff_xyz/formats.py
py
11,368
5e66c8c9cf84764234a5e6231bc1c592b843da57f846524b972e9491a699f5f0
"""Diff-XYZ format parsers + appliers. Formats (per paper §5): - udiff: standard unified diff with `@@ -a,b +c,d @@` hunk headers - udiff-h: unified diff with relaxed `@@...@@` headers (no line nums) - udiff-l: verbose `ADD`/`DEL`/`CON` markers instead of `+`/`-`/` ` - search-replace: li...
eren23/crucible-community-tap
evaluation/diff_xyz/tests/test_diff_xyz_metrics.py
py
8,773
ade8f65d8f6c0753a2f870bc5b81366d94ffdb903ad06aec5ec8ce6040640650
"""Tests for evaluation.diff_xyz/metrics.py and formats.py.""" from __future__ import annotations import pytest from evaluation.diff_xyz.formats import ( ApplyError, ParseError, apply_diff, diff_added_lines, diff_deleted_lines, parse_diff, ) from evaluation.diff_xyz.metrics import ( comput...
eren23/crucible-community-tap
evaluation/diff_xyz/tests/test_diff_xyz_harness.py
py
9,507
c31d6d0a99e3c4358078ed3965aec2fb73cdc1903fac893b70bc906911ebbba3
"""Tests for evaluation.diff_xyz/harness.py end-to-end flow with a dummy backend. Full API-backed runs live in a separate integration test (not run in CI). """ from __future__ import annotations import json import sys from pathlib import Path from unittest.mock import MagicMock, patch import pytest from evaluation....
eren23/crucible-community-tap
evaluation/diff_xyz/tests/test_diff_xyz_models.py
py
4,739
1f489cfa20371ec8c1fe54c6a137254d646cd8cd46ebdbc0fb6d48bc11d27b4a
"""Tests for evaluation.diff_xyz/models.py (backend resolution + dummy only). API-backed adapters are covered by the end-to-end smoke test that runs against live keys, not here. """ from __future__ import annotations import pytest from evaluation.diff_xyz.models import ( AnthropicBackend, DummyBackend, G...
eren23/crucible-community-tap
evaluation/diff_xyz/tests/test_diff_xyz_prompts.py
py
6,248
dd69761c83ee8e469441391600a9916c8d86adbf361266907c135e57f3ae52bd
"""Tests for evaluation.diff_xyz/prompts.py and dataset.py (offline portions).""" from __future__ import annotations import pytest from evaluation.diff_xyz.dataset import DiffXYZSample, _row_to_sample from evaluation.diff_xyz.prompts import ( GENERIC_SYSTEM, SYSTEM_PROMPT_MODES, TASKS, strip_markdown_...
eren23/coder-interp-tap
callbacks/wandb_periodic_validation/wandb_periodic_validation.py
py
2,938
6495f34ea11549f79a66503dddaafeb2bc1aca40e28d4b88e0695267d8c89e07
"""Skeleton periodic-validation callback for W&B logging. Drops into a Crucible training loop. Every `eval_interval` steps it runs a validation pass and logs scalar metrics and a sample table to W&B. Every `checkpoint_interval` steps it saves the model state. This is a SKELETON. Wire `run_validation` to your actual e...
eren23/coder-interp-tap
findings/2026-05-10-cross-author/make_plots.py
py
6,358
c9c02706047629e333ec688e000e78a300b2e5da4c46561cc5ccf774c55e521d
"""Generate visualizations from the v1/v2/v3 cross-author delta study. Pulls live W&B data for the 9 completed runs and produces 4 PNGs in this directory. Real numbers, no synthesis — change the V1/V2/V3 dicts to point to a new round of runs to regenerate. Run: cd findings/2026-05-10-cross-author python3 make...
eren23/coder-interp-tap
launchers/nla_coder/av_train.py
py
784
94d133d7f9564993713f99629b25c67214ab0484c765c2da07cd17f2c68dca2f
"""Phase-2.2 AV training launcher for nla_qwen2_5_coder_1_5b. SCAFFOLD ONLY. Real implementation goes here when Phase 2.1 SAE training is producing usable feature activations. Intended pipeline: 1. Load saved Phase-2.1 SAE checkpoint. 2. For each of d_sae features, generate synthetic NL description via Claud...
eren23/coder-interp-tap
launchers/nla_coder/sae_train.py
py
807
b5fcac841e37ea045f9c6826535934649b95ec7bd71cef777ce9480d2478be2e
"""Phase-2.1 SAE training launcher for nla_qwen2_5_coder_1_5b. SCAFFOLD ONLY. Real implementation goes here when Phase 0 smoke is green. Intended pipeline: 1. Stream ~100M code tokens from CommitPackFT (Python + TS subsets). 2. Forward through Qwen2.5-Coder-1.5B, hook layer 6 residuals. 3. Train TopK SAE via SA...
eren23/coder-interp-tap
launchers/nla_coder/delta.py
py
1,095
6d228cb2a708a493b3357dbd8f538005b7ee45db9c75df432d10043533244480
"""Phase-3 LoRA delta study launcher for nla_qwen2_5_coder_1_5b. SCAFFOLD ONLY. Real implementation goes here once Phase 2 (SAE + AV) ships. Intended pipeline: 1. LoRA-tune Qwen2.5-Coder-1.5B on a small fine-tune signal dataset (synthetic preference pairs OR external preference data SCP'd in via Crucible ...
eren23/coder-interp-tap
launchers/nla_coder/smoke.py
py
2,384
06936681abcd61de5a708ce7f5a4e4fe8702ae1807427ecd2052fa1d4a9f3c93
"""Phase-0 smoke launcher for nla_qwen2_5_coder_1_5b. Same pattern as launchers/nla_pilot/smoke.py — validates pod plumbing, logs a fake training curve to W&B, exits 0. """ from __future__ import annotations import os import time def _env(name: str, default: str | None = None) -> str: val = os.environ.get(name...
eren23/coder-interp-tap
launchers/nla_pilot/pilot.py
py
1,174
46469a7ac015a6831babeb9d38f582288b7c3cc1c9507d07b205921511a89d8f
"""Phase-1 pilot launcher for nla_qwen3_5_2b_pilot. SCAFFOLD ONLY. Real implementation goes here when Phase 0 smoke is green. Intended pipeline: 1. residual_dump — forward 200K tokens through Qwen3.5-2B, hook layer 12, cache (token_id, residual) to data/qwen3_5_2b_residuals_layer12.h5 2. ...
eren23/coder-interp-tap
launchers/nla_pilot/smoke.py
py
2,691
c4080cdb07a0bb289ec04fd96878215f35a9de8c16ba1fee4d8c5ca177b41e97
"""Phase-0 smoke launcher for nla_qwen3_5_2b_pilot. Validates pod plumbing: - reads project env vars - logs to W&B - sleeps briefly - exits 0 NO real training. Replace with the actual Phase-1 pilot loop once the project YAML's `pilot` variant becomes the focus. """ from __future__ import annotations import ...
eren23/coder-interp-tap
launchers/feature_explainer/main.py
py
18,420
b8718a334d95f33e9f57234c1427ce0b37527cfa1ccaff3669a749edf7f228b6
"""Feature explainer — auto-interpret SAE features via an LLM. For each SAE feature, collect its top-K firing contexts from a streaming corpus, then ask an OpenAI-compatible LLM (default: DeepSeek V3 via OpenRouter) to describe the concept the feature represents. Output goes to a JSON file + a W&B Table. Hot-paths: ...
eren23/coder-interp-tap
launchers/lora_dpo/main.py
py
4,169
6b22e3ac1e5857c3d857b5fa44e666abb90a072ebd25d483c04793b2c307a9de
"""LoRA + DPO fine-tune launcher — STUB. This launcher validates pod plumbing (HF cache layout, W&B init, model download path) but does NOT yet run the actual TRL DPOTrainer. Real implementation goes here when you start Track B in earnest. Outline of the real pipeline (TODO): 1. Build a small synthetic preference d...
eren23/coder-interp-tap
launchers/nla_real/pilot.py
py
14,005
97e220cdc36de9c5cb7e3e170ce1d80e2785f03fe979d7a12d60a291a3bf3c0a
"""Real NLA pilot launcher (transformers-only, no sglang). End-to-end pipeline that produces actual natural-language descriptions of Qwen2.5-7B-Instruct activation vectors via the kitft Activation Verbalizer at layer 20. The injection protocol (per kitft's nla_meta.yaml): - prompt template wraps the ㈎ injection cha...
eren23/coder-interp-tap
launchers/nla_real/smoke.py
py
607
4c719cece1f5db09136262c70306ed8f48d6be2814acba37ff312f6a8e7e0702
"""Smoke variant — same pipeline as pilot, gated by env (NUM_PROMPTS=3, POSITIONS_PER_PROMPT=1 in the project YAML's smoke variant block). Crucible runs us as `python3 -u launchers/nla_real/smoke.py` so the package import path "launchers.nla_real.pilot" is NOT on sys.path. Add this script's parent dir to sys.path so `...
eren23/coder-interp-tap
launchers/feature_diff_study/main.py
py
25,441
4217c81619b0ef78fa44570c3b06c01e04e8624441034c439b750192e3d54325
"""Feature-diff delta study — end-to-end demo of the Track-C measurement pipeline. Pipeline (all phases run in sequence on one pod): 1. Load base Qwen2.5-Coder-1.5B. 2. Build a small biased SFT dataset from a CommitPackFT slice. 3. LoRA-SFT for LORA_TRAIN_STEPS steps. Save adapter. 4. Forward HOLDOUT_TOKENS he...
eren23/coder-interp-tap
launchers/feature_diff_study/summarize_delta.py
py
9,242
042551f6a8ed468c3b206d44c580a6f184562f3b715ded38fdee2e81ab1d7034
"""LLM-explains-delta postprocess for feature_diff_study. Compresses the top-K drift table into a 2-3 paragraph natural-language summary of what the LoRA fine-tune actually did. Same OpenAI-compatible endpoint pattern as feature_explainer (default DeepSeek V3 via OpenRouter). Drop-in: imported by main.py at end of ru...
eren23/coder-interp-tap
launchers/sae_train/main.py
py
11,786
4d233b2277ff650d06d52792b0815246380464fa1e330f4311f4868cb2d76614
"""TopK Sparse Autoencoder trainer over a HuggingFace base model's residual stream. Pipeline: 1. Load base model (BASE_MODEL) in bf16 on cuda. 2. Stream documents from a HF dataset (DATASET_ID / DATASET_SUBSET) and tokenize on the fly to SEQ_LEN. 3. Forward CAPTURE_BATCH_SIZE sequences at a time; capture re...