惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
博客园_首页
T
Tailwind CSS Blog
美团技术团队
博客园 - 叶小钗
Microsoft Security Blog
Microsoft Security Blog
有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
大猫的无限游戏
大猫的无限游戏
Microsoft Azure Blog
Microsoft Azure Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
InfoQ
MongoDB | Blog
MongoDB | Blog
The Cloudflare Blog
J
Java Code Geeks
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
IT之家
IT之家
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Y
Y Combinator Blog

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - singam96/ReflexConv2D: A conv layer that modulat...
singam96 · 2026-06-24 · via Hacker News: Show HN

A convolutional layer that modulates its own output using a mask made from its own weights, with a residual skip connection.

Problem

Standard convolutions apply the same filter uniformly across the entire spatial domain. In image-to-image tasks (autoencoders, U-Nets), this spatial uniformity contributes to over-smoothed, blurry outputs — the model cannot selectively sharpen or attenuate features at different spatial locations.

Solution

ReflexConv2d lets each layer modulate its own output spatially using a mask extracted from its convolution weights, then adds a residual connection to preserve the input signal.

Step Operation Shape
1 Depthwise-like C→C convolution (B, C, H, W)
2 Sum weights across input channels × learnable squash (C, k, k)
3 Tile each k×k mask to H×W (C, H, W)
4 Elementwise multiply mask onto conv output (B, C, H, W)
5 1×1 pointwise projection (B, C', H, W)
6 Add residual skip (1×1 conv or identity) (B, C', H, W)

The spatial mask is globally learned (via squash and the conv weights) but shared across all input positions — the tiling preserves the kernel's internal structure without interpolation artifacts.

Result

In a U-Net autoencoder benchmark (both paths use residual skip connections), ReflexConv2d outperforms standard convolutions at every round of recursive encoding/decoding. Trained on Flick8k samples.

comparison

Rounds Standard Reflex Improvement
L1 ↓ PSNR ↑ L1 ↓ PSNR ↑ L1 PSNR SSIM ↑
1 0.1134 16.23 0.0933 17.97 17.7% +1.7 dB 0.64 → 0.74
2 0.1458 13.62 0.1114 16.49 23.6% +2.9 dB 0.54 → 0.66
4 0.2196 8.85 0.1416 14.37 35.5% +5.5 dB 0.40 → 0.53
8 0.4441 1.40 0.1887 11.86 57.5% +10.5 dB 0.22 → 0.37

The weight-derived mask preserves structure through repeated encoding — the model retains detail where standard convolutions degrade. The advantage grows with each recursive pass.

Ablation

What happens when we remove components?

ablation

Config L1 @ R8 PSNR @ R8 SSIM @ R8
Standard + Residual 0.4441 1.40 dB 0.22
Reflex − Residual 0.2718 (−39%) 8.50 dB 0.28
Reflex − Squash 0.1896 (−57%) 12.02 dB 0.32
Reflex Full 0.1887 (−57%) 11.86 dB 0.37
  • Residual helps — Full reflex (0.1887) beats no-residual reflex (0.2718), but even without residual, reflex still beats standard (0.4441)
  • Squash has minimal impact — Removing it (0.1896) performs nearly identically to full reflex (0.1887). The raw kernel sum is the real signal

Install

pip install git+https://github.com/singam96/ReflexConv2D.git

Usage

import torch
from reflex_conv2d import ReflexConv2d

layer = ReflexConv2d(in_channels=64, out_channels=128, kernel_size=3)
x = torch.randn(4, 64, 32, 32)
y = layer(x)                # (4, 128, 32, 32)

Drop it into any model:

nn.Sequential(
    ReflexConv2d(3, 64, 3),
    nn.ReLU(),
    ReflexConv2d(64, 64, 3),
    nn.ReLU(),
    ...
)

Reproduce

# Run full ablation study (trains 4 models, generates images + metrics)
python benchmark.py

# Run main comparison only
python demo_comparison.py

Outputs:

  • comparison.jpg — standard vs reflex visual comparison
  • ablation_grid.jpg — all ablation configs side by side
  • ablation_*.jpg — individual ablation result images
  • Console metrics (L1, PSNR, SSIM per round)

Test

pip install pytest
python -m pytest test_reflex_conv2d.py

Notes

  • The squash parameter (C scalars initialized to 1) lets the network selectively disable self-modulation on any channel.
  • Residual skip uses nn.Identity when in_channels == out_channels, otherwise a 1×1 conv to match dimensions.
  • Odd kernel sizes only (1, 3, 5, 7, ...). Even kernels shift spatial dimensions due to asymmetric padding.
  • Negligible parameter increase over standard Conv2d(C, C', k): C (squash) + skip conv when channels differ.

License

Apache 2.0