DL-USL is a deep learning engineering specification language for AI coding agents.
It is not trying to make PyTorch syntax simpler. Its purpose is to make AI agents generate more stable, testable, exportable, and optimizable deep learning project code.
User writes task spec
-> AI generates a complete project
-> AI generates acceptance tests
-> training logic is checked
-> performance is profiled
-> C++/CUDA optimization is planned only when needed
Deep learning vibe coding has a control problem. If the user only asks an AI agent to "train a model", the agent may:
- read the wrong data field
- infer the wrong label count
- ignore padding masks
- leak validation or test behavior into training
- update the optimizer during evaluation
- forget to save the best checkpoint
- export a model without verifying inference shape
- generate performance code before correctness is proven
- produce a script that appears complete but cannot be trusted
DL-USL makes those risks explicit as project outputs, rules, tests, profiling gates, fallback requirements, and completion criteria.
DL-USL is an AI project generation control layer.
The user should not have to repeatedly tell an AI agent:
What are the data fields?
What is label_count?
What is the batch shape?
Can eval run backward?
Which metric saves the checkpoint?
How is export verified?
Which tests are required?
When should optimization happen?
Does C++ match the Python reference?
Did benchmark prove a speedup?
DL-USL fixes those decisions in a spec so the AI has less room to improvise.
A DL-USL-compatible agent should generate a project structure like:
configs/config.yaml
src/data.py
src/model.py
src/train.py
src/evaluate.py
src/export.py
tests/test_shapes.py
tests/test_training_step.py
tests/test_eval_no_grad.py
tests/test_export.py
The first target is a correct PyTorch reference project. Optimization comes after tests and profiling.
DL-USL uses a layered optimization policy:
- Generate a plain PyTorch reference implementation first.
- Generate pytest acceptance tests for shapes, training step, eval no-grad behavior, checkpointing, and export.
- Profile the reference project before applying performance work.
- Try PyTorch-native optimizations first:
torch.compile, AMP, DataLoader settings. - Only plan C++/CUDA custom operators when profiling proves a bottleneck.
- Any C++/CUDA path must have Python reference parity tests, benchmark evidence, and fallback.
Technical background:
- PyTorch documents
torch.compileas a JIT compilation path that can accelerate PyTorch code with limited code changes, while tracing difficulty can cause graph breaks: https://docs.pytorch.org/tutorials/intermediate/torch_compile_tutorial.html - PyTorch documents C++/CUDA custom operators, including
torch.library.opcheckandtorch.utils.cpp_extension: https://docs.pytorch.org/tutorials/advanced/cpp_custom_ops.html
dl-usl-v0.1.zh.md: Chinese explanation of the DL-USL v0.1 positioning and spec shape.optimization-roadmap.zh.md: Optimization roadmap fortorch.compile, AMP, DataLoader, and C++/CUDA custom operators.deep_learning_training_pipeline.usl: Generic supervised-learning project generation control spec.transformer_text_classification.usl: Transformer text classification spec.cnn_image_classification.usl: CNN image classification spec.
v0.1: Generate PyTorch project skeleton
v0.2: Generate pytest acceptance tests
v0.3: Add semantic checker for shape / loss / eval / export
v0.4: Add torch.compile / AMP / DataLoader optimization controls
v0.5: Add C++/CUDA custom operator generation gates with reference + benchmark + fallback
DL-USL reuses USL v0.1 blocks:
goal -> deep learning project generation objective
actor -> user, AI agent, runtime, experiment tracker
entity -> dataset, tensor, model, tests, project files, profiler, optimizer, checkpoint, export, custom operator plan
state -> checkpoint, export artifact, profile, optimization lifecycle
flow -> project generation, data preparation, forward pass, training step, evaluation, testing, profiling, optimization, export
rule -> correctness, testing, profiling, optimization, fallback rules
error -> stable failure modes
test -> acceptance checks
limit -> files the agent may or must not modify
done -> completion criteria
If you have the main USL CLI available:
npm run usl -- check /Users/liuyeqing/Desktop/DL-USL/deep_learning_training_pipeline.usl
npm run usl -- check /Users/liuyeqing/Desktop/DL-USL/transformer_text_classification.usl
npm run usl -- check /Users/liuyeqing/Desktop/DL-USL/cnn_image_classification.usl
npm run usl -- gen-prompt /Users/liuyeqing/Desktop/DL-USL/deep_learning_training_pipeline.uslThis standalone repo currently contains the DL-USL profile and examples. The parser/checker lives in the main USL project.
MIT