programasweights 0.2.5__tar.gz → 0.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (467) hide show
  1. programasweights-0.2.8/.gitignore +14 -0
  2. {programasweights-0.2.5 → programasweights-0.2.8}/AGENTS.md +52 -39
  3. {programasweights-0.2.5 → programasweights-0.2.8}/PKG-INFO +3 -3
  4. {programasweights-0.2.5 → programasweights-0.2.8}/PYPI_README.md +1 -1
  5. programasweights-0.2.8/README.md +113 -0
  6. {programasweights-0.2.5 → programasweights-0.2.8}/docs/adr/001-llama-cpp-over-pytorch.md +1 -1
  7. {programasweights-0.2.5 → programasweights-0.2.8}/docs/api-reference/cli.md +1 -1
  8. {programasweights-0.2.5 → programasweights-0.2.8}/docs/api-reference/python-sdk.md +1 -1
  9. {programasweights-0.2.5 → programasweights-0.2.8}/docs/architecture.md +1 -1
  10. programasweights-0.2.8/docs/case-studies/log-monitoring.md +132 -0
  11. programasweights-0.2.8/docs/case-studies/semantic-search.md +146 -0
  12. programasweights-0.2.8/docs/case-studies/site-navigation.md +127 -0
  13. programasweights-0.2.8/docs/case-studies/tool-calling.md +477 -0
  14. programasweights-0.2.8/docs/guide/writing-good-specs.md +11 -0
  15. {programasweights-0.2.5 → programasweights-0.2.8}/docs/index.md +1 -1
  16. programasweights-0.2.8/examples/paw_monitor.py +180 -0
  17. {programasweights-0.2.5 → programasweights-0.2.8}/mkdocs.yml +5 -0
  18. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/__init__.py +26 -18
  19. programasweights-0.2.8/programasweights/_output.py +34 -0
  20. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/cache.py +26 -17
  21. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/client.py +28 -16
  22. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/config.py +4 -0
  23. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/runtime_llamacpp.py +23 -16
  24. {programasweights-0.2.5 → programasweights-0.2.8}/pyproject.toml +2 -2
  25. programasweights-0.2.5/.cursor/rules/sdk-publishing.mdc +0 -53
  26. programasweights-0.2.5/.cursor/rules/vllm-deployment.mdc +0 -118
  27. programasweights-0.2.5/.git +0 -1
  28. programasweights-0.2.5/.github/workflows/web-sdk.yml +0 -51
  29. programasweights-0.2.5/.gitignore +0 -76
  30. programasweights-0.2.5/.gitmodules +0 -3
  31. programasweights-0.2.5/.hatch_build.toml +0 -28
  32. programasweights-0.2.5/1apple.jpg +0 -0
  33. programasweights-0.2.5/1apple2.jpg +0 -0
  34. programasweights-0.2.5/2apples.jpg +0 -0
  35. programasweights-0.2.5/2apples2.jpg +0 -0
  36. programasweights-0.2.5/3apples.jpg +0 -0
  37. programasweights-0.2.5/3apples2.jpg +0 -0
  38. programasweights-0.2.5/479400.png +0 -0
  39. programasweights-0.2.5/4apples.jpg +0 -0
  40. programasweights-0.2.5/4apples2.jpg +0 -0
  41. programasweights-0.2.5/4apples3.jpg +0 -0
  42. programasweights-0.2.5/4apples4.jpg +0 -0
  43. programasweights-0.2.5/5apples.jpg +0 -0
  44. programasweights-0.2.5/6apples.jpg +0 -0
  45. programasweights-0.2.5/8apples.jpg +0 -0
  46. programasweights-0.2.5/9apples.jpg +0 -0
  47. programasweights-0.2.5/FLOW_SUMMARY.md +0 -202
  48. programasweights-0.2.5/MANIFEST.in +0 -25
  49. programasweights-0.2.5/ONNX_MIGRATION_PLAN.md +0 -84
  50. programasweights-0.2.5/PREFIX_TOKENS_DESIGN.md +0 -176
  51. programasweights-0.2.5/README.md +0 -186
  52. programasweights-0.2.5/TRUNCATION_CHANGES.md +0 -185
  53. programasweights-0.2.5/USE_CASES_AND_IDEAS.md +0 -748
  54. programasweights-0.2.5/VERIFICATION_USAGE.md +0 -282
  55. programasweights-0.2.5/analyze_dataset.py +0 -372
  56. programasweights-0.2.5/analyze_lengths.py +0 -246
  57. programasweights-0.2.5/baselines/code_prompt.md +0 -21
  58. programasweights-0.2.5/baselines/evaluate_openai_python_code_baseline.py +0 -296
  59. programasweights-0.2.5/baselines/openai_batch_request.py +0 -218
  60. programasweights-0.2.5/baselines/prepare_alchemist_data.py +0 -194
  61. programasweights-0.2.5/baselines/prepare_var_bench_data.py +0 -53
  62. programasweights-0.2.5/baselines/python_code_sandbox.py +0 -302
  63. programasweights-0.2.5/baselines/script_evaluation_var_bench.sh +0 -3
  64. programasweights-0.2.5/baselines/script_evalution_evaluation.sh +0 -8
  65. programasweights-0.2.5/baselines/script_evalution_request.sh +0 -8
  66. programasweights-0.2.5/baselines/script_evalution_statistics.sh +0 -8
  67. programasweights-0.2.5/benchmark_pytorch_vs_onnx.py +0 -315
  68. programasweights-0.2.5/benchmark_user_experience.py +0 -375
  69. programasweights-0.2.5/check_dataset.py +0 -31
  70. programasweights-0.2.5/combine_datasets.py +0 -157
  71. programasweights-0.2.5/compare_datasets.py +0 -268
  72. programasweights-0.2.5/compare_old_vs_regen.py +0 -227
  73. programasweights-0.2.5/convert_paw_to_svg.py +0 -119
  74. programasweights-0.2.5/create_favicon_sizes.py +0 -86
  75. programasweights-0.2.5/create_visualization_from_log.py +0 -269
  76. programasweights-0.2.5/create_vqa_dataset.py +0 -217
  77. programasweights-0.2.5/debug_cache.py +0 -80
  78. programasweights-0.2.5/debug_eos_example.sh +0 -22
  79. programasweights-0.2.5/docs/guide/writing-good-specs.md +0 -36
  80. programasweights-0.2.5/estimate_data_gen_cost.py +0 -273
  81. programasweights-0.2.5/eval.py +0 -739
  82. programasweights-0.2.5/export_to_onnx.py +0 -485
  83. programasweights-0.2.5/extract_models.py +0 -193
  84. programasweights-0.2.5/inspect_data_dirs.py +0 -384
  85. programasweights-0.2.5/latest_export.csv +0 -230
  86. programasweights-0.2.5/log.train.81920.morecategories.extraprefix +0 -14928
  87. programasweights-0.2.5/main_no_spec_direct_ans_mix_continuous_sampleref_shorterprompt_vllm.py +0 -1546
  88. programasweights-0.2.5/merge_datasets.py +0 -303
  89. programasweights-0.2.5/paw.png +0 -0
  90. programasweights-0.2.5/paw.svg +0 -34
  91. programasweights-0.2.5/process_im2latex_dataset.py +0 -207
  92. programasweights-0.2.5/programasweights_lora/__init__.py +0 -28
  93. programasweights-0.2.5/programasweights_lora/compiler/__init__.py +0 -112
  94. programasweights-0.2.5/programasweights_lora/lora_format.py +0 -193
  95. programasweights-0.2.5/programasweights_lora/runtime/__init__.py +0 -6
  96. programasweights-0.2.5/programasweights_lora/runtime/interpreter_lora.py +0 -267
  97. programasweights-0.2.5/programasweights_lora/tests/test_compile_and_run.py +0 -67
  98. programasweights-0.2.5/programasweights_lora/tests/test_lora_format.py +0 -91
  99. programasweights-0.2.5/programasweights_lora/tests/test_training.py +0 -153
  100. programasweights-0.2.5/programasweights_lora/train_lora.py +0 -101
  101. programasweights-0.2.5/programasweights_lora/training/__init__.py +0 -6
  102. programasweights-0.2.5/programasweights_lora/training/loops/lora_tuning_sft.py +0 -655
  103. programasweights-0.2.5/run_eval.sh +0 -95
  104. programasweights-0.2.5/run_training.sh +0 -70
  105. programasweights-0.2.5/scripts/filter_table_by_length.py +0 -150
  106. programasweights-0.2.5/server/.env.example +0 -46
  107. programasweights-0.2.5/server/alembic/env.py +0 -48
  108. programasweights-0.2.5/server/alembic/script.py.mako +0 -24
  109. programasweights-0.2.5/server/alembic/versions/001_initial_schema.py +0 -127
  110. programasweights-0.2.5/server/alembic/versions/002_namespaced_aliases_hf_url.py +0 -37
  111. programasweights-0.2.5/server/alembic/versions/003_fulltext_search_ranking.py +0 -41
  112. programasweights-0.2.5/server/alembic/versions/004_fix_alias_slug_constraint.py +0 -49
  113. programasweights-0.2.5/server/alembic.ini +0 -36
  114. programasweights-0.2.5/server/api/__init__.py +0 -1
  115. programasweights-0.2.5/server/api/config.py +0 -75
  116. programasweights-0.2.5/server/api/dependencies.py +0 -63
  117. programasweights-0.2.5/server/api/logging_config.py +0 -74
  118. programasweights-0.2.5/server/api/main.py +0 -285
  119. programasweights-0.2.5/server/api/middleware/__init__.py +0 -0
  120. programasweights-0.2.5/server/api/middleware/rate_limit.py +0 -172
  121. programasweights-0.2.5/server/api/models/__init__.py +0 -1
  122. programasweights-0.2.5/server/api/models/database.py +0 -41
  123. programasweights-0.2.5/server/api/models/orm.py +0 -205
  124. programasweights-0.2.5/server/api/models/schemas.py +0 -225
  125. programasweights-0.2.5/server/api/routes/__init__.py +0 -1
  126. programasweights-0.2.5/server/api/routes/auth.py +0 -286
  127. programasweights-0.2.5/server/api/routes/compile.py +0 -289
  128. programasweights-0.2.5/server/api/routes/feedback.py +0 -45
  129. programasweights-0.2.5/server/api/routes/health.py +0 -31
  130. programasweights-0.2.5/server/api/routes/infer.py +0 -115
  131. programasweights-0.2.5/server/api/routes/models_info.py +0 -17
  132. programasweights-0.2.5/server/api/routes/programs.py +0 -755
  133. programasweights-0.2.5/server/api/services/__init__.py +0 -1
  134. programasweights-0.2.5/server/api/services/auto_tag_service.py +0 -103
  135. programasweights-0.2.5/server/api/services/auto_title_service.py +0 -100
  136. programasweights-0.2.5/server/api/services/compile_provider.py +0 -745
  137. programasweights-0.2.5/server/api/services/compile_service.py +0 -546
  138. programasweights-0.2.5/server/api/services/infer_service.py +0 -263
  139. programasweights-0.2.5/server/api/services/search_service.py +0 -152
  140. programasweights-0.2.5/server/api/services/storage_service.py +0 -239
  141. programasweights-0.2.5/server/benchmarks/benchmark_api.py +0 -301
  142. programasweights-0.2.5/server/benchmarks/handcrafted_specs.json +0 -130
  143. programasweights-0.2.5/server/benchmarks/last_benchmark_results.json +0 -266
  144. programasweights-0.2.5/server/benchmarks/last_stress_results.json +0 -250
  145. programasweights-0.2.5/server/benchmarks/stress_test.py +0 -695
  146. programasweights-0.2.5/server/compiler_registry.json +0 -26
  147. programasweights-0.2.5/server/provider_configs/gpt2.json +0 -17
  148. programasweights-0.2.5/server/provider_configs/qwen3-0.6b.json +0 -16
  149. programasweights-0.2.5/server/requirements.txt +0 -25
  150. programasweights-0.2.5/server/scripts/ab_test_hf_vs_vllm.py +0 -180
  151. programasweights-0.2.5/server/scripts/ablation_search.py +0 -221
  152. programasweights-0.2.5/server/scripts/backfill_hf_browser_assets.py +0 -226
  153. programasweights-0.2.5/server/scripts/backfill_hf_safetensors.py +0 -95
  154. programasweights-0.2.5/server/scripts/backfill_interestingness.py +0 -111
  155. programasweights-0.2.5/server/scripts/backfill_tags.py +0 -76
  156. programasweights-0.2.5/server/scripts/backfill_titles.py +0 -76
  157. programasweights-0.2.5/server/scripts/benchmark_gpt2.py +0 -89
  158. programasweights-0.2.5/server/scripts/cleanup_storage.py +0 -66
  159. programasweights-0.2.5/server/scripts/eval_search.py +0 -211
  160. programasweights-0.2.5/server/scripts/evict_cold_programs.py +0 -40
  161. programasweights-0.2.5/server/scripts/generate_prefix_cache.py +0 -117
  162. programasweights-0.2.5/server/scripts/launch_gpt2_compiler.py +0 -32
  163. programasweights-0.2.5/server/scripts/launch_qwen3_compiler.py +0 -32
  164. programasweights-0.2.5/server/scripts/patch_vllm.sh +0 -65
  165. programasweights-0.2.5/server/scripts/restart.sh +0 -23
  166. programasweights-0.2.5/server/scripts/start_all.sh +0 -193
  167. programasweights-0.2.5/server/scripts/start_gpt2_services.sh +0 -67
  168. programasweights-0.2.5/server/scripts/start_provider.sh +0 -27
  169. programasweights-0.2.5/server/scripts/start_services.sh +0 -86
  170. programasweights-0.2.5/server/tests/__init__.py +0 -1
  171. programasweights-0.2.5/server/tests/conftest.py +0 -86
  172. programasweights-0.2.5/server/tests/test_auth.py +0 -52
  173. programasweights-0.2.5/server/tests/test_compile.py +0 -97
  174. programasweights-0.2.5/server/tests/test_errors.py +0 -60
  175. programasweights-0.2.5/server/tests/test_infer.py +0 -72
  176. programasweights-0.2.5/server/tests/test_integration_gpu.py +0 -183
  177. programasweights-0.2.5/server/tests/test_rate_limit.py +0 -213
  178. programasweights-0.2.5/server/tests/test_storage.py +0 -134
  179. programasweights-0.2.5/server/vllm_models/__init__.py +0 -1
  180. programasweights-0.2.5/server/vllm_models/gpt2_lora_patch.py +0 -34
  181. programasweights-0.2.5/server/vllm_models/paw_compiler.py +0 -414
  182. programasweights-0.2.5/server/vllm_models/prepare_checkpoint.py +0 -143
  183. programasweights-0.2.5/server/vllm_models/register.py +0 -17
  184. programasweights-0.2.5/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.rollout_ppl.png +0 -0
  185. programasweights-0.2.5/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.train_gt_logprob.em_es.png +0 -0
  186. programasweights-0.2.5/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.train_gt_logprob.ppl.png +0 -0
  187. programasweights-0.2.5/stage2_firstpromptqwen_512_e1_generate_lora_e2grpo_overfit_one_debug.reward_plot.train_gt_logprob.reward.png +0 -0
  188. programasweights-0.2.5/test_1spec.py +0 -18
  189. programasweights-0.2.5/test_all_caching.py +0 -167
  190. programasweights-0.2.5/test_apple_count.py +0 -84
  191. programasweights-0.2.5/test_batch_pilot.py +0 -593
  192. programasweights-0.2.5/test_compile.py +0 -10
  193. programasweights-0.2.5/test_e2e.py +0 -363
  194. programasweights-0.2.5/test_execute.py +0 -6
  195. programasweights-0.2.5/test_nspecs.py +0 -18
  196. programasweights-0.2.5/test_one_vs_two_step.py +0 -149
  197. programasweights-0.2.5/test_onnx_correctness.py +0 -430
  198. programasweights-0.2.5/test_onnx_hf_model.py +0 -39
  199. programasweights-0.2.5/test_onnx_hf_with_images.py +0 -158
  200. programasweights-0.2.5/test_paw_format.py +0 -144
  201. programasweights-0.2.5/test_thinking_comparison.py +0 -542
  202. programasweights-0.2.5/train.py +0 -153
  203. programasweights-0.2.5/train_no_spec_direct_ans_mix_continuous_sampleref_trainonly_shorterprompt_withregularizer_generate_lora.py +0 -3581
  204. programasweights-0.2.5/training/README.md +0 -45
  205. programasweights-0.2.5/training/__init__.py +0 -42
  206. programasweights-0.2.5/training/data_generation/DATASET_CHANGELOG.md +0 -1791
  207. programasweights-0.2.5/training/data_generation/README.md +0 -74
  208. programasweights-0.2.5/training/data_generation/VERIFICATION_PIPELINE.md +0 -259
  209. programasweights-0.2.5/training/data_generation/build_user_bench.py +0 -487
  210. programasweights-0.2.5/training/data_generation/dry_run_batch.py +0 -248
  211. programasweights-0.2.5/training/data_generation/filter_test_data.py +0 -397
  212. programasweights-0.2.5/training/data_generation/generate_specs.py +0 -716
  213. programasweights-0.2.5/training/data_generation/generate_specs_batch.py +0 -368
  214. programasweights-0.2.5/training/data_generation/incremental_merge.py +0 -397
  215. programasweights-0.2.5/training/data_generation/merge_and_upload.py +0 -383
  216. programasweights-0.2.5/training/data_generation/regenerate_outputs_batch.py +0 -522
  217. programasweights-0.2.5/training/data_generation/synthesize_data.py +0 -536
  218. programasweights-0.2.5/training/data_generation/synthesize_data_batch.py +0 -389
  219. programasweights-0.2.5/training/data_generation/templates/filter_system.txt +0 -10
  220. programasweights-0.2.5/training/data_generation/templates/filter_user.txt +0 -9
  221. programasweights-0.2.5/training/data_generation/templates/pairs_system.txt +0 -3
  222. programasweights-0.2.5/training/data_generation/templates/pairs_user.txt +0 -14
  223. programasweights-0.2.5/training/data_generation/templates/specs_system.txt +0 -1
  224. programasweights-0.2.5/training/data_generation/templates/specs_user.txt +0 -11
  225. programasweights-0.2.5/training/data_generation/templates/specs_user_freeform.txt +0 -8
  226. programasweights-0.2.5/training/data_generation/templates/specs_user_freeform_with_examples.txt +0 -8
  227. programasweights-0.2.5/training/data_generation/templates/specs_user_with_examples.txt +0 -11
  228. programasweights-0.2.5/training/data_generation/templates/verify_system.txt +0 -10
  229. programasweights-0.2.5/training/data_generation/templates/verify_user.txt +0 -3
  230. programasweights-0.2.5/training/data_generation/templates_old/filter_system.txt +0 -10
  231. programasweights-0.2.5/training/data_generation/templates_old/filter_user.txt +0 -9
  232. programasweights-0.2.5/training/data_generation/templates_old/pairs_system.txt +0 -3
  233. programasweights-0.2.5/training/data_generation/templates_old/pairs_user.txt +0 -10
  234. programasweights-0.2.5/training/data_generation/templates_old/specs_system.txt +0 -1
  235. programasweights-0.2.5/training/data_generation/templates_old/specs_user.txt +0 -9
  236. programasweights-0.2.5/training/data_generation/templates_old/specs_user_freeform.txt +0 -8
  237. programasweights-0.2.5/training/data_generation/templates_old/specs_user_freeform_with_examples.txt +0 -8
  238. programasweights-0.2.5/training/data_generation/templates_old/specs_user_with_examples.txt +0 -10
  239. programasweights-0.2.5/training/data_generation/templates_old/verify_system.txt +0 -10
  240. programasweights-0.2.5/training/data_generation/templates_old/verify_user.txt +0 -3
  241. programasweights-0.2.5/training/data_generation/verify_test_data.py +0 -377
  242. programasweights-0.2.5/training/datasets/__init__.py +0 -1
  243. programasweights-0.2.5/training/datasets/jsonl_text_pairs.py +0 -186
  244. programasweights-0.2.5/training/loops/__init__.py +0 -1
  245. programasweights-0.2.5/training/loops/prefix_tuning_sft.py +0 -1297
  246. programasweights-0.2.5/ttt.py +0 -11
  247. programasweights-0.2.5/upload_model.py +0 -95
  248. programasweights-0.2.5/upload_onnx_to_huggingface.py +0 -242
  249. programasweights-0.2.5/upload_onnx_to_huggingface_with_token.py +0 -264
  250. programasweights-0.2.5/utils.py +0 -100
  251. programasweights-0.2.5/web-app/HANDOFF.md +0 -237
  252. programasweights-0.2.5/web-app/README.md +0 -187
  253. programasweights-0.2.5/web-app/frontend/README.md +0 -73
  254. programasweights-0.2.5/web-app/frontend/e2e/full.spec.ts +0 -861
  255. programasweights-0.2.5/web-app/frontend/e2e/helpers.ts +0 -14
  256. programasweights-0.2.5/web-app/frontend/e2e/smoke.spec.ts +0 -117
  257. programasweights-0.2.5/web-app/frontend/eslint.config.js +0 -23
  258. programasweights-0.2.5/web-app/frontend/index.html +0 -39
  259. programasweights-0.2.5/web-app/frontend/package-lock.json +0 -5245
  260. programasweights-0.2.5/web-app/frontend/package.json +0 -43
  261. programasweights-0.2.5/web-app/frontend/playwright.config.ts +0 -17
  262. programasweights-0.2.5/web-app/frontend/postcss.config.js +0 -6
  263. programasweights-0.2.5/web-app/frontend/public/apple-touch-icon.png +0 -0
  264. programasweights-0.2.5/web-app/frontend/public/browser-worker.html +0 -142
  265. programasweights-0.2.5/web-app/frontend/public/favicon-16x16.png +0 -0
  266. programasweights-0.2.5/web-app/frontend/public/favicon-32x32.png +0 -0
  267. programasweights-0.2.5/web-app/frontend/public/paw-192.png +0 -0
  268. programasweights-0.2.5/web-app/frontend/public/paw-512.png +0 -0
  269. programasweights-0.2.5/web-app/frontend/public/paw.svg +0 -34
  270. programasweights-0.2.5/web-app/frontend/public/react-test.html +0 -112
  271. programasweights-0.2.5/web-app/frontend/public/test.html +0 -40
  272. programasweights-0.2.5/web-app/frontend/public/vite.svg +0 -1
  273. programasweights-0.2.5/web-app/frontend/scripts/deploy.sh +0 -43
  274. programasweights-0.2.5/web-app/frontend/src/App.css +0 -42
  275. programasweights-0.2.5/web-app/frontend/src/App.tsx +0 -124
  276. programasweights-0.2.5/web-app/frontend/src/assets/react.svg +0 -1
  277. programasweights-0.2.5/web-app/frontend/src/components/AboutPage.tsx +0 -210
  278. programasweights-0.2.5/web-app/frontend/src/components/AgentsPage.tsx +0 -92
  279. programasweights-0.2.5/web-app/frontend/src/components/AuthorPage.tsx +0 -135
  280. programasweights-0.2.5/web-app/frontend/src/components/BrowserPage.tsx +0 -633
  281. programasweights-0.2.5/web-app/frontend/src/components/CasesSection.tsx +0 -195
  282. programasweights-0.2.5/web-app/frontend/src/components/DocsPage.tsx +0 -496
  283. programasweights-0.2.5/web-app/frontend/src/components/Footer.tsx +0 -104
  284. programasweights-0.2.5/web-app/frontend/src/components/Header.tsx +0 -188
  285. programasweights-0.2.5/web-app/frontend/src/components/HubPage.tsx +0 -351
  286. programasweights-0.2.5/web-app/frontend/src/components/HubProgramPage.tsx +0 -428
  287. programasweights-0.2.5/web-app/frontend/src/components/HubUploadPage.tsx +0 -21
  288. programasweights-0.2.5/web-app/frontend/src/components/LandingPage.tsx +0 -546
  289. programasweights-0.2.5/web-app/frontend/src/components/MainInterface.tsx +0 -664
  290. programasweights-0.2.5/web-app/frontend/src/components/NavigationHelper.tsx +0 -339
  291. programasweights-0.2.5/web-app/frontend/src/components/PrivacyPage.tsx +0 -101
  292. programasweights-0.2.5/web-app/frontend/src/components/ProfilePage.tsx +0 -283
  293. programasweights-0.2.5/web-app/frontend/src/components/SettingsPage.tsx +0 -215
  294. programasweights-0.2.5/web-app/frontend/src/components/SpecSuggestions.tsx +0 -49
  295. programasweights-0.2.5/web-app/frontend/src/components/TermsPage.tsx +0 -101
  296. programasweights-0.2.5/web-app/frontend/src/contexts/AuthContext.tsx +0 -45
  297. programasweights-0.2.5/web-app/frontend/src/index.css +0 -48
  298. programasweights-0.2.5/web-app/frontend/src/main.tsx +0 -13
  299. programasweights-0.2.5/web-app/frontend/src/types/index.ts +0 -206
  300. programasweights-0.2.5/web-app/frontend/src/utils/api.ts +0 -217
  301. programasweights-0.2.5/web-app/frontend/tailwind.config.js +0 -67
  302. programasweights-0.2.5/web-app/frontend/test-results/.last-run.json +0 -4
  303. programasweights-0.2.5/web-app/frontend/tsconfig.app.json +0 -28
  304. programasweights-0.2.5/web-app/frontend/tsconfig.json +0 -7
  305. programasweights-0.2.5/web-app/frontend/tsconfig.node.json +0 -26
  306. programasweights-0.2.5/web-app/frontend/vite.config.ts +0 -17
  307. programasweights-0.2.5/web-app/nginx-paw.conf +0 -56
  308. programasweights-0.2.5/web-app/nginx.conf +0 -111
  309. programasweights-0.2.5/web-app/setup_mysql.sh +0 -145
  310. programasweights-0.2.5/web-app/start.sh +0 -102
  311. programasweights-0.2.5/web-app/test_setup.py +0 -160
  312. programasweights-0.2.5/web-app/ttt.py +0 -26
  313. programasweights-0.2.5/web-sdk/.gitignore +0 -3
  314. programasweights-0.2.5/web-sdk/LICENSE +0 -21
  315. programasweights-0.2.5/web-sdk/README.md +0 -117
  316. programasweights-0.2.5/web-sdk/__tests__/e2e/browser.spec.ts +0 -223
  317. programasweights-0.2.5/web-sdk/__tests__/e2e/server.ts +0 -69
  318. programasweights-0.2.5/web-sdk/__tests__/e2e/start-server.ts +0 -2
  319. programasweights-0.2.5/web-sdk/__tests__/e2e/test-page.html +0 -122
  320. programasweights-0.2.5/web-sdk/__tests__/loader.test.ts +0 -244
  321. programasweights-0.2.5/web-sdk/__tests__/prompt.test.ts +0 -45
  322. programasweights-0.2.5/web-sdk/examples/basic.html +0 -121
  323. programasweights-0.2.5/web-sdk/package-lock.json +0 -3093
  324. programasweights-0.2.5/web-sdk/package.json +0 -58
  325. programasweights-0.2.5/web-sdk/playwright.config.ts +0 -19
  326. programasweights-0.2.5/web-sdk/serve.py +0 -12
  327. programasweights-0.2.5/web-sdk/src/index.ts +0 -55
  328. programasweights-0.2.5/web-sdk/src/loader.ts +0 -96
  329. programasweights-0.2.5/web-sdk/src/runtime.ts +0 -146
  330. programasweights-0.2.5/web-sdk/src/types.ts +0 -35
  331. programasweights-0.2.5/web-sdk/test-standalone.html +0 -188
  332. programasweights-0.2.5/web-sdk/tsconfig.json +0 -22
  333. programasweights-0.2.5/web-sdk/vitest.config.ts +0 -12
  334. programasweights-0.2.5/web-sdk/wllama/.git +0 -1
  335. programasweights-0.2.5/web-sdk/wllama/.github/workflows/build-hf-space.yml +0 -41
  336. programasweights-0.2.5/web-sdk/wllama/.github/workflows/ci.yml +0 -80
  337. programasweights-0.2.5/web-sdk/wllama/.github/workflows/generate-docs.yml +0 -63
  338. programasweights-0.2.5/web-sdk/wllama/.github/workflows/verify-generated-code.yml +0 -37
  339. programasweights-0.2.5/web-sdk/wllama/.gitignore +0 -16
  340. programasweights-0.2.5/web-sdk/wllama/.gitmodules +0 -3
  341. programasweights-0.2.5/web-sdk/wllama/.npmignore +0 -9
  342. programasweights-0.2.5/web-sdk/wllama/.prettierignore +0 -35
  343. programasweights-0.2.5/web-sdk/wllama/CMakeLists.txt +0 -23
  344. programasweights-0.2.5/web-sdk/wllama/LICENCE +0 -21
  345. programasweights-0.2.5/web-sdk/wllama/README.md +0 -210
  346. programasweights-0.2.5/web-sdk/wllama/README_banner.png +0 -0
  347. programasweights-0.2.5/web-sdk/wllama/assets/screenshot_0.png +0 -0
  348. programasweights-0.2.5/web-sdk/wllama/cpp/actions.hpp +0 -949
  349. programasweights-0.2.5/web-sdk/wllama/cpp/generate_glue_prototype.js +0 -115
  350. programasweights-0.2.5/web-sdk/wllama/cpp/glue.hpp +0 -874
  351. programasweights-0.2.5/web-sdk/wllama/cpp/helpers/wcommon.cpp +0 -580
  352. programasweights-0.2.5/web-sdk/wllama/cpp/helpers/wcommon.h +0 -561
  353. programasweights-0.2.5/web-sdk/wllama/cpp/helpers/wlog.cpp +0 -392
  354. programasweights-0.2.5/web-sdk/wllama/cpp/helpers/wlog.h +0 -102
  355. programasweights-0.2.5/web-sdk/wllama/cpp/helpers/wsampling.cpp +0 -526
  356. programasweights-0.2.5/web-sdk/wllama/cpp/helpers/wsampling.h +0 -107
  357. programasweights-0.2.5/web-sdk/wllama/cpp/test_glue.cpp +0 -80
  358. programasweights-0.2.5/web-sdk/wllama/cpp/wllama.cpp +0 -194
  359. programasweights-0.2.5/web-sdk/wllama/examples/basic/index.html +0 -176
  360. programasweights-0.2.5/web-sdk/wllama/examples/embeddings/index.html +0 -107
  361. programasweights-0.2.5/web-sdk/wllama/examples/main/.eslintrc.cjs +0 -18
  362. programasweights-0.2.5/web-sdk/wllama/examples/main/.gitignore +0 -24
  363. programasweights-0.2.5/web-sdk/wllama/examples/main/README.md +0 -6
  364. programasweights-0.2.5/web-sdk/wllama/examples/main/index.html +0 -13
  365. programasweights-0.2.5/web-sdk/wllama/examples/main/package-lock.json +0 -5800
  366. programasweights-0.2.5/web-sdk/wllama/examples/main/package.json +0 -40
  367. programasweights-0.2.5/web-sdk/wllama/examples/main/postcss.config.js +0 -6
  368. programasweights-0.2.5/web-sdk/wllama/examples/main/public/favicon.ico +0 -0
  369. programasweights-0.2.5/web-sdk/wllama/examples/main/public/wllama.png +0 -0
  370. programasweights-0.2.5/web-sdk/wllama/examples/main/src/App.tsx +0 -40
  371. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/ChatScreen.tsx +0 -196
  372. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/GuideScreen.tsx +0 -91
  373. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/LogScreen.tsx +0 -26
  374. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/MarkdownMessage.tsx +0 -58
  375. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/ModelScreen.tsx +0 -444
  376. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/Navbar.tsx +0 -27
  377. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/ScreenWrapper.tsx +0 -17
  378. programasweights-0.2.5/web-sdk/wllama/examples/main/src/components/Sidebar.tsx +0 -119
  379. programasweights-0.2.5/web-sdk/wllama/examples/main/src/config.ts +0 -96
  380. programasweights-0.2.5/web-sdk/wllama/examples/main/src/index.css +0 -56
  381. programasweights-0.2.5/web-sdk/wllama/examples/main/src/main.tsx +0 -11
  382. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/benchmark.ts +0 -116
  383. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/custom-models.tsx +0 -97
  384. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/displayed-model.tsx +0 -90
  385. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/messages.context.tsx +0 -120
  386. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/nl2br.tsx +0 -10
  387. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/types.ts +0 -38
  388. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/use-interval-when.ts +0 -48
  389. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/utils.ts +0 -133
  390. programasweights-0.2.5/web-sdk/wllama/examples/main/src/utils/wllama.context.tsx +0 -293
  391. programasweights-0.2.5/web-sdk/wllama/examples/main/src/vite-env.d.ts +0 -1
  392. programasweights-0.2.5/web-sdk/wllama/examples/main/tailwind.config.cjs +0 -8
  393. programasweights-0.2.5/web-sdk/wllama/examples/main/tsconfig.app.json +0 -27
  394. programasweights-0.2.5/web-sdk/wllama/examples/main/tsconfig.json +0 -11
  395. programasweights-0.2.5/web-sdk/wllama/examples/main/tsconfig.node.json +0 -13
  396. programasweights-0.2.5/web-sdk/wllama/examples/main/vite.config.ts +0 -20
  397. programasweights-0.2.5/web-sdk/wllama/guides/intro-v2.md +0 -132
  398. programasweights-0.2.5/web-sdk/wllama/index.ts +0 -1
  399. programasweights-0.2.5/web-sdk/wllama/package-lock.json +0 -7396
  400. programasweights-0.2.5/web-sdk/wllama/package.json +0 -68
  401. programasweights-0.2.5/web-sdk/wllama/scripts/build_hf_space.sh +0 -26
  402. programasweights-0.2.5/web-sdk/wllama/scripts/build_wasm.sh +0 -19
  403. programasweights-0.2.5/web-sdk/wllama/scripts/build_worker.sh +0 -39
  404. programasweights-0.2.5/web-sdk/wllama/scripts/docker-compose.yml +0 -53
  405. programasweights-0.2.5/web-sdk/wllama/scripts/generate_wasm_from_cdn.js +0 -20
  406. programasweights-0.2.5/web-sdk/wllama/scripts/http_server.js +0 -33
  407. programasweights-0.2.5/web-sdk/wllama/scripts/post_build.sh +0 -26
  408. programasweights-0.2.5/web-sdk/wllama/src/cache-manager.ts +0 -392
  409. programasweights-0.2.5/web-sdk/wllama/src/glue/glue.ts +0 -291
  410. programasweights-0.2.5/web-sdk/wllama/src/glue/messages.ts +0 -1346
  411. programasweights-0.2.5/web-sdk/wllama/src/index.ts +0 -4
  412. programasweights-0.2.5/web-sdk/wllama/src/mjs.test.ts +0 -48
  413. programasweights-0.2.5/web-sdk/wllama/src/model-manager.test.ts +0 -200
  414. programasweights-0.2.5/web-sdk/wllama/src/model-manager.ts +0 -324
  415. programasweights-0.2.5/web-sdk/wllama/src/multi-thread/wllama.js +0 -1
  416. programasweights-0.2.5/web-sdk/wllama/src/multi-thread/wllama.wasm +0 -0
  417. programasweights-0.2.5/web-sdk/wllama/src/single-thread/wllama.js +0 -1
  418. programasweights-0.2.5/web-sdk/wllama/src/single-thread/wllama.wasm +0 -0
  419. programasweights-0.2.5/web-sdk/wllama/src/utils.test.ts +0 -231
  420. programasweights-0.2.5/web-sdk/wllama/src/utils.ts +0 -271
  421. programasweights-0.2.5/web-sdk/wllama/src/wasm-from-cdn.ts +0 -9
  422. programasweights-0.2.5/web-sdk/wllama/src/wllama.test.ts +0 -402
  423. programasweights-0.2.5/web-sdk/wllama/src/wllama.ts +0 -1396
  424. programasweights-0.2.5/web-sdk/wllama/src/worker.ts +0 -298
  425. programasweights-0.2.5/web-sdk/wllama/src/workers-code/generated.ts +0 -13
  426. programasweights-0.2.5/web-sdk/wllama/src/workers-code/llama-cpp.js +0 -383
  427. programasweights-0.2.5/web-sdk/wllama/src/workers-code/opfs-utils.js +0 -141
  428. programasweights-0.2.5/web-sdk/wllama/tsconfig.build.json +0 -34
  429. programasweights-0.2.5/web-sdk/wllama/tsup.config.ts +0 -23
  430. programasweights-0.2.5/web-sdk/wllama/vitest.config.ts +0 -44
  431. {programasweights-0.2.5 → programasweights-0.2.8}/.readthedocs.yaml +0 -0
  432. {programasweights-0.2.5 → programasweights-0.2.8}/CHANGELOG.md +0 -0
  433. {programasweights-0.2.5 → programasweights-0.2.8}/LICENSE +0 -0
  434. {programasweights-0.2.5 → programasweights-0.2.8}/docs/adr/002-q4_0-adapter-format.md +0 -0
  435. {programasweights-0.2.5 → programasweights-0.2.8}/docs/adr/003-single-spec-field.md +0 -0
  436. {programasweights-0.2.5 → programasweights-0.2.8}/docs/adr/004-compiler-naming.md +0 -0
  437. {programasweights-0.2.5 → programasweights-0.2.8}/docs/adr/005-vllm-hidden-states.md +0 -0
  438. {programasweights-0.2.5 → programasweights-0.2.8}/docs/adr/006-email-api-key-auth.md +0 -0
  439. {programasweights-0.2.5 → programasweights-0.2.8}/docs/advanced/adrs.md +0 -0
  440. {programasweights-0.2.5 → programasweights-0.2.8}/docs/advanced/architecture.md +0 -0
  441. {programasweights-0.2.5 → programasweights-0.2.8}/docs/api-reference/rest-api.md +0 -0
  442. {programasweights-0.2.5 → programasweights-0.2.8}/docs/getting-started/first-program.md +0 -0
  443. {programasweights-0.2.5 → programasweights-0.2.8}/docs/getting-started/installation.md +0 -0
  444. {programasweights-0.2.5 → programasweights-0.2.8}/docs/getting-started/naming-programs.md +0 -0
  445. {programasweights-0.2.5 → programasweights-0.2.8}/docs/guide/browser-inference.md +0 -0
  446. {programasweights-0.2.5 → programasweights-0.2.8}/docs/guide/how-it-works.md +0 -0
  447. {programasweights-0.2.5 → programasweights-0.2.8}/docs/guide/local-inference.md +0 -0
  448. {programasweights-0.2.5 → programasweights-0.2.8}/docs/hub/browsing-programs.md +0 -0
  449. {programasweights-0.2.5 → programasweights-0.2.8}/docs/hub/feedback-cases.md +0 -0
  450. {programasweights-0.2.5 → programasweights-0.2.8}/docs/hub/publishing-programs.md +0 -0
  451. {programasweights-0.2.5 → programasweights-0.2.8}/docs/requirements.txt +0 -0
  452. {programasweights-0.2.5 → programasweights-0.2.8}/examples/flask_app.py +0 -0
  453. {programasweights-0.2.5 → programasweights-0.2.8}/examples/jupyter_notebook.py +0 -0
  454. {programasweights-0.2.5 → programasweights-0.2.8}/examples/langchain_integration.py +0 -0
  455. {programasweights-0.2.5 → programasweights-0.2.8}/examples/replace_openai.py +0 -0
  456. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/artifacts.py +0 -0
  457. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/cli.py +0 -0
  458. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/compiler/__init__.py +0 -0
  459. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/compiler/dummy.py +0 -0
  460. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/convert_peft_to_paw.py +0 -0
  461. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/paw_format.py +0 -0
  462. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/runtime/__init__.py +0 -0
  463. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/runtime/interpreter.py +0 -0
  464. {programasweights-0.2.5 → programasweights-0.2.8}/programasweights/runtime/interpreter_onnx.py +0 -0
  465. {programasweights-0.2.5 → programasweights-0.2.8}/tests/test_offline_cache.py +0 -0
  466. {programasweights-0.2.5 → programasweights-0.2.8}/tests/test_sdk.py +0 -0
  467. {programasweights-0.2.5 → programasweights-0.2.8}/tests/test_sdk.sh +0 -0
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .eggs/
7
+ *.egg
8
+ .venv/
9
+ venv/
10
+ .env
11
+ .mypy_cache/
12
+ .pytest_cache/
13
+ .ruff_cache/
14
+ *.so
@@ -3,7 +3,7 @@
3
3
  PAW compiles natural language specifications into tiny neural functions that run locally. Each function takes a single text input and returns a single text output. Use it when you need fuzzy text processing — classification, extraction, format repair, search, triage — that regex can't handle but a full LLM is overkill for.
