Skip to content

Add FAQ section to improve user guidance #608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Add FAQ section to improve user guidance #608

wants to merge 16 commits into from

Conversation

AoifeHughes
Copy link
Contributor

@AoifeHughes AoifeHughes commented Jun 3, 2025

This pull request adds a new FAQ section to the Turing.jl website and updates the navigation menu to include a link to the FAQ page. The FAQ section provides answers to common questions about using Turing.jl, covering topics such as random variables, implementing samplers, parallelism, debugging, syntax differences, automatic differentiation backends, and performance issues.

Website Navigation Update:

  • _quarto.yml: Added a new link to the FAQ page in the website's navigation menu.

FAQ Section Addition:

  • faq/index.qmd: Created a new FAQ page with detailed answers to common questions about Turing.jl. Topics include variable treatment, sampler implementation, parallelism, type stability, debugging, syntax differences, automatic differentiation backends, and performance debugging.

Relevant Issues:

@AoifeHughes AoifeHughes requested a review from Copilot June 3, 2025 12:01
@AoifeHughes AoifeHughes added the enhancement New feature or request label Jun 3, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new FAQ section to the Turing.jl website and updates the navigation menu to include a link to it.

  • Added a “FAQ” entry in the site navigation
  • Created faq/index.qmd with a set of common Q&A on using Turing.jl

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
_quarto.yml Inserted a navigation entry for the FAQ
faq/index.qmd Added FAQ page with detailed user guidance
Comments suppressed due to low confidence (1)

_quarto.yml:27

  • Indentation of the new navigation entry does not match the surrounding items and could break the YAML. Align the - href: faq/ and its text: line with the other menu entries.
- href: faq/

Copy link
Contributor

github-actions bot commented Jun 3, 2025

Preview the changes: https://turinglang.org/docs/pr-previews/608
Please avoid using the search feature and navigation bar in PR previews!

@AoifeHughes AoifeHughes marked this pull request as ready for review June 4, 2025 08:49
@AoifeHughes AoifeHughes self-assigned this Jun 4, 2025
@AoifeHughes AoifeHughes requested a review from penelopeysm June 4, 2025 08:52
Copy link
Member

@penelopeysm penelopeysm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice start, I think there are a few places where it's necessary to go into more detail, which I've commented on.

General comment for the entire PR: for the URLs, you can use the meta variables defined in _quarto.yml, i.e. [text]({{< meta usage-automatic-differentiation >}}) to avoid hardcoding relative paths (useful if you want to move pages around, which has happened a couple of times).

faq/index.qmd Outdated
Comment on lines 49 to 53
While there are many syntactic differences, key advantages of Turing include:
- **Julia ecosystem**: Full access to Julia's profiling and debugging tools
- **Parallel computing**: Much easier to use distributed and parallel computing inside models
- **Flexibility**: Can use arbitrary Julia code within models
- **Extensibility**: Easy to implement custom distributions and samplers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't answer the stated question?

If it's a question about syntax, I would personally think it's best to have Turing vs Stan in a single section, and Turing vs (other PPL) can be a different section. Apart from the parameter block, two of the common things that Stan models have that Turing doesn't are transformed data and generated quantities -- the gist in Turing is that any data transformations should be done before defining the model (so it's decoupled from the model) and generated quantities are covered in https://turinglang.org/docs/usage/tracking-extra-quantities/index.html.

faq/index.qmd Outdated
Comment on lines 64 to 72
## I changed one line of my model and now it's so much slower; why?

Small changes can have big performance impacts. Common culprits include:
- Type instability introduced by the change
- Switching from vectorized to scalar operations (or vice versa)
- Inadvertently causing AD backend incompatibilities
- Breaking assumptions that allowed compiler optimizations

See our [Performance Tips](../usage/performance-tips/) and [Troubleshooting Guide](../usage/troubleshooting/) for debugging performance regressions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you took the list questions from somewhere else, but I don't really like this question. I don't get the intent behind it (what is the answer supposed to be?) and the result of this is, I think, reflected in the text, which is very vague and IMO not very helpful. If the answer is basically to read the performance section.

IME interactions with AD backend don't often lead to performance differences, usually it either runs fine or it crashes. If the AD is unusually slow it usually reflects slowness in the model itself.

@AoifeHughes
Copy link
Contributor Author

I think I've addressed the comments @penelopeysm

@AoifeHughes AoifeHughes requested a review from penelopeysm July 2, 2025 10:50
Copy link
Member

@penelopeysm penelopeysm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Thanks for expanding on the points here. A few more comments, which hopefully aren't too complicated to deal with.

- **Multithreaded sampling**: Use `MCMCThreads()` to run one chain per thread
- **Distributed sampling**: Use `MCMCDistributed()` for distributed computing

See the [Core Functionality guide](../core-functionality/#sampling-multiple-chains) for examples.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
See the [Core Functionality guide](../core-functionality/#sampling-multiple-chains) for examples.
See the [Core Functionality guide]({{< meta core-functionality >}}/#sampling-multiple-chains) for examples.

faq/index.qmd Outdated
Comment on lines 104 to 111
parameters {
real mu;
real<lower=0> sigma;
}
model {
y ~ normal(mu, sigma);
}
```
Copy link
Member

@penelopeysm penelopeysm Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm not a super duper expert on Stan, but I think that these parameters don't have priors assigned and thus have completely flat priors (i.e. the prior probability is always 1 for any value of mu and any value of sigma > 0). That would make this not equivalent to the Turing model which has non-flat priors. I think you would need to specify mu ~ normal(0, 1); and sigma ~ normal(0, 1); if you want to include a prior probability that is equivalent to the Turing model below it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated this in the next commit - just pushed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants