Chapter 63

পেপার রিপ্রোডিউস

Reproducing Papers
🔬 কেন Reproduce করবেন?
পেপার পড়া আর পেপার implement করা সম্পূর্ণ আলাদা skill। Reproduce করতে গেলে hidden assumption, hyperparameter trick, এবং engineering detail সব ধরা পড়ে। এটাই আপনাকে paper-reader থেকে researcher-এ পরিণত করে।

সঠিক পেপার বেছে নিন (প্রথম reproduction)

  • Code release আছে (official GitHub)।
  • Dataset public/downloadable।
  • Compute affordable (single GPU/Colab)।
  • 4-8 পৃষ্ঠার "workshop"/"short" paper, full SOTA নয়।
  • উদাহরণ: simple GAN, small transformer, একটা specific ablation।

Step-by-Step Workflow

1. পেপার deeply পড়ুন

সব hyperparameter, architecture detail, training schedule, dataset split table-এ লিখুন। Appendix প্রায়ই সবচেয়ে দরকারি অংশ।

2. Environment isolate করুন

# Conda env + exact versions
conda create -n repro python=3.10
pip install torch==2.1.0 transformers==4.36 numpy==1.26

3. Data পরীক্ষা করুন

  • Paper-এর split (train/val/test) match হচ্ছে?
  • Preprocessing — tokenizer, normalization, augmentation।
  • Sample size + class distribution paper-এর সাথে মিলিয়ে দেখুন।

4. Model skeleton লিখুন

Architecture figure দেখে layer-by-layer implement করুন। প্রতিটা module-এর shape print করুন। Total parameter count paper-এর সাথে compare করুন (±5% তে মেলা উচিত)।

5. Training loop

# Paper-এর মতো:
# - Optimizer: AdamW, lr=3e-4, β=(0.9, 0.999), wd=0.01
# - Scheduler: cosine, warmup=1000 step
# - Batch size: 256 (gradient accumulation দিয়ে fit)
# - Seed: 42
# - Mixed precision: bf16

6. Logging + Tracking

Weights & Biases / TensorBoard দিয়ে loss, lr, gradient norm, eval metric সব track করুন। Paper-এর figure reproduce করুন একই plot দিয়ে।

7. Comparison & Debug

  • Reported metric vs আপনার metric — gap কত?
  • <2% gap → success
  • >5% gap → কোথাও bug। Issue checklist চেক করুন।

Common Reproduction Pitfalls

⚠️ যেসব বাগ সবচেয়ে বেশি হয়
  • Tokenizer mismatch (BPE vs WordPiece)।
  • Wrong eval split / leakage।
  • LR scheduler-এর warmup ভুল।
  • Different random seed → high variance।
  • Mixed precision (fp16 vs bf16) gradient overflow।
  • Effective batch size mismatch (grad accum miss)।

Recommended First Papers to Reproduce

  1. MNIST CNN — sanity warmup।
  2. nanoGPT (Karpathy) — full GPT from scratch।
  3. MiniGPT / TinyLlama — small foundation model।
  4. LoRA on small LLM — PEFT pipeline।
  5. DDPM on CIFAR-10 — diffusion।
  6. SimCLR on STL-10 — self-supervised।

Reproducibility Standard

  • GitHub repo — README, requirements.txt, config।
  • Seed lock + deterministic flag।
  • Pretrained checkpoint release।
  • One-command reproduction script।
  • Result table + plot identical to paper।
  • Blog post explaining gap (if any) + lesson।
💡 Portfolio Gold
Successful reproduction (paper-এর author retweet পেলে bonus!) আপনার portfolio-এর সবচেয়ে শক্তিশালী item। PhD/research role-এ এটাই deciding factor।

সারসংক্ষেপ

✨ এই অধ্যায়ে যা শিখলাম
  • সঠিক paper বেছে নেওয়ার criteria।
  • 7-step reproduction workflow।
  • Common pitfall — tokenizer, scheduler, seed।
  • Reproducibility standard — public repo + report।