- π¦ LagerPilot-Qwen: The On-Premises Β§ 377 HGB Goods Receipt Auditor & SAP MIGO Assistant
- π― Executive Summary (English / Deutsch)
- ποΈ Architecture & Pipeline
- π Comprehensive 10-Use-Case Stress-Test (100% Pass)
- π Quickstart in 3 Ways
- π₯οΈ Interactive Ramp Terminal (Web UI)
- π Enterprise ERP & Hardware Scanner Integration
- π¦ Publishing to Hugging Face & Ollama
- π Repository Structure
- π¬ Domain Modeling & Methodology
- βοΈ Legal & Compliance Notice
π¦ LagerPilot-Qwen: The On-Premises Β§ 377 HGB Goods Receipt Auditor & SAP MIGO Assistant
Engineered for German Warehouse Logistics & Commercial Code Compliance: The first open-source, edge-native AI auditor fine-tuned specifically for the #1 legal and financial bottleneck of German warehouse operations: Goods Receipt Reconciliation & Commercial Defect Notice under Β§ 377 German Commercial Code (HGB).
π― Executive Summary (English / Deutsch)
English
German industrial SMEs lose an estimated β¬30,000 to β¬150,000 annually because receiving ramps miss the strict German Commercial Code (Β§ 377 HGB) objection deadlines. Under Β§ 377 Abs. 2 HGB, if an unannounced shortage, wrong part (Aliud), damaged packaging, or missing certificate is not formally objected to within hours or days, the goods are legally deemed accepted as fulfilling the contractβforfeiting all warranty and damages claims.
LagerPilot-Qwen is an ultra-lightweight, 0.5B-parameter Small Language Model (SLM) running 100% on-premise on cheap CPU edge hardware (mini-PC / NUC / Zebra terminal) with zero cloud fees and zero GDPR exposure. It bridges OCR delivery notes, ERP purchase orders, and physical ramp findings to output:
- Exact packaging unit conversions (Kartons/Gebinde to StΓΌck).
- Deterministic 3-tier traffic-light decisions (
FREIGABE,MΓNGELRΓGE_ERFORDERLICH,SPERRE). - Legally formal German objection notices under Β§ 377 HGB / Β§ 439 BGB.
- Instant SAP MIGO BAPI movement payloads (
101,103,122).
Deutsch
Das deutsche Handelsgesetzbuch verzeiht keine Schlamperei an der Rampe: Wer als Kaufmann offene MΓ€ngel, Mindermengen oder Falschlieferungen nicht unverzΓΌglich rΓΌgt, verliert nach Β§ 377 Abs. 2 HGB alle GewΓ€hrleistungsansprΓΌche (Genehmigungsfiktion). Der gΓ€ngige Stempel βUnter Vorbehalt angenommenβ ist rechtlich wertlos. LagerPilot-Qwen ist die erste spezialisierte Open-Source Edge-KI, die das Beleg- und Einheitenchaos an der Laderampe eliminiert und rechtssichere PrΓΌfprotokolle auf Knopfdruck erzeugt.
ποΈ Architecture & Pipeline
flowchart TD
A["Delivery Slip OCR / PDF / EDI"] --> D{"LagerPilot Edge Engine (Qwen2.5-0.5B + Guardrails)"}
B["ERP Purchase Order (SAP / proALPHA)"] --> D
C["Ramp Note & Barcode Scan (GS1-128 / VDA 4902)"] --> D
D -->|"Clean Match & VPE Conversion"| E["π’ STATUS: FREIGABE"]
E --> E1["SAP MIGO 101 (Unrestricted High-Rack)"]
D -->|"Shortage, Aliud, Damage, MHD"| F["π‘ STATUS: MΓNGELRΓGE_ERFORDERLICH"]
F --> F1["SAP MIGO 103 (Blocked Stock / KlΓ€rplatz)"]
F --> F2["Automated Β§ 377 HGB Legal Letter"]
F --> F3["Carrier Reservation on CMR"]
D -->|"Hazmat Spill, No SDS, Wrong Consignee"| G["π΄ STATUS: SPERRE"]
G --> G1["SAP MIGO 122 (Return / Annahmeverweigerung)"]
G --> G2["Immediate Hazmat Containment (ADR/WHG)"]
π Comprehensive 10-Use-Case Stress-Test (100% Pass)
Tested against the complete operational spectrum of German contract and industrial logistics:
| ID | Scenario | Category | Expected Status | Actual Status | Β§ 377 Notice | Pass |
|---|---|---|---|---|---|---|
| UC-01 | Clean Intake: 20 cartons Γ 50 pcs = 1,000 pcs | VPE Conversion | FREIGABE |
FREIGABE |
No | β |
| UC-02 | Unannounced Shortage: 420 pcs delivered vs 500 PO | Quantity Defect | MΓNGELRΓGE |
MΓNGELRΓGE |
Yes (Form letter) | β |
| UC-03 | Surplus Dumping: 350 pcs delivered vs 200 PO | Overdelivery | MΓNGELRΓGE |
MΓNGELRΓGE |
Yes (Form letter) | β |
| UC-04 | Unauthorized Substitution: Revision B instead of Rev A | Specification (Aliud) | MΓNGELRΓGE |
MΓNGELRΓGE |
Yes (Form letter) | β |
| UC-05 | Transport Damage: Crushed pallet, wet cartons | Physical Transit | MΓNGELRΓGE |
MΓNGELRΓGE |
Yes (CMR note) | β |
| UC-06 | Hazmat Leak: UN 1219 solvent leaking, missing SDS | ADR / GGVSEB / REACH | SPERRE |
SPERRE |
Yes (Lockout) | β |
| UC-07 | Expiry Date Violation: Remaining shelf life 6 weeks vs 12 mo | Quality / MHD | MΓNGELRΓGE |
MΓNGELRΓGE |
Yes (Form letter) | β |
| UC-08 | Missing Quality Certificate: EN 10204 3.1 mill test missing | Compliance Defect | MΓNGELRΓGE |
MΓNGELRΓGE |
Yes (Blocked stock) | β |
| UC-09 | Carrier Misdelivery: Freight meant for third-party company | Logistics Error | SPERRE |
SPERRE |
Yes (Entry refusal) | β |
| UC-10 | Multi-Line Delivery: Line 1 & 3 clean, Line 2 short by 5 pcs | Multi-Item Split | MΓNGELRΓGE |
MΓNGELRΓGE |
Yes (Partial notice) | β |
π Quickstart in 3 Ways
1. Run with Docker Compose (Recommended for Production)
Spin up the entire edge stack including the Interactive Warehouse Ramp Terminal:
git clone https://github.com/your-username/LagerPilot-Qwen.git
cd LagerPilot-Qwen
docker compose up -d
Open your browser at http://localhost:8000 to access the tactile touchscreen dashboard.
2. Run with Ollama (Local LLM CLI)
LagerPilot is packaged with a dedicated Modelfile for Ollama:
# 1. Build the model into Ollama
ollama create lagerpilot -f Modelfile
# 2. Run interactive goods receipt audits
ollama run lagerpilot
3. Native Python / FastAPI (Edge CPU)
# Install dependencies
pip install -r requirements.txt
# Start the REST API and Web Terminal
python3 src/api.py
# Run the full 10-usecase stress test
python3 evaluation/run_all_usecases.py
π₯οΈ Interactive Ramp Terminal (Web UI)
The built-in web terminal at http://localhost:8000 is designed for rugged warehouse tablets and handheld terminals:
- Preset Buttons: One-click loading of all 10 standard German logistics scenarios.
- Hardware Barcode Parser: Decodes GS1-128 and German automotive VDA 4902 barcodes in real time.
- Traffic Light Status: High-contrast
FREIGABE(Green),MΓNGELRΓGE(Yellow), andSPERRE(Red). - 1-Click Legal Notice: Formatted German commercial objection text ready to copy or email to vendors.
- SAP BAPI Generator: Instant preview of
BAPI_GOODSMVT_CREATEpayloads for ERP dispatch.
π Enterprise ERP & Hardware Scanner Integration
SAP S/4HANA & ECC 6.0 Integration
LagerPilot maps audit decisions directly to SAP movement types:
- Movement Type
101(FREIGABE): Goods receipt for purchase order into unrestricted-use stock. - Movement Type
103(MΓNGELRΓGE_ERFORDERLICH): Goods receipt into GR blocked stock (Gesperrter Bestand / KlΓ€rplatz). - Movement Type
122(SPERRE): Return delivery to vendor (RΓΌcklieferung an den Lieferanten / Annahme verweigert).
Industrial Barcode Scanning (GS1-128 & VDA 4902)
Scan barcodes directly on the ramp:
from src.gs1_parser import IndustrialBarcodeParser
# GS1-128 barcode parsing
barcode_data = IndustrialBarcodeParser.parse_gs1("(01)04012345678901(10)LOT-SKF-881(17)261231(30)50")
# Extracted: GTIN, Charge/Lot, MHD Date, Packaging Count
π¦ Publishing to Hugging Face & Ollama
Export Standalone Merged Weights
We provide an automated merger script that fuses the fine-tuned LoRA adapter into the base model:
python3 scripts/export_for_ollama.py
The standalone weights are saved to models/lagerpilot_qwen_merged/.
Upload to Hugging Face Hub
huggingface-cli login
huggingface-cli upload your-username/LagerPilot-Qwen2.5-0.5B-HGB ./models/lagerpilot_qwen_merged/ .
Quantize to GGUF for Ollama
python3 /path/to/llama.cpp/convert_hf_to_gguf.py models/lagerpilot_qwen_merged --outfile models/lagerpilot-q8_0.gguf --outtype q8_0
ollama create your-username/lagerpilot -f Modelfile
ollama push your-username/lagerpilot
π Repository Structure
lagerAI/
βββ Dockerfile # Container build for edge deployment
βββ docker-compose.yml # 1-command startup stack
βββ Modelfile # Native Ollama manifest
βββ README.md # Production documentation & guide
βββ requirements.txt # Minimal pinned dependencies
βββ data/
β βββ generate_warehouse_dataset.py # Realistic German goods receipt dataset generator
β βββ train_dataset.json # 100 fine-tuning samples
β βββ val_dataset.json # 20 validation samples
βββ models/
β βββ lagerpilot_qwen/ # LoRA adapter weights (2.1 MB)
β βββ lagerpilot_qwen_merged/ # Merged standalone fp32 model
βββ src/
β βββ api.py # FastAPI microservice & Web UI endpoint
β βββ config.py # Prompts & system instructions
β βββ erp_connector.py # SAP S/4HANA BAPI & proALPHA payload generator
β βββ gs1_parser.py # GS1-128 & VDA 4902 industrial barcode decoder
β βββ inference.py # On-prem CPU engine with safety guardrails
β βββ train.py # PEFT LoRA training pipeline
β βββ web_ui.html # Rugged touchscreen warehouse terminal
βββ evaluation/
β βββ test_cases.json # Initial 5 benchmark cases
β βββ benchmark.py # 5-case benchmark suite
β βββ comprehensive_test_suite.json # 10-usecase full industrial stress test
β βββ run_all_usecases.py # Comprehensive evaluation runner
β βββ comprehensive_report.json # Verified 100% test report output
βββ scripts/
βββ export_for_ollama.py # LoRA weight fusion utility
π¬ Domain Modeling & Methodology
LagerPilot-Qwen was developed through practical domain modeling of German contract logistics (Mittelstand Kontraktlogistik) and statutory commercial law. Rather than relying on generic LLM summarization, the system's operational scenarios and deterministic guardrails are modeled directly on:
- Statutory Jurisprudence: BGH case law governing the strict 1β2 business day commercial defect notification deadlines under Β§ 377 HGB, the legal fiction of deemed acceptance (Β§ 377 Abs. 2 HGB), and B2B cure rights (Β§ 439 BGB).
- Industrial Standards: Packaging unit conversion rules (Kartons/Gebinde to base pieces), GS1-128 / VDA 4902 transport labels, and EN 10204 3.1 mill certificate requirements.
- Ramp Safety Protocols: Zero-tolerance hard overrides for statutory hazardous materials under ADR, GGVSEB, REACH, and the German Water Resources Act (Β§ 22 WHG).
βοΈ Legal & Compliance Notice
LagerPilot-Qwen is designed to assist warehouse personnel in commercial goods receipt inspection (Β§ 377 HGB). It generates draft commercial notices and ERP recommendations. Users should review high-liability notices with internal legal counsel. Released under the Apache 2.0 License.
- Downloads last month
- 332