Instructions to use kennedy-kitoko/Traffic-AI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Laya
How to use kennedy-kitoko/Traffic-AI with Laya:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Traffic AI
Traffic AI is a fast, local phase-decision model for adaptive traffic-signal control. It specializes the general-purpose convaiinnovations/laya-typed-decisions checkpoint for four traffic phases and runs without generating text.
The model scores four choices directly:
ETWT: east-west through traffic;NTST: north-south through traffic;ELWL: east-west left turns;NLSL: north-south left turns.
Traffic AI chooses the phase. A separate deterministic Traffic Protocol enforces yellow transitions, minimum green, maximum continuous green, event-triggered re-evaluation, starvation priority, hysteresis, and other operational constraints. Green duration is therefore controlled by the protocol rather than predicted as an unconstrained class.
Lineage
| Item | Value |
|---|---|
| Base model | convaiinnovations/laya-typed-decisions |
| Base revision | e929ae5cf69bc34259cd2f95c9e91145b818b1f0 |
| Base license | Apache-2.0 |
| Training method | Official Laya RLCD fine-tuning pipeline |
| Training seed | 3407 |
| Output weight | model.safetensors |
| Output size | 842,609,220 bytes |
| Output SHA-256 | 6f7b017bef105022a4f95a6ea84b1f3db3669f48cf9cbc6a320e5271bd697304 |
The exact model and tokenizer hashes are listed in SHA256SUMS.
Training data
The phase-specialization curriculum contains 3,200 deterministic synthetic traffic states:
- train: 2,400;
- validation: 400;
- test: 400.
Every split is balanced across the four phase labels. The rows use Laya's typed-decision schema (state, questions, gold) with soft phase distributions. The targets are computed by explicit traffic rules from queues, waiting times, approaching vehicles, downstream occupancy, and current-phase hysteresis.
This curriculum was generated without a simulator and without a teacher API. It teaches phase semantics; it is not evidence that the labels are globally optimal actions. SUMO performance was evaluated separately after training.
Training configuration
- official Laya RLCD loss;
- 10 epochs;
- micro-batch size 8;
- gradient accumulation 8;
- encoder learning rate
2.5e-5; - decision-head learning rate
1e-4; - weight decay
0.01; - seed
3407.
On the held-out 400-row phase-specification validation set, accuracy changed from 35.5% before specialization to 98.0% after specialization. This is an offline curriculum result, not a traffic-simulation metric. The post-training ECE was 0.2332, so the probabilities should not be treated as perfectly calibrated.
Download
hf download kennedy-kitoko/Traffic-AI \
--local-dir checkpoints/traffic-ai-v2
Verify the files from inside the downloaded directory:
sha256sum -c SHA256SUMS
Local inference
Install the Laya package in a CUDA-enabled Python environment and load the downloaded folder:
from laya import Agent
agent = Agent("checkpoints/traffic-ai-v2", device="cuda")
state = {
"intersection_id": "intersection_1_1",
"current_phase": "ETWT",
"phase_metrics": {
"ETWT": {"queue_vehicles": 4, "total_waiting_seconds": 80},
"NTST": {"queue_vehicles": 25, "total_waiting_seconds": 650},
"ELWL": {"queue_vehicles": 3, "total_waiting_seconds": 40},
"NLSL": {"queue_vehicles": 5, "total_waiting_seconds": 70},
},
}
questions = {
"phase": {
"type": "choice",
"instructions": "Choose the traffic phase that should be served next.",
"criteria": {
"ETWT": "East-west through traffic",
"NTST": "North-south through traffic",
"ELWL": "East-west left turns",
"NLSL": "North-south left turns",
},
}
}
result = agent.system_one(state, questions)
print(result["answers"]["phase"])
For batched real-time control, the project runner uses Agent.predict_batch(states, questions) and applies the Traffic Protocol after receiving the four probabilities.
SUMO integration and evidence
The complete controller, Traffic Protocol, reproducibility manifests, tests, and measured SUMO evidence are maintained in the Traffic AI GitHub repository.
The published studies distinguish:
- phase-model inference from protocol decisions;
- Jinan from Hangzhou experiments;
- the exact JevLight revision used for each city;
- measured evidence from interpretation;
- final results from preliminary campaigns.
Limitations
- This model has not been validated on real roads.
- Its synthetic curriculum does not prove optimal traffic control.
- The phase model depends on the external Traffic Protocol for safe timing behavior.
- Jinan and Hangzhou simulation results do not establish universal cross-city generalization.
- Reproduction can be methodologically and statistically equivalent without producing bit-identical CUDA weights.
- Operators must validate phase mappings, safety constraints, detectors, timing rules, and fail-safe behavior for each deployment.
License and attribution
The checkpoint is distributed under Apache-2.0, consistent with its Laya base model. The accompanying Traffic AI project code is separately published under MIT.
Traffic AI builds on:
- Downloads last month
- 3
Model tree for kennedy-kitoko/Traffic-AI
Base model
convaiinnovations/laya-typed-decisions
