How pervasiveautonomylab/bern2edge works
Bern2Edge is a research framework for compressing pretrained teachers into Bernstein students, then deploying those students either as FPGA-oriented HLS or as interpretable rules. Its reusable package supplies data, models, distillation, and rule extraction; HLS provides separate compilers for networks and rules. The repository also contains experiment branches for certification, distribution shift, and TinyBERT substitution. Connections for unsampled subsystems are limited to README statements; source-level edges use indexed references or excerpts.
Main entry points: models.py Bernstein students · extraction.py Rule extraction · compile.py FC compiler · kdtrain.py Knowledge distillation
Components 21
Learning Core
- Data loaders
bern2edge/data.py - Teacher models
bern2edge/models.py - Bernstein students
bern2edge/models.py - Bernstein layer
bern2edge/bernstein.py - Knowledge distillation
bern2edge/kdtrain.py
Symbolic Rules
- Activation regimes
bern2edge/rule_extraction/bern_regimes.py - Rule extraction
bern2edge/rule_extraction/extraction.py - Rule quantization
bern2edge/rule_extraction/quantize.py - Rule fallback
hls/bern2hls/rules/fallback.py
HLS Deployment
- FC compiler
hls/bern2hls/fc/compile.py - FC code generation
hls/bern2hls/fc/codegen/axi_family.py - Rule compiler
hls/bern2hls/rules/compile.py - Synthesis workflow
hls/bern2hls/core/synth.py - Hardware collection
hls/bern2hls/core/collect.py
Research Experiments
- Robustness certification
MAGIC/relu_lirpa_certify.py - MAGIC rule studies
MAGIC/extract_rules.py - ACS shift studies
ACS/run_multiseed.py
Transformer Path
- FFN substitution
Transformer/stage3_substitute.py - Transformer utilities
Transformer/shared_utils.py
Other components
- Researcher
- Edge hardware
Connections 20
- Researcher → Data loaders: selects data
README.md - Data loaders → Knowledge distillation: feeds batches
README.md - Teacher models → Knowledge distillation: provides targets
README.md - Knowledge distillation → Bernstein students: trains student
README.md - Bernstein students → Bernstein layer: uses layer
bern2edge/models.py - Bernstein students → Rule extraction: extracts rules
README.md - Rule extraction → Activation regimes: analyzes regimes
bern2edge/rule_extraction/extraction.py - Rule extraction → Rule quantization: quantizes rules
- Bernstein students → FC compiler: compiles network
README.md - Rule extraction → Rule compiler: compiles rules
README.md - FC compiler → FC code generation: emits HLS
hls/bern2hls/fc/codegen/axi_family.py - FC code generation → Edge hardware: targets FPGA
README.md - Rule compiler → Rule fallback: uses fallback
- FC compiler → Synthesis workflow: runs synthesis
- Hardware collection → Synthesis workflow: uses out-of-context
hls/bern2hls/core/collect.py - Researcher → Robustness certification: runs study
README.md - Researcher → MAGIC rule studies: runs study
README.md - Researcher → ACS shift studies: runs study
README.md - Researcher → FFN substitution: runs experiment
README.md - FFN substitution → Transformer utilities: uses utilities
Transformer/stage3_substitute.py