4
4
 
5
5
  Website: https://programasweights.com
6
- Docs: https://programasweights.readthedocs.io
6
+ Full documentation: https://programasweights.readthedocs.io
7
7
 
8
8
  ## Install
9
9
 
@@ -20,7 +20,7 @@ import programasweights as paw
20
20
  # "email-triage" is an official pre-compiled program (slug)
21
21
  fn = paw.function("email-triage")
22
22
  fn("Urgent: server is down!") # "immediate"
23
- fn("Newsletter: spring picnic") # "wait"
23
+ fn("Newsletter: spring picnic") # "can wait"
24
24
 
25
25
  # Compile your own from a description
26
26
  program = paw.compile(
@@ -37,16 +37,8 @@ fn("I love this!") # "positive"
37
37
 
38
38
  ## Two Compilers
39
39
 
40
- | | Standard (Qwen3 0.6B) | Compact (GPT-2 124M) |
41
- |---|---|---|
42
- | Compiler name | `paw-4b-qwen3-0.6b` | `paw-4b-gpt2` |
43
- | Accuracy | Higher | Lower |
44
- | Base model size | 594 MB | 105 MB |
45
- | Program size | ~22 MB | ~5 MB |
46
- | Inference speed | ~90ms (server) | ~50ms (server) |
47
- | Runs in browser | No | Yes (must use this compiler) |
48
-
49
- Default is Standard. Use Compact for smaller files or browser deployment.
40
+ - **Standard** (`paw-4b-qwen3-0.6b`) higher accuracy, 594 MB base + ~22 MB/program. Default.
41
+ - **Compact** (`paw-4b-gpt2`) — smaller (105 MB base + ~5 MB/program), runs in browser via WebAssembly.
50
42
 
51
43
  ## When to Use PAW
52
44
 
@@ -60,7 +52,9 @@ Default is Standard. Use Compact for smaller files or browser deployment.
60
52
 
61
53
  ## Writing Good Specs
62
54
 
63
- Description + examples. Use `Input: ... Output: ...` format.
55
+ **The #1 practice: iterate with test cases.** Do not accept low performance on the first try. Build a test suite of input/output pairs, measure accuracy, then iteratively adjust wording and formatting until performance is good enough. Treat spec writing like software engineering: test, debug specific failures, fix the wording, retest.
56
+
57
+ A good spec has a description plus `Input: ... Output: ...` examples.
64
58
 
65
59
  ```python
66
60
  fn = paw.compile_and_load("""
@@ -77,9 +71,17 @@ Output: delete
77
71
  """)
78
72
  ```
79
73
 
80
- - State output constraints explicitly if any: "Return ONLY one of: X, Y, Z"
81
- - Each function is stateless: one input, one output. No conversation history.
82
- - Write a few test inputs with expected outputs, then try different spec phrasings and pick the one that passes the most.
74
+ **Spec-tuning tips:**
75
+
76
+ - Each function is stateless: one text input, one text output. No conversation history.
77
+ - **State output constraints explicitly**: "Return ONLY one of: X, Y, Z". Without this the model may produce free-form text.
78
+ - **Include examples from your actual data**: Examples outperform prose-only descriptions.
79
+ - **Debug failures before sweeping**: Look at specific failing examples and understand WHY before trying many variants.
80
+
81
+ ## Context Window
82
+
83
+ - Spec + input + output share a ~2048 token context window. Inputs that exceed it will error.
84
+ - `max_tokens` defaults to `None`: generation runs until EOS or the context limit.
83
85
 
84
86
  ## Chaining Functions
85
87
 
@@ -94,7 +96,35 @@ if label != "other":
94
96
  fix = fixer(f"{label}: {code_snippet}")
95
97
  ```
96
98
 
97
- Each function is independent -- chain them with regular Python logic.
99
+ Chain them with regular Python logic.
100
+
101
+ ## Log Monitoring
102
+
103
+ PAW functions can classify log output. Compile once with examples from your specific logs, then reuse the function locally forever:
104
+
105
+ ```python
106
+ program = paw.compile("""
107
+ Classify log lines. Return ONLY one word: ALERT or QUIET.
108
+
109
+ Input: [step 100] loss=0.05 lr=0.0001
110
+ Output: QUIET
111
+
112
+ Input: [Checkpoint] Saved model at step 1000
113
+ Output: ALERT
114
+
115
+ Input: Traceback (most recent call last):
116
+ Output: ALERT
117
+
118
+ Input: Training complete. Final loss: 0.11
119
+ Output: ALERT
120
+ """)
121
+
122
+ fn = paw.function(program.id) # reuse with saved program.id
123
+ fn("[step 200] loss=0.04") # "QUIET"
124
+ fn("[Checkpoint] Saved model") # "ALERT"
125
+ ```
126
+
127
+ Full tool with file watching, truncation, and stall detection: [examples/paw_monitor.py](https://github.com/programasweights/programasweights-python/blob/main/examples/paw_monitor.py)
98
128
 
99
129
  ## Browser / JavaScript SDK
100
130
 
@@ -129,19 +159,7 @@ Generate API keys at https://programasweights.com/settings.
129
159
 
130
160
  ## CLI
131
161
 
132
- ```bash
133
- paw compile --spec "Classify sentiment" --json
134
- paw run --program <program_id> --input "I love this!" --json
135
- paw info <program_id> # show program metadata
136
- paw rename <program_id> my-slug # name a program (requires auth)
137
- paw login # save API key
138
- ```
139
-
140
- `--json` gives structured output. Example:
141
-
142
- ```json
143
- {"program_id": "a6b454023d41ac9ca845", "slug": null, "status": "ready", "error": null, "timings": {"total_ms": 2800}}
144
- ```
162
+ Commands: `paw compile --spec "..." --json`, `paw run --program <id> --input "..."`, `paw info <id>`, `paw rename <id> <slug>`, `paw login`. All support `--json` for structured output.
145
163
 
146
164
  ## Full API Reference
147
165
 
@@ -177,17 +195,12 @@ paw.login()
177
195
 
178
196
  ## Performance
179
197
 
180
- - **First call** ~500ms (loads base model). Subsequent calls ~50-90ms.
181
- - **Base model shared** across functions. Each LoRA adapter adds ~22 MB.
182
- - **Thread-safe** and **blocking**.
198
+ - **First call** ~5-15s (loads base model). Subsequent calls 0.5-5s depending on input length.
199
+ - **Base model shared** across functions on disk. Each LoRA adapter adds ~22 MB.
183
200
  - **Cache**: `~/.cache/programasweights/`. Override with `PAW_CACHE_DIR`.
184
201
  - **Offline** after first download.
185
202
 
186
- ## Limits
187
-
188
- - Spec + input + output share a ~2048 token context window, and inputs that exceed the context window will error out (not silently truncated).
189
- - Setting `max_tokens` high is safe -- generation stops at EOS or when the window is full.
203
+ ## Case Studies
190
204
 
191
- ## Browse Programs
205
+ Detailed walkthroughs of building production systems with PAW, including what we tried and what we learned: [log monitoring](https://programasweights.readthedocs.io/en/latest/case-studies/log-monitoring/), [site navigation](https://programasweights.readthedocs.io/en/latest/case-studies/site-navigation/), [semantic search](https://programasweights.readthedocs.io/en/latest/case-studies/semantic-search/), [tool calling](https://programasweights.readthedocs.io/en/latest/case-studies/tool-calling/).
192
206
 
193
- https://programasweights.com/hub
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: programasweights
3
- Version: 0.2.5
3
+ Version: 0.2.8
4
4
  Summary: Compile natural language specifications into neural programs that run locally via llama.cpp.
5
5
  Project-URL: Homepage, https://programasweights.com
6
6
  Project-URL: Repository, https://github.com/programasweights/programasweights-python
@@ -23,7 +23,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
23
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
24
  Requires-Python: >=3.9
25
25
  Requires-Dist: httpx<1.0,>=0.27.0
26
- Requires-Dist: llama-cpp-python<=0.3.18,>=0.3.0
26
+ Requires-Dist: llama-cpp-python<=0.3.19,>=0.3.0
27
27
  Provides-Extra: test
28
28
  Requires-Dist: pytest; extra == 'test'
29
29
  Description-Content-Type: text/markdown
@@ -48,7 +48,7 @@ import programasweights as paw
48
48
  # Use a pre-compiled function (downloads once, runs locally forever)
49
49
  fn = paw.function("email-triage")
50
50
  fn("Urgent: the server is down!") # "immediate"
51
- fn("Newsletter: spring picnic") # "wait"
51
+ fn("Newsletter: spring picnic") # "can wait"
52
52
 
53
53
  # Compile your own from a description
54
54
  program = paw.compile(
@@ -18,7 +18,7 @@ import programasweights as paw
18
18
  # Use a pre-compiled function (downloads once, runs locally forever)
19
19
  fn = paw.function("email-triage")
20
20
  fn("Urgent: the server is down!") # "immediate"
21
- fn("Newsletter: spring picnic") # "wait"
21
+ fn("Newsletter: spring picnic") # "can wait"
22
22
 
23
23
  # Compile your own from a description
24
24
  program = paw.compile(
@@ -0,0 +1,113 @@
1
+ # ProgramAsWeights
2
+
3
+ **Compile natural language specs into tiny neural functions that run locally.**
4
+
5
+ Define what a function should do in plain English. PAW compiles it into a small neural program that runs on your machine — no API keys at runtime, no internet needed after setup, fully deterministic.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install programasweights
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```python
16
+ import programasweights as paw
17
+
18
+ # Use a pre-compiled function (downloads once, runs locally forever)
19
+ fn = paw.function("email-triage")
20
+ fn("Urgent: the server is down!") # "immediate"
21
+ fn("Newsletter: spring picnic") # "can wait"
22
+
23
+ # Compile your own from a description
24
+ program = paw.compile(
25
+ "Fix malformed JSON: repair missing quotes and trailing commas",
26
+ compiler="paw-4b-qwen3-0.6b" # or "paw-4b-gpt2" for smaller/faster
27
+ )
28
+ fn = paw.function(program.id)
29
+ fn("{name: 'Alice',}") # '{"name": "Alice"}'
30
+ ```
31
+
32
+ ## Two Compilers
33
+
34
+ | | Standard (Qwen3 0.6B) | Compact (GPT-2 124M) |
35
+ |--------------------|-------------------------|------------------------|
36
+ | Compiler name | `paw-4b-qwen3-0.6b` | `paw-4b-gpt2` |
37
+ | Accuracy | Higher | Lower |
38
+ | Base model size | 594 MB | 105 MB |
39
+ | Program size | ~22 MB | ~5 MB |
40
+ | Inference speed | ~90ms (server) | ~50ms (server) |
41
+ | Runs in browser | No | Yes |
42
+
43
+ Default is Standard (Qwen3 0.6B). Use Compact (GPT-2) when you need smaller files or browser deployment.
44
+
45
+ ## Browser SDK
46
+
47
+ Programs compiled with GPT-2 also run entirely in the browser via WebAssembly — no server needed, data never leaves the user's device.
48
+
49
+ ```bash
50
+ npm install @programasweights/web
51
+ ```
52
+
53
+ ```javascript
54
+ import paw from '@programasweights/web';
55
+
56
+ const fn = await paw.function('programasweights/email-triage');
57
+ const result = await fn('Urgent: the server is down!');
58
+ // result: "immediate"
59
+ ```
60
+
61
+ See the [browser SDK repo](https://github.com/programasweights/programasweights-js) for full documentation.
62
+
63
+ ## Use with AI Agents
64
+
65
+ PAW works with Cursor, Claude, Codex, and other AI coding assistants. Paste this into your agent's chat:
66
+
67
+ > I want to use ProgramAsWeights (PAW) to create fuzzy text functions that run locally. Read the instructions at https://programasweights.com/agents and help me integrate it.
68
+
69
+ Or save [`AGENTS.md`](https://programasweights.com/agents) to your project root — agents read it automatically.
70
+
71
+ ## When to Use PAW
72
+
73
+ - **Fuzzy search** — typo-tolerant matching, semantic search, near-duplicate detection
74
+ - **Format repair** — fix broken JSON, normalize dates, repair malformed inputs
75
+ - **Classification** — sentiment, urgency, categories defined in your own words
76
+ - **Extraction** — emails, names, dates from messy unstructured text
77
+ - **Log triage** — extract errors from verbose output, filter noise
78
+ - **Intent routing** — map user descriptions to the closest URL, menu item, or setting
79
+ - **Agent preprocessing** — parse tool calls, validate outputs, route tasks
80
+
81
+ ## Authentication
82
+
83
+ ```bash
84
+ # Option 1: environment variable (recommended)
85
+ export PAW_API_KEY=paw_sk_...
86
+
87
+ # Option 2: CLI login (opens browser to generate key)
88
+ paw login
89
+ ```
90
+
91
+ Generate API keys at [programasweights.com/settings](https://programasweights.com/settings). Authenticated users get higher rate limits.
92
+
93
+ ## CLI
94
+
95
+ ```bash
96
+ paw compile --spec "Extract error lines from logs" --json
97
+ paw run --program <program_id> --input "[ERROR] timeout" --json
98
+ paw login
99
+ ```
100
+
101
+ `--json` gives structured output for programmatic use.
102
+
103
+ ## Links
104
+
105
+ - **Website**: [programasweights.com](https://programasweights.com)
106
+ - **Documentation**: [programasweights.readthedocs.io](https://programasweights.readthedocs.io)
107
+ - **Python SDK**: [github.com/programasweights/programasweights-python](https://github.com/programasweights/programasweights-python)
108
+ - **Browser SDK**: [github.com/programasweights/programasweights-js](https://github.com/programasweights/programasweights-js)
109
+ - **Program Hub**: [programasweights.com/hub](https://programasweights.com/hub)
110
+
111
+ ## License
112
+
113
+ MIT
@@ -17,5 +17,5 @@ Replace the PyTorch runtime with llama-cpp-python (~80MB install). Use GGUF mode
17
17
  - Inference uses Metal (Mac), CPU (Linux/Windows) — no GPU required
18
18
  - Must pre-render chat templates server-side (no transformers tokenizer on client)
19
19
  - .paw format must change from v2 (safetensors) to v3 (GGUF adapter)
20
- - Base model is downloaded once (~623MB for Q6_K) and shared across all functions
20
+ - Base model is downloaded once (~594 MB for Q6_K) and shared across all functions
21
21
  - Per-function adapter download is ~23MB (Q4_0, confirmed lossless at 4096-scale eval)
@@ -57,7 +57,7 @@ paw rename <program_id> <new-slug> [--json]
57
57
  | Argument | Description |
58
58
  |----------|-------------|
59
59
  | `program_id` | Program hash ID or current slug. |
60
- | `new-slug` | New slug name (2-50 chars, lowercase alphanumeric and hyphens). |
60
+ | `new-slug` | New slug name (2-50 chars, lowercase alphanumeric and hyphens). Pass `""` to remove. |
61
61
 
62
62
  ## `paw info`
63
63
 
@@ -41,7 +41,7 @@ output: str = fn(input_text, max_tokens=None, temperature=0.0)
41
41
  | `max_tokens` | Maximum tokens to generate. `None` (default) = use all remaining context window. |
42
42
  | `temperature` | Sampling temperature (default `0.0`). |
43
43
 
44
- **Context limits:** Spec + input + output share a ~2048 token window. If input + output together exceed the window, generation will error. For short inputs, high `max_tokens` is safe (stops at EOS). For long inputs, set `max_tokens` conservatively.
44
+ **Context limits:** Spec + input + output share a ~2048 token window. Inputs that exceed it will error. `max_tokens` defaults to `None`: generation runs until EOS or the context limit.
45
45
 
46
46
  ## `paw.compile`
47
47
 
@@ -31,7 +31,7 @@ vLLM multi-LoRA serving on GPU 2 (or GPU 1 in 2-GPU config). Each compiled progr
31
31
 
32
32
  ## Inference (Client-side SDK)
33
33
 
34
- llama-cpp-python loads the base GGUF model (623MB, downloaded once) and hot-swaps Q4_0 adapters per function call. No PyTorch or transformers required.
34
+ llama-cpp-python loads the base GGUF model (594 MB, downloaded once) and hot-swaps Q4_0 adapters per function call. No PyTorch or transformers required.
35
35
 
36
36
  ## GPU Assignment
37
37
 
@@ -0,0 +1,132 @@
1
+ # Event-Driven Log Monitoring
2
+
3
+ Long-running processes -- training runs, deployments, data pipelines -- produce thousands of log lines. You want to know when something important happens (checkpoint saved, error, completion) without watching the terminal. PAW lets you compile a classifier that runs locally and alerts on the lines that matter.
4
+
5
+ **Full tool:** [examples/paw_monitor.py](https://github.com/programasweights/programasweights-python/blob/main/examples/paw_monitor.py) on GitHub.
6
+
7
+ ## How we built it
8
+
9
+ ### Attempt 1: Keyword matching
10
+
11
+ The obvious first approach: grep for "error", "fail", "complete".
12
+
13
+ **Result:** Too noisy. "error" matches "error_count=0" (routine metric). "complete" matches "batch complete" (every 10 seconds). Missing important lines like "Traceback" or "CUDA out of memory" that don't contain the keywords.
14
+
15
+ **Lesson:** The whole reason to use PAW is that keyword matching can't express "important enough to interrupt me."
16
+
17
+ ### Attempt 2: One-shot description
18
+
19
+ ```
20
+ Classify if this log line is important enough to alert on. Return ALERT or QUIET.
21
+ ```
22
+
23
+ **Result:** Too vague. The model alerted on everything that looked unusual, including routine debug output. "Important" means different things in different contexts.
24
+
25
+ **Lesson:** Don't rely on abstract instructions. The model needs concrete examples of what ALERT and QUIET look like in YOUR specific logs.
26
+
27
+ ### Attempt 3: Example-based spec
28
+
29
+ ```
30
+ Classify log lines. Return ONLY one word: ALERT or QUIET.
31
+
32
+ Input: [step 100] loss=0.05 lr=0.0001
33
+ Output: QUIET
34
+
35
+ Input: [Checkpoint] Saved model at step 1000
36
+ Output: ALERT
37
+
38
+ Input: Traceback (most recent call last):
39
+ Output: ALERT
40
+
41
+ Input: Training complete. Final loss: 0.11
42
+ Output: ALERT
43
+ ```
44
+
45
+ **Result:** This worked. The model learned the boundary between routine metrics (QUIET) and significant events (ALERT) from the examples. Adding 3-5 examples from actual logs was the key.
46
+
47
+ **Lesson:** Include examples from your actual data. 3-5 representative examples consistently outperform prose-only descriptions.
48
+
49
+ ### Refinement: Developer feedback
50
+
51
+ A developer using PAW for monitoring diffusion model training shared their experience. Key insights:
52
+
53
+ - **Positive instructions work better than negative ones.** "Output ALERT only if X, Y, or Z" is more reliable than "Don't alert on routine output."
54
+ - **The spec should match the monitoring context.** Different training phases produce different log patterns. Examples should cover the specific domain.
55
+ - **Stall detection needs a separate mechanism.** PAW classifies what it sees -- it can't detect the absence of output. The monitoring tool needs a timer for "no new output in N minutes."
56
+
57
+ ## The solution
58
+
59
+ ### The spec
60
+
61
+ ```python
62
+ program = paw.compile("""
63
+ Classify log lines. Return ONLY one word: ALERT or QUIET.
64
+
65
+ Input: [step 100] loss=0.05 lr=0.0001
66
+ Output: QUIET
67
+
68
+ Input: [Checkpoint] Saved model at step 1000
69
+ Output: ALERT
70
+
71
+ Input: Traceback (most recent call last):
72
+ Output: ALERT
73
+
74
+ Input: Training complete. Final loss: 0.11
75
+ Output: ALERT
76
+ """)
77
+
78
+ fn = paw.function(program.id)
79
+ ```
80
+
81
+ Compile once, save the program ID, reuse forever. The function runs locally with no internet after the first download.
82
+
83
+ ### The monitoring loop
84
+
85
+ ```python
86
+ import time
87
+
88
+ fn = paw.function("your-program-id")
89
+
90
+ last_size = 0
91
+ while True:
92
+ size = os.path.getsize(log_file)
93
+ if size > last_size:
94
+ with open(log_file) as f:
95
+ f.seek(last_size)
96
+ new_text = f.read()
97
+ last_size = size
98
+
99
+ # Truncate to last ~1000 chars to fit context window
100
+ chunk = new_text[-1000:] if len(new_text) > 1000 else new_text
101
+ result = fn(chunk)
102
+ if result.strip() == "ALERT":
103
+ send_notification(chunk)
104
+
105
+ time.sleep(10)
106
+ ```
107
+
108
+ ### Full tool
109
+
110
+ The complete [paw_monitor.py](https://github.com/programasweights/programasweights-python/blob/main/examples/paw_monitor.py) adds:
111
+
112
+ - **File watching** with `seek()` to only process new content
113
+ - **Input truncation** to fit the ~2048 token context window
114
+ - **Stall detection** -- alerts if no new output for a configurable timeout
115
+ - **`--focus` and `--ignore`** flags to guide what the classifier pays attention to
116
+ - **`--local` flag** to run entirely offline after first compile
117
+ - **`--json` output** for integration with other tools
118
+
119
+ ## Adapting this for your use case
120
+
121
+ 1. **Collect 5-10 example log lines** from your actual process -- a mix of routine output and important events
122
+ 2. **Write a spec** with `Input: ... Output: ALERT/QUIET` pairs
123
+ 3. **Test with real logs** -- pipe a log file through the classifier and check which lines it flags
124
+ 4. **Iterate** -- if it alerts too much, add more QUIET examples. If it misses things, add ALERT examples.
125
+ 5. **Save the program ID** -- compile once, monitor forever
126
+
127
+ ## Takeaways
128
+
129
+ - **Examples beat descriptions** for teaching the model your specific log patterns.
130
+ - **Compile once, run forever.** The compiled function is cached locally and needs no internet.
131
+ - **PAW classifies what it sees** -- combine with a timer for stall detection.
132
+ - **Iterate with real data.** The first spec is rarely perfect. Test, check failures, adjust examples.
@@ -0,0 +1,146 @@
1
+ # Semantic Search Without a Vector Database
2
+
3
+ Most websites rely on keyword search — PostgreSQL full-text search, Elasticsearch, or similar. These work for exact terms but miss intent: a search for "something that works in the browser" won't match a program described as "runs client-side via WebAssembly." Adding semantic understanding normally requires vector databases, embedding pipelines, and external services. PAW lets you add intent-aware reranking on top of your existing search — no infrastructure changes, no embeddings, no external dependencies.
4
+
5
+ **Try it live:** Search at [programasweights.com/hub](https://programasweights.com/hub) — try queries like "something that works in the browser" or "not a classifier."
6
+
7
+ ## How we built it
8
+
9
+ ### Attempt 1: Numeric relevance scoring (1–10)
10
+
11
+ The obvious approach: compile a scorer that rates each search result on a 1–10 scale.
12
+
13
+ ```
14
+ Rate the relevance of this search result to the query on a scale of 1-10.
15
+ Query: "counting tasks"
16
+ ```
17
+
18
+ **Result:** The model clustered everything at 8–10. A search for "counting tasks" gave 9/10 to a sentiment classifier because it vaguely involved processing text. No discrimination.
19
+
20
+ **Lesson:** Small models can't produce fine-grained numeric scores. They don't have a calibrated sense of what "7 vs 8" means.
21
+
22
+ ### Attempt 2: Binary yes/no
23
+
24
+ Simplify to binary: is this result relevant or not?
25
+
26
+ ```
27
+ Is this search result relevant to the query? Return YES or NO.
28
+ ```
29
+
30
+ **Result:** Better discrimination, but couldn't distinguish "perfect match" from "vaguely related." Everything relevant got YES, so the top results were still unordered.
31
+
32
+ **Lesson:** Binary lacks granularity. You need at least 3–4 buckets to produce a meaningful ranking.
33
+
34
+ ### Attempt 3: Discrete categories
35
+
36
+ Use 3–4 named categories that map to sort order:
37
+
38
+ ```
39
+ Rate how well the candidate matches the query.
40
+ Return ONLY one of: exact_match, highly_relevant, somewhat_relevant, not_relevant
41
+ ```
42
+
43
+ **Result:** Much better. The model could reliably distinguish "this is exactly what they asked for" from "this is tangentially related." Mapping `exact_match=3, highly_relevant=2, somewhat_relevant=1, not_relevant=0` produced clean rankings.
44
+
45
+ **Lesson:** Discrete named categories work where numeric scales fail. The names give the model clear semantic anchors.
46
+
47
+ ### Attempt 4: Explicit exclusion rules
48
+
49
+ A search for "not a classifier" still returned classifiers ranked highly. The model ignored the negation.
50
+
51
+ **Fix:** Add an explicit rule for exclusions in the spec:
52
+
53
+ ```
54
+ If the query excludes something, those candidates are not_relevant.
55
+ ```
56
+
57
+ **Result:** Negation queries started working. "Not a classifier" correctly demoted classifiers.
58
+
59
+ **Lesson:** State rules explicitly. Don't assume the model infers constraints from the query — spell them out in the spec.
60
+
61
+ ## The solution
62
+
63
+ ### Spec template
64
+
65
+ ```python
66
+ SCORER_SPEC = """
67
+ You are a search matcher. Rate how well the candidate matches the query.
68
+ Match all constraints: {constraint_types}.
69
+ If the query excludes something, those candidates are not_relevant.
70
+
71
+ Query: "{query}"
72
+
73
+ Return ONLY one of: exact_match, highly_relevant, somewhat_relevant, not_relevant
74
+ """
75
+
76
+ scorer = paw.compile(SCORER_SPEC.format(
77
+ constraint_types="topic, author, and category",
78
+ query="counting tasks by da03",
79
+ ))
80
+ ```
81
+
82
+ Replace `constraint_types` with whatever metadata your search results have (topic, author, date, category, price range, etc.).
83
+
84
+ ### Architecture
85
+
86
+ ```
87
+ User query
88
+
89
+
90
+ Keyword search (FTS / Elasticsearch / etc.)
91
+ │ returns top N candidates
92
+
93
+ Compile PAW scorer for this query (cached by query text)
94
+
95
+
96
+ Score each candidate ──► exact_match / highly_relevant / somewhat / not_relevant
97
+ │ │
98
+ ▼ ▼
99
+ Map to integers Sort descending
100
+
101
+
102
+ Return reranked results
103
+ ```
104
+
105
+ ### Candidate formatting
106
+
107
+ Each candidate is passed to the scorer as a text block. Include the fields that matter for your domain:
108
+
109
+ ```python
110
+ SCORE_MAP = {"exact_match": 3, "highly_relevant": 2, "somewhat_relevant": 1, "not_relevant": 0}
111
+
112
+ def rerank(query: str, candidates: list[dict]) -> list[dict]:
113
+ scorer = paw.compile_and_load(SCORER_SPEC.format(
114
+ constraint_types="topic, author, and category",
115
+ query=query,
116
+ ))
117
+
118
+ scored = []
119
+ for c in candidates:
120
+ text = f"Name: {c['name']}\nAuthor: {c['author']}\nDescription: {c['description']}"
121
+ label = scorer(text)
122
+ scored.append((SCORE_MAP.get(label, 0), c))
123
+
124
+ scored.sort(key=lambda x: x[0], reverse=True)
125
+ return [c for _, c in scored]
126
+ ```
127
+
128
+ ### Progressive UX
129
+
130
+ Show keyword results immediately. If the server isn't busy, fire the reranking in the background and update the results once scoring completes. Users see instant results that get refined — no loading spinner.
131
+
132
+ ## Adapting this for your site
133
+
134
+ 1. **Start with your existing search.** PAW reranking is a layer on top — it doesn't replace your keyword search.
135
+ 2. **Pick your constraint types.** What metadata do your results have? Topic, author, price, date, location?
136
+ 3. **Compile a scorer** with the template above, replacing `constraint_types` and `query`.
137
+ 4. **Score your top 10–20 results.** Don't score everything — just the candidates that keyword search already found promising.
138
+ 5. **Build a test set** of 10–20 queries with known-good rankings. Iterate on the spec until it discriminates well.
139
+ 6. The scorer is cached by query text — repeated searches are instant.
140
+
141
+ ## Takeaways
142
+
143
+ - **Discrete categories beat numeric scales** for small models. Use 3–4 named buckets.
144
+ - **State constraints and exclusions explicitly** in the spec. The model won't infer them from the query alone.
145
+ - **Rerank, don't replace.** Layer PAW scoring on top of existing keyword search for the best of both worlds.
146
+ - **Test with adversarial queries** — negations, ambiguous terms, author-specific searches — to find spec weaknesses early.