
Rearchitecting LLMs: Structural techniques for efficient models
Author(s): Pere Martra (Author)
- Publisher Finelybook 出版社: Manning
- Publication Date 出版日期: February 23, 2027
- Language 语言: English
- Print length 页数: 380 pages
- ISBN-10: 1633434338
- ISBN-13: 9781633434332
Book Description
By default, general purpose LLMs are not optimized for specific domains and business goals. Using techniques like specialized fine-tuning, pruning unnecessary neural components, and knowledge distillation, you can rearchitect your models to cost less, run faster, and deliver more accurate results.
This book turns research from the latest AI papers into production-ready practices for domain-specific model optimization. As you work through this practical book, you’ll perform hands-on surgery on popular open-source models like Llama-3, Gemma, and Qwen to create cost-effective local small language models (SLMs). Along the way, you’ll learn how to combine behavioral analysis with structural modifications, identifying and removing parts that don’t contribute to your model’s goals, and even use “fair pruning” to reduce model bias at the neuron level.
What’s inside
- Universal techniques for customizing model architecture
- End-to-end pipelines for model rearchitecting
- Improve bias and explainability with model “cleanup”
- Replacing external LLMs with local SLMs
About the reader
For practicing AI, ML, and data engineers who know Python.
About the author
Pere Martra is an Applied AI Engineer, the creator of the Optipfair model efficiency library, an international AI speaker, and maintainer of widely-used LLM courses and popular open-source tools. He is the author of Large Language Models Projects.
Editorial Reviews
Editorial Reviews
About the Author
contents
PART 1: FOUNDATIONS
1 Why rearchitecting LLMs matters
2 An end-to-end rearchitecting project
3 A blueprint to modern transformers
PART 2: HANDS-ON OPTIMIZATION
4 Building smaller and faster LLMs with depth pruning
5 Shaping model architectures via width pruning
6 Knowledge recovery through distillation
7 Model specialization
8 Attention optimization
9 Dynamic routing with Mixture of Experts
PART 3: BEYOND THE BLACK BOX: FAIRNESS, VISUALIZATION, AND
APPLICATION
10 Exploring the transformer black box
11 Optimizing while eliminating biases
12 Capstone project — replacing agentic API calls with a specialized
SLM
Appendix A. A Gemma-3 case study in SLM architectural re nements
Appendix B. Capabilities evaluation with lm-evaluation-harness
Appendix C. Energy consumption evaluation
Appendix D. Inference performance evaluation
finelybook
