---
title: "~Don't~ Repeat Yourself"
description: "Hugging Face Transformers deliberately rejects DRY in favor of a single model file policy: all code for a model's forward pass lives in one file, even if attention and other components are duplicated across 50+ models."
url: "https://swe.quest/articles/don-t-repeat-yourself-40dca379376cd3f9"
canonical: "https://huggingface.co/blog/transformers-design-philosophy"
source: "Hugging Face"
published: "2022-04-05"
difficulty: "easy"
kind: "Opinion"
reading_minutes: 8
tags: ["open-source","machine-learning","refactoring","python"]
---

# ~Don't~ Repeat Yourself

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2022-04-05, 8 min read, Opinion. Original: [https://huggingface.co/blog/transformers-design-philosophy](https://huggingface.co/blog/transformers-design-philosophy)

## Summary

Hugging Face Transformers deliberately rejects DRY in favor of a single model file policy: all code for a model's forward pass lives in one file, even if attention and other components are duplicated across 50+ models. The justification is that contributors and users read and tweak model code, ML architectures change too fast for stable shared abstractions, and published models are static with one-directional dependencies on predecessors. To limit maintenance cost, a "# Copied from" mechanism enforces that marked code stays identical to the source and auto-syncs fixes. The costs are keeping a unified API, handled with about 20,000 daily tests and strict review, and having no good way to integrate cross-cutting research like Performer attention.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [Open source](https://swe.quest/tags/open-source.md) (Engineering practices)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)
- [Refactoring & migrations](https://swe.quest/tags/refactoring.md) (Engineering practices)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- Transformer model architecture basics ([easy posts on System design](https://swe.quest/tags/system-design.md?difficulty=easy))

## Keywords

Hugging Face Transformers, DRY principle, BERT, DeBERTa, Performer, single model file policy

## Related posts

- [Replit’s new AI Model now available on Hugging Face](https://swe.quest/articles/replit-s-new-ai-model-now-available-on-hugging-face-3b96faee1bd121e8.md): Replit · 2023-10-10 · Easy · 2 min read · LLMs, AI for coding, Model training, Open source
  Replit Code V1.5 3B is an open code-completion model released on Hugging Face under a license that allows commercial use.
- [Transformers Model Integration Contracts](https://swe.quest/articles/transformers-model-integration-contracts-c220e64c1cee4ec0.md): Hugging Face · 2026-11-03 · Medium · 8 min read · Testing, CI/CD, Machine learning, Python
  Model Integration Contracts (MICs) package fast CPU integration tests for Transformers: a shrunk fixture model built from a real checkpoint's config (keeping every layer kind, tokenizer files and weight format), a runnable Markdown usage path, and human-reviewed baseline outputs.
- [Building LLMs for Code Repair](https://swe.quest/articles/building-llms-for-code-repair-56ef089519b9fe77.md): Replit · 2024-04-02 · Hard · 14 min read · Model training, AI for coding, LLMs, Evaluation, Data pipelines
  Replit finetuned a 7B code model (DeepSeek-Coder-Instruct-v1.5) to repair Python errors flagged by LSP diagnostics.
- [TRL v1.0: Post-Training Library Built to Move with the Field](https://swe.quest/articles/trl-v1-0-post-training-library-built-to-move-with-the-field-09da5ced251e79bc.md): Hugging Face · 2026-03-31 · Medium · 15 min read · Model training, Open source, API design, Python, LLMs
  TRL v1.0 turns Hugging Face's post-training codebase, now covering 75+ methods and downloaded 3M times a month, into a library with an explicit stability contract.
- [The PR you would have opened yourself](https://swe.quest/articles/the-pr-you-would-have-opened-yourself-8befd4446b17e1d6.md): Hugging Face · 2026-04-16 · Medium · 11 min read · AI for coding, Open source, LLMs, Testing, Code review
  Hugging Face released a Claude Code Skill plus a separate non-agentic test harness for porting language models from transformers to mlx-lm, so new architectures become available on MLX shortly after they land in transformers.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
