Downloads · 30 days
0
Bhargav-2007/anti-jamming-env
anti-jamming-env is a machine learning model from Bhargav-2007. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This environment simulates a real-world wireless link under intelligent jamming. Agents learn to select transmission parameters that maximize throughput while avoiding interference. The environment is OpenEnv-complian…
Downloads · 30 days
0
Access
Public
Updated Apr 10, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.lock378 KB · 49%
From the Hugging Face model README
This environment simulates a real-world wireless link under intelligent jamming. Agents learn to select transmission parameters that maximize throughput while avoiding interference. The environment is OpenEnv-compliant and provides reset(), step(), and state() with typed Pydantic models.
Key features:
The agent selects transmission parameters:
class AntiJammingAction(BaseModel):
frequency_channel: int # 0-63
tx_power_dbm: float # 0.0-30.0
modulation: str # BPSK, QPSK, 16QAM, 64QAM
coding_rate: str # 1/2, 2/3, 3/4, 5/6
beam_direction: int # 0-7
enable_fhss: bool # frequency hopping
enable_dsss: bool # direct sequence spread spectrum
enable_notch_filter: bool
The environment returns:
Dense reward combines:
Each task has a deterministic grader with score in [0.0, 1.0].
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
export HF_TOKEN="your_hf_token"
export API_BASE_URL="https://router.huggingface.co/v1"
export MODEL_NAME="Qwen/Qwen2.5-72B-Instruct"
export ANTI_JAMMING_TASK="easy"
python inference.py
The script prints only [START], [STEP], and [END] lines to stdout.
Baseline scores depend on the model and prompt. Example targets:
docker build -t bhargav-2007/anti-jamming-env:latest .
docker run -p 8000:8000 bhargav-2007/anti-jamming-env:latest
openenv validate .
enable_fhss=random.choice([True, False]),
enable_dsss=False,
enable_notch_filter=True
)
result = await env.step(action)
total_reward += result.reward
if result.done:
break
print(f"Total reward: {total_reward:.2f}")
await env.close()
asyncio.run(run_random_agent())
### Heuristic Agent (Frequency Hopper)
```python
async def run_heuristic_agent():
env = AntiJammingEnv(task="medium", max_steps=50)
result = await env.reset()
# Track jammed channels
jammed_channels = set()
current_freq = 0
for step in range(50):
obs = result.observation
# Update jammed channel list
for ch_state in obs.channel_states:
if ch_state.is_jammed:
jammed_channels.add(ch_state.frequency_index)
# Find clear channel
clear_channels = [i for i in range(64) if i not in jammed_channels]
if clear_channels:
current_freq = random.choice(clear_channels)
# Adaptive action
action = AntiJammingAction(
frequency_channel=current_freq,
tx_power_dbm=20.0,
modulation="QPSK",
coding_rate="2/3",
beam_direction=step % 8, # Rotate beam
enable_fhss=True,
enable_dsss=True,
enable_notch_filter=True
)
result = await env.step(action)
if result.done:
break
await env.close()
asyncio.run(run_heuristic_agent())
Verify environment compliance with OpenEnv specification:
# Install OpenEnv CLI
pip install openenv[cli]
# Validate environment
openenv validate .
# Expected output:
# ✓ openenv.yaml found and valid
# ✓ Action/Observation models properly defined
# ✓ reset() returns StepResult
# ✓ step() returns StepResult
# ✓ state() returns State
# ✓ Dockerfile builds successfully
Example using Stable-Baselines3:
from stable_baselines3 import PPO
from stable_baselines3.common.env_util import make_vec_env
# This requires a Gym wrapper (not included in base package)
# See examples/train_with_sb3.py for complete implementation
# Pseudocode:
# env = make_vec_env(lambda: GymWrapper(AntiJammingEnv(task="easy")), n_envs=4)
# model = PPO("MlpPolicy", env, verbose=1)
# model.learn(total_timesteps=100000)
# model.save("anti_jamming_ppo")
# Login to Hugging Face
huggingface-cli login --token $HF_TOKEN
# Create Space
huggingface-cli repo create anti-jamming-env --type space --space_sdk docker
# Push to Space
git remote add hf https://huggingface.co/spaces/Bhargav-2007/anti-jamming-env
git push hf main
# Space will auto-build from Dockerfile
# Access at: https://huggingface.co/spaces/Bhargav-2007/anti-jamming-env
| Task | Random Agent | Heuristic Agent | LLM Baseline (Qwen2.5-72B) |
|---|---|---|---|
| Easy | 0.15 | 0.55 | 0.65 |
| Medium | 0.08 | 0.35 | 0.45 |
| Hard | 0.05 | 0.20 | 0.30 |
The environment implements:
Six jammer types with increasing sophistication:
Contributions welcome. Please ensure:
pytest tests/openenv validate .MIT License. See LICENSE file for details.
@software{anti_jamming_env_2026,
author = {Bhargav-2007},
title = {AI-Powered Anti-Jamming Communication System},
year = {2026},
publisher = {GitHub},
url = {https://github.com/Bhargav-2007/openenv-anti-jamming}
}
Built for the OpenEnv Hackathon. Special thanks to Meta AI and Hugging Face for the OpenEnv framework and infrastructure support.