Show HN: Duplicate 3 layers in a 24B LLM, logical deduction .22→.76. No training
TL;DR Highlight
Duplicating 3 layers in Devstral-24B lifted BBH logical deduction from 0.22 to 0.76, no training
Who Should Read
A developer running local LLMs with llama.cpp who wants more reasoning performance without retraining
Core Mechanics
- Duplicating 3 layers boosted reasoning
- Running layers 12-14 of Devstral-24B a second time took BBH logical deduction from 0.22 to 0.76, per the author.
- No training or weight changes; hidden states simply pass through the same layers twice.
- Qwen2.5-Coder-32B improved too
- Duplicating layers 7-9 raised reasoning (causal + logic + navigation) from 76.5% to 94.1% on the author's custom probes.
- EQ went from 92.1 to 93.6.
- Standard benchmarks showed trade-offs
- On an H200 lm_eval run, causal_judgement rose 0.5775→0.6364 and gsm8k_cot (strict) 0.8408→0.8704.
- ifeval and mbpp dropped, and the overall average fell slightly from 0.7610 to 0.7488.
- The author summarizes it as better math and causal reasoning but worse instruction following and code generation.
- Block boundaries are sharp
- Duplicating a single layer does almost nothing; blocks of 3-4 layers are needed.
- Shifting the block by one layer makes the gain vanish or invert.
- Different patterns give different profiles
- Double-pass on 13-16 favors math and triple-pass favors EQ.
- The interleaved 13,13,14,14,15,15,16 pattern gives the biggest math gain but lowers EQ.
- The cost is VRAM and speed
- Three extra layers on a 24B model add about 1.5 GiB of VRAM.
- Three extra layers on a 40-layer model make inference about 7.5% slower.
Community Reactions
- Opinion: the explanation doesn't hold up
- One commenter argued duplication can only break things, selectively disabling something that hurts reasoning, such as a refusal circuit from RLHF.
- They think this is why scores rise rather than reasoning being boosted.
- Not new, commenters pointed out
- Commenters noted David Ng found this two years ago and it was discussed on HN a week earlier.
- Another said layer duplication has been done since early Llama releases and in image models via ComfyUI nodes.
- Experience: repeating layers gave garbage
- One commenter built a minimal inference engine for Qwen2.5/Qwen3 and got garbage output when repeating layers.
- They also found that removing some layers changed little, and removing later layers made the model never emit EOS.
- Concern: losses elsewhere may outweigh gains
- One commenter expects performance to drop on a fair mix of tasks.
- Another said real benchmarks are needed rather than a 0.2→0.7 jump on custom probes.
How to Apply
- Build a layer-duplicated version of your model
- Today, if you have llama.cpp and a GGUF model, use layer_path.py to build a new GGUF with a custom path.
- For a 24B-class model, start with -p "0..14,12,13,14,15..39".
- Compare before/after on your real tasks
- Run about 50 real prompts from your service on both the base and duplicated model.
- Check instruction following and code generation, which may get worse.
- Find the best block per model with sweep.py
- Circuits differ per model, so run sweep.py with block sizes 3-5 and stride 1.
- Start with large blocks (8 layers) over a wide stride, then narrow down.
- Check your VRAM and latency budget
- Measure memory and latency before deploying, since both grow with duplicated layers.
- Use about 1.5 GiB and about 7.5% slowdown for 3 extra layers on 24B as the baseline.
Try It
# Run in shell (needs llama.cpp build and a base GGUF; uses the repo's tools)
git clone https://github.com/alainnothere/llm-circuit-finder
cd llm-circuit-finder
pip install gguf requests tqdm
# Devstral-24B: run layers 12-14 a second time
python layer_path.py model.gguf improved.gguf -p "0..14,12,13,14,15..39" -v
# Start the server, then validate with lm_eval
llama-server -m improved.gguf --port 8089 -ngl 99Terminology
Related Papers
A Beginner's Guide to Local AI with Inkling, Qwen, and Unsloth
Install Unsloth Desktop, load a quantized Qwen model, and share a private ChatGPT-like AI on your home LAN.
Muru – AI-assisted Rust server for Python apps by mod_WSGI's creator
mod_wsgi's creator is building Muru, an AI-assisted Rust ASGI/WSGI server, documenting it in public
87% of the Anthropic power will come from gas and 11% from coal in 2028
Analysis of Anthropic's contracted data centers: 87% gas, 11% coal power in 2028
Anthropic’s Nasdaq debut
Anthropic listed on Nasdaq and closed its first day below its opening price.
OpenAI still has a WebRTC Problem
WebRTC drops late audio, hurting voice AI; MoQ retransmits and buffers instead
Gemini 4 Neon
Gemini 4 Neon cuts cost per task 32% versus Carbon, at $3 input and $15 output per million tokens
AI is killing All About Berlin
After Google AI Overviews, a Berlin guide site lost 70-75% of its traffic.
Not Everything Needs an LLM
PostHog used small decision models to skip 98.7% of expensive LLM calls