Instructions to use Machacini/stackifiers-repo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Machacini/stackifiers-repo with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Machacini/stackifiers-repo", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Machacini/stackifiers-repo", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Stackifiers Repo
Two fully fine-tuned mmBERT regressors that predict five continuous repository-context scores from 0 to 5:
pretraining_valuerepo_qualitycoding_standarddifficultyeducational_value
These models score the visible source context provided to them. They do not fetch a repository or establish the quality of unseen files. The outputs are regression scores, not class probabilities. Higher difficulty means more difficult material; it is not a quality recommendation.
This branch contains mmbert-small. Both evaluated variants are published in the same repository:
| Revision | Model |
|---|---|
main or mmbert-small |
Fully fine-tuned jhu-clsp/mmBERT-small |
mmbert-base |
Fully fine-tuned jhu-clsp/mmBERT-base |
Load and score
Install the tested Transformers version and PyTorch for your CPU/GPU platform:
pip install "transformers==5.5.4" "torch>=2.4" "safetensors>=0.4.3"
import torch
from transformers import AutoModel, AutoTokenizer
repo_id = "Machacini/stackifiers-repo"
revision = "mmbert-small" # change to "mmbert-base" for the larger model
tokenizer = AutoTokenizer.from_pretrained(repo_id, revision=revision)
model = AutoModel.from_pretrained(
repo_id,
revision=revision,
trust_remote_code=True,
).to("cuda" if torch.cuda.is_available() else "cpu").eval()
text = """Repository: example/calculator
File: calculator.py
def add(a, b):
return a + b
"""
scores = model.predict(text, tokenizer=tokenizer, chunk_batch_size=4)
print(scores) # a dictionary of five floating-point scores
# A list of texts returns a list of dictionaries in the same order.
batch_scores = model.predict([text, text], tokenizer=tokenizer, chunk_batch_size=4)
For reproducible deployments, replace revision with a specific commit SHA. trust_remote_code=True loads the included, inspectable configuration and model wrapper. The checkpoints themselves use safetensors, with the encoder and trained scoring head together in model.safetensors. No external training repository or original upstream checkpoint download is needed to run the exported model.
Full-context input handling
model.predict retains the full input instead of truncating it. It tokenizes the text without special tokens, divides it into chunks that fit 8,192 tokens including special tokens, and encodes batches of chunks. Each chunk uses attention-mask-weighted mean pooling over non-padding tokens, including special tokens. Chunk representations are averaged using content-token counts excluding special tokens, then scored once by the trained head:
source text β token chunks β mmBERT β masked mean per chunk
β content-token-weighted mean across chunks
β LayerNorm β dropout(0.1) β linear(5) β 5 Γ sigmoid
chunk_batch_size controls encoder memory use. Lower it if your device runs out of memory. At inference, dropout is disabled. model.predict returns final scores: do not apply another sigmoid or softmax.
For an already tokenized single-chunk batch, model(**tokenizer(texts, padding=True, return_tensors="pt")).logits returns a [batch, 5] tensor in the metric order above. For inputs that may exceed the model's per-chunk limit, use predict or supply explicit owners, chunk_weights, and num_contexts tensors to forward.
Evaluation results
Both models use the same 26,754 repository-held-out test contexts. The table includes genuine annotated zero scores; missing/N/A targets are excluded separately for each metric. Results measure agreement with LLM teacher annotations, rather than independent human judgments.
| Variant | Parameters | Test MAE β | Test RMSE β |
|---|---|---|---|
| mmbert-small | 140,496,389 | 0.326695 | 0.557302 |
| mmbert-base | 306,945,029 | 0.318769 | 0.546326 |
Macro MAE is the unweighted mean of the five per-score MAEs. Macro RMSE is the unweighted mean of per-score RMSEs, not the square root of macro MSE. Lower MAE/RMSE and higher Spearman correlation are better.
mmbert-small
| Score | MAE β | RMSE β | Spearman β | Labeled test contexts |
|---|---|---|---|---|
| pretraining_value | 0.310120 | 0.464585 | 0.952245 | 26,754 |
| repo_quality | 0.369401 | 0.633371 | 0.890405 | 26,753 |
| coding_standard | 0.352478 | 0.676580 | 0.894324 | 26,754 |
| difficulty | 0.281626 | 0.518015 | 0.867862 | 26,753 |
| educational_value | 0.319848 | 0.493962 | 0.933114 | 26,749 |
mmbert-base
| Score | MAE β | RMSE β | Spearman β | Labeled test contexts |
|---|---|---|---|---|
| pretraining_value | 0.304355 | 0.457008 | 0.953680 | 26,754 |
| repo_quality | 0.360555 | 0.623037 | 0.893354 | 26,753 |
| coding_standard | 0.345906 | 0.666004 | 0.896573 | 26,754 |
| difficulty | 0.270646 | 0.502242 | 0.870636 | 26,753 |
| educational_value | 0.312383 | 0.483339 | 0.935696 | 26,749 |
Exact values are included in test-metrics.json and validation-metrics.json on each branch. The larger model has slightly lower test error. These results do not establish an end-to-end inference throughput advantage for either model; timings from cached-feature head evaluation are not encoder inference benchmarks.
Score distributions
The figures below use the same 26,754 repository-held-out test contexts as the evaluation tables, comparing the fully fine-tuned small and base models.
Each line shows the percentage of test contexts in a 0.1-point score bin. All predictions are included, including predictions for contexts with missing teacher targets. Scores remain continuous in [0, 5]; no rounding is used for inference or evaluation. The panels use separate vertical scales for readability.
The second figure compares teacher labels with both models on the same labeled rows per metric. Missing/N/A targets are excluded; genuine zero labels are kept. For this comparison only, predictions are grouped into integer-centered bins: [0, 0.5), [0.5, 1.5), ..., [4.5, 5]. The last bin includes 5. These buckets are a visual summary of continuous scores, not additional model classes.
Aggregate histogram counts and bin definitions Β· Continuous distributions (SVG) Β· Teacher comparison (SVG)
These marginal distributions show how scores are spread; per-context agreement is measured by the MAE/RMSE/Spearman results above.
Training and data
- Teacher-labeled corpus: 524,288 serialized repository contexts, balanced by the original
programming,markup,data, andprosecategories before splitting. - Teacher: Qwen3.8-27B, using independent 0β5 scoring rubrics for the five targets.
- Training: 470,690 contexts.
- Validation: 26,844 contexts.
- Test: 26,754 contexts.
- Split: deterministic repository-grouped 90/5/5 hashing, seed 73021. Contexts with unidentified repository identity are training-only. The two variants use identical splits.
- Inputs: original visible source text, including serialized
Repository:/File:structure where present. Teacher prompts, teacher scores, AST metrics, and other CPU metadata are not model inputs. - Targets: five continuous outputs trained against integer teacher annotations; N/A targets are masked and never imputed as zero. The loss weights the five observed-target MSEs equally.
- Model selection: validation-only learning-rate searches, followed by full backbone-and-head fine-tuning for up to three epochs; the best validation checkpoint is exported. Test metrics are evaluated after selection.
- Architecture: original mmBERT backbone with padding-aware mean pooling and the bounded five-output scoring head described above.
- Precision: exported FP32 weights, without quantization. Training used FP32 parameters/optimizer state and BF16 activations.
The model weights, tokenizers, inference wrapper, evaluation summaries, and checksum-based provenance are published here. Raw training contexts, teacher annotations, optimizer/scheduler/RNG states, intermediate training checkpoints, and per-example test predictions are not included.
Intended use and limitations
Use these models to rank or describe visible code/repository contexts for dataset curation, experimentation, and scoring. Scores are estimates learned from the teacher's rubric. A high score does not verify correctness, security, license compatibility, or repository-wide quality. A documentation-heavy or data-heavy context is still a valid input, but these models do not replace a content-type classifier.
Evaluation is held out by the available repository identity. It does not establish deduplication across repository forks or mirrors, nor accuracy on all programming languages, domains, or input distributions. Language/category-specific evaluation is not reported here. Very long contexts use weighted averaging, which can dilute small but important sections. Functionality-based code quality, execution outcomes, and human preference were not independently measured in this evaluation.
Export verification and provenance
Each export was reloaded through AutoModel.from_pretrained and AutoTokenizer.from_pretrained, then checked numerically against its original trained inference bundle. Verification exercises padding, multiple contexts, special tokens, content-token weighting, and multi-chunk aggregation. See verification.json for the measured maximum score difference and provenance.json for source run identifiers, parameter counts, and source checkpoint/data-manifest SHA-256 fingerprints.
License and attribution
The upstream mmBERT-small and mmBERT-base checkpoints are distributed under the MIT license. This repository uses the MIT license; see LICENSE. Credit for the pretrained backbones belongs to the mmBERT authors and JHU-CLSP. Evaluation and fine-tuning results above apply to the Stackifiers derivatives.
- Downloads last month
- 24
Model tree for Machacini/stackifiers-repo
Base model
jhu-clsp/mmBERT-base